The MinGW.org Installation Manager Tool
リビジョン | 0de8716f2eb9838906fb8aaf7bfd2471a11882a2 (tree) |
---|---|
日時 | 2013-07-13 00:27:32 |
作者 | Keith Marshall <keithmarshall@user...> |
コミッター | Keith Marshall |
Correct a static string buffer aliasing issue.
@@ -1,5 +1,18 @@ | ||
1 | 1 | 2013-07-12 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 2 | |
3 | + Correct a static string buffer aliasing issue. | |
4 | + | |
5 | + * src/setup.cpp (SetupTool::setup_dll): New inline method; it ensures | |
6 | + that the buffer within approot_path() refers to the setup helper DLL. | |
7 | + (SetupTool::InitialiseSetupHookAPI): Use it, when loading the DLL. | |
8 | + (SetupTool::SetupTool): Use it again, when subsequently calling... | |
9 | + (_wunlink): ...this; it is now the preferred API, replacing... | |
10 | + (DeleteFileW): ...this; do not blindly assume that... | |
11 | + (SetupTool::dll_name): ...this remains unchanged between references; | |
12 | + it is an alias for the static buffer within approot_path(). | |
13 | + | |
14 | +2013-07-12 Keith Marshall <keithmarshall@users.sourceforge.net> | |
15 | + | |
3 | 16 | Add a custom profile for use by the setup tool. |
4 | 17 | |
5 | 18 | * xml/setup.xml: New file. |
@@ -190,6 +190,13 @@ class SetupTool | ||
190 | 190 | static const wchar_t *gui_program; |
191 | 191 | int RunInstalledProgram( const wchar_t * ); |
192 | 192 | |
193 | + inline wchar_t *setup_dll( void ) | |
194 | + { /* Helper function to ensure that the static "approot_path" buffer | |
195 | + * specifies a reference path name for mingw-get-setup-0.dll | |
196 | + */ | |
197 | + return approot_path( L"libexec\\mingw-get\\mingw-get-setup-0.dll" ); | |
198 | + } | |
199 | + | |
193 | 200 | inline void CreateApplicationLauncher |
194 | 201 | ( int, const wchar_t *, const char *, const char * ); |
195 | 202 | }; |
@@ -449,8 +456,7 @@ bool SetupTool::InitialiseSetupHookAPI( void ) | ||
449 | 456 | /* Having successfully loaded the main DLL, we perform a similar |
450 | 457 | * check for the setup tool's bridging DLL... |
451 | 458 | */ |
452 | - dll_name = approot_path( L"libexec\\mingw-get\\mingw-get-setup-0.dll" ); | |
453 | - if( (hook_dll = LoadLibraryW( dll_name )) == NULL ) | |
459 | + if( (hook_dll = LoadLibraryW( dll_name = setup_dll() )) == NULL ) | |
454 | 460 | { |
455 | 461 | /* ...once again, abandoning the installation, if this is not |
456 | 462 | * available; in this case, since we've already successfully |
@@ -1050,7 +1056,7 @@ base_dll( NULL ), hook_dll( NULL ) | ||
1050 | 1056 | * then we must now unload them; we also have no further use for |
1051 | 1057 | * mingw-get-setup-0.dll, so we may delete it. |
1052 | 1058 | */ |
1053 | - if( hook_dll != NULL ){ FreeLibrary( hook_dll ); DeleteFileW( dll_name ); } | |
1059 | + if( hook_dll != NULL ){ FreeLibrary( hook_dll ); _wunlink( setup_dll() ); } | |
1054 | 1060 | if( base_dll != NULL ){ FreeLibrary( base_dll ); } |
1055 | 1061 | |
1056 | 1062 | /* We're done with the COM subsystem; release it. |