Optimize away more calls to GetModuleHandle(0) with __ImageBase under MSVC
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6918 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
5f1651ab91
commit
daa57f1f33
2 changed files with 19 additions and 4 deletions
|
@ -49,6 +49,14 @@
|
|||
#define SHUTDOWN_GRACE_OVERRIDE 0x00000020
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
#define HINST_THISCOMPONENT ( (HINSTANCE) &__ImageBase )
|
||||
#define HINST_APPLICATION HINST_THISCOMPONENT
|
||||
#else
|
||||
#define HINST_APPLICATION ( (HINSTANCE) GetModuleHandle(NULL) )
|
||||
#endif
|
||||
|
||||
#if !defined(NSIS_CONFIG_VISIBLE_SUPPORT) && !defined(NSIS_CONFIG_SILENT_SUPPORT)
|
||||
#error One of NSIS_CONFIG_SILENT_SUPPORT or NSIS_CONFIG_VISIBLE_SUPPORT must be defined.
|
||||
#endif
|
||||
|
@ -146,7 +154,7 @@ EXTERN_C void NSISWinMainNOCRT()
|
|||
|
||||
#ifndef _WIN64
|
||||
{
|
||||
// KEY_WOW64_xxKEY causes registry functions to fail on WinNT4 & Win2000.
|
||||
// KEY_WOW64_xxKEY flags causes registry functions to fail on WinNT4 & Win2000.
|
||||
// We don't filter them out because all registry instructions are supposed to fail when
|
||||
// accessing a unsupported view and RegKey* takes care of that by looking at the WOW64 flag.
|
||||
FARPROC fp = myGetProcAddress(MGA_IsOS);
|
||||
|
@ -191,7 +199,7 @@ EXTERN_C void NSISWinMainNOCRT()
|
|||
mystrcpy(state_command_line, GetCommandLine());
|
||||
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
g_hInstance = GetModuleHandle(NULL);
|
||||
g_hInstance = HINST_APPLICATION;
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
cmdline = state_command_line;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue