2013-07-12 Keith Marshall <keithmarshall@users.sourceforge.net>
+ Correct a static string buffer aliasing issue.
+
+ * src/setup.cpp (SetupTool::setup_dll): New inline method; it ensures
+ that the buffer within approot_path() refers to the setup helper DLL.
+ (SetupTool::InitialiseSetupHookAPI): Use it, when loading the DLL.
+ (SetupTool::SetupTool): Use it again, when subsequently calling...
+ (_wunlink): ...this; it is now the preferred API, replacing...
+ (DeleteFileW): ...this; do not blindly assume that...
+ (SetupTool::dll_name): ...this remains unchanged between references;
+ it is an alias for the static buffer within approot_path().
+
+2013-07-12 Keith Marshall <keithmarshall@users.sourceforge.net>
+
Add a custom profile for use by the setup tool.
* xml/setup.xml: New file.
static const wchar_t *gui_program;
int RunInstalledProgram( const wchar_t * );
+ inline wchar_t *setup_dll( void )
+ { /* Helper function to ensure that the static "approot_path" buffer
+ * specifies a reference path name for mingw-get-setup-0.dll
+ */
+ return approot_path( L"libexec\\mingw-get\\mingw-get-setup-0.dll" );
+ }
+
inline void CreateApplicationLauncher
( int, const wchar_t *, const char *, const char * );
};
/* Having successfully loaded the main DLL, we perform a similar
* check for the setup tool's bridging DLL...
*/
- dll_name = approot_path( L"libexec\\mingw-get\\mingw-get-setup-0.dll" );
- if( (hook_dll = LoadLibraryW( dll_name )) == NULL )
+ if( (hook_dll = LoadLibraryW( dll_name = setup_dll() )) == NULL )
{
/* ...once again, abandoning the installation, if this is not
* available; in this case, since we've already successfully
* then we must now unload them; we also have no further use for
* mingw-get-setup-0.dll, so we may delete it.
*/
- if( hook_dll != NULL ){ FreeLibrary( hook_dll ); DeleteFileW( dll_name ); }
+ if( hook_dll != NULL ){ FreeLibrary( hook_dll ); _wunlink( setup_dll() ); }
if( base_dll != NULL ){ FreeLibrary( base_dll ); }
/* We're done with the COM subsystem; release it.