mirror of https://github.com/PCSX2/pcsx2.git
* (Issue 734) Configuring plugins from the First Time Wizard should work better now (plugins options changes wouldn't stick)
* Security fix for Windows: Forced plugin filenames to be absolute paths, which resolves issues with windows' default path search order for DLLs, and hopefully avoids some errors for users who have installed Microsoft's Improved DLL Security patch. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3974 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
ab08641dfd
commit
5e2724bdc3
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
void Clear() { wxFileName::Clear(); }
|
void Clear() { wxFileName::Clear(); }
|
||||||
|
|
||||||
|
wxCharBuffer ToUTF8() const { return GetPath().ToUTF8(); }
|
||||||
wxCharBuffer ToAscii() const { return GetPath().ToAscii(); }
|
wxCharBuffer ToAscii() const { return GetPath().ToAscii(); }
|
||||||
wxString ToString() const { return GetPath(); }
|
wxString ToString() const { return GetPath(); }
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ namespace Path
|
||||||
|
|
||||||
extern wxString Normalize( const wxString& srcpath );
|
extern wxString Normalize( const wxString& srcpath );
|
||||||
extern wxString Normalize( const wxDirName& srcpath );
|
extern wxString Normalize( const wxDirName& srcpath );
|
||||||
|
extern wxString MakeAbsolute( const wxString& srcpath );
|
||||||
|
|
||||||
extern wxString Combine( const wxString& srcPath, const wxString& srcFile );
|
extern wxString Combine( const wxString& srcPath, const wxString& srcFile );
|
||||||
extern wxString Combine( const wxDirName& srcPath, const wxFileName& srcFile );
|
extern wxString Combine( const wxDirName& srcPath, const wxFileName& srcFile );
|
||||||
|
|
|
@ -121,6 +121,13 @@ wxString Path::Normalize( const wxDirName& src )
|
||||||
return wxDirName(src).Normalize().ToString();
|
return wxDirName(src).Normalize().ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString Path::MakeAbsolute( const wxString& src )
|
||||||
|
{
|
||||||
|
wxFileName absolute( src );
|
||||||
|
absolute.MakeAbsolute();
|
||||||
|
return absolute.GetFullPath();
|
||||||
|
}
|
||||||
|
|
||||||
// Concatenates two pathnames together, inserting delimiters (backslash on win32)
|
// Concatenates two pathnames together, inserting delimiters (backslash on win32)
|
||||||
// as needed! Assumes the 'dest' is allocated to at least g_MaxPath length.
|
// as needed! Assumes the 'dest' is allocated to at least g_MaxPath length.
|
||||||
//
|
//
|
||||||
|
|
|
@ -418,6 +418,8 @@ protected:
|
||||||
|
|
||||||
int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
||||||
{
|
{
|
||||||
|
if (!searchpath.Exists()) return 0;
|
||||||
|
|
||||||
ScopedPtr<wxArrayString> placebo;
|
ScopedPtr<wxArrayString> placebo;
|
||||||
wxArrayString* realdest = dest;
|
wxArrayString* realdest = dest;
|
||||||
if( realdest == NULL )
|
if( realdest == NULL )
|
||||||
|
@ -432,8 +434,23 @@ int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest )
|
||||||
wxString pattern( L"*%s*" );
|
wxString pattern( L"*%s*" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return searchpath.Exists() ?
|
wxDir::GetAllFiles( searchpath.ToString(), realdest, pxsFmt( pattern, wxDynamicLibrary::GetDllExt()), wxDIR_FILES );
|
||||||
wxDir::GetAllFiles( searchpath.ToString(), realdest, wxsFormat( pattern, wxDynamicLibrary::GetDllExt()), wxDIR_FILES ) : 0;
|
|
||||||
|
// SECURITY ISSUE: (applies primarily to Windows, but is a good idea on any platform)
|
||||||
|
// The search folder order for plugins can vary across operating systems, and in some poorly designed
|
||||||
|
// cases (old versions of windows), the search order is a security hazard because it does not
|
||||||
|
// search where you might really expect. In our case wedo not want *any* searching. The only
|
||||||
|
// plugins we want to load are the ones we found in the directly the user specified, so make
|
||||||
|
// sure all paths are FULLY QUALIFIED ABSOLUTE PATHS.
|
||||||
|
//
|
||||||
|
// (for details, read: http://msdn.microsoft.com/en-us/library/ff919712.aspx )
|
||||||
|
|
||||||
|
for (uint i=0; i<realdest->GetCount(); ++i )
|
||||||
|
{
|
||||||
|
(*realdest)[i] = Path::MakeAbsolute((*realdest)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return realdest->GetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posts a message to the App to reload plugins. Plugins are loaded via a background thread
|
// Posts a message to the App to reload plugins. Plugins are loaded via a background thread
|
||||||
|
|
|
@ -634,8 +634,24 @@ void Panels::PluginSelectorPanel::OnConfigure_Clicked( wxCommandEvent& evt )
|
||||||
|
|
||||||
if( ConfigureFnptr configfunc = (ConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
if( ConfigureFnptr configfunc = (ConfigureFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"configure" ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
wxWindowDisabler disabler;
|
wxWindowDisabler disabler;
|
||||||
ScopedCoreThreadPause paused_core( new SysExecEvent_SaveSinglePlugin(pid) );
|
ScopedCoreThreadPause paused_core( new SysExecEvent_SaveSinglePlugin(pid) );
|
||||||
|
if (!CorePlugins.AreLoaded())
|
||||||
|
{
|
||||||
|
typedef void (CALLBACK* SetDirFnptr)( const char* dir );
|
||||||
|
|
||||||
|
if( SetDirFnptr func = (SetDirFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"setSettingsDir" ) )
|
||||||
|
{
|
||||||
|
func( GetSettingsFolder().ToUTF8() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( SetDirFnptr func = (SetDirFnptr)dynlib.GetSymbol( tbl_PluginInfo[pid].GetShortname() + L"setLogDir" ) )
|
||||||
|
{
|
||||||
|
func( GetLogFolder().ToUTF8() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configfunc();
|
configfunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue