From: sirakaba Date: Sun, 29 Aug 2010 05:30:27 +0000 (+0000) Subject: 作業ディレクトリからライブラリを読み込まないように修正。 X-Git-Tag: 0.01beta8~73 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8e3b8eb8a6e305c399c6b62bdb8e8aca5af599eb;hp=76764fc588c20e39fd7a9ec21749898cb6de8868;p=tpi%2Flychee.git 作業ディレクトリからライブラリを読み込まないように修正。 git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@295 9df91469-1e22-0410-86e7-ea8537beb833 --- diff --git a/src/common/library/library.h b/src/common/library/library.h index 59d907b..d8d73e3 100644 --- a/src/common/library/library.h +++ b/src/common/library/library.h @@ -36,6 +36,17 @@ wxString MB2String(const char * sz); wxString UTF82String(const char * sz); wxString WC2String(const wchar_t * sz); +inline void RemoveCwdFromSearchPath(void) +{ +#ifdef __WINDOWS__ + static void * p = ::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW"); + if (p != NULL) + { + ((int (__stdcall *)(const wchar_t *)) p)(L""); + } +#endif +} + #include #ifndef WXWIN_COMPATIBILITY_2_8 #define GetAttribute GetPropVal diff --git a/src/plugin/7zArc/7zArc.cpp b/src/plugin/7zArc/7zArc.cpp index 2cf5a30..206da5c 100644 --- a/src/plugin/7zArc/7zArc.cpp +++ b/src/plugin/7zArc/7zArc.cpp @@ -734,6 +734,7 @@ int __stdcall LoadPlugin wxULongLong_t _nTypeId ) { + ::RemoveCwdFromSearchPath(); g_hLib.Load(LIB_NAME); if (! g_hLib.IsLoaded()) { diff --git a/src/plugin/calLibrary/calLibrary.cpp b/src/plugin/calLibrary/calLibrary.cpp index 7fc1012..fa98f48 100644 --- a/src/plugin/calLibrary/calLibrary.cpp +++ b/src/plugin/calLibrary/calLibrary.cpp @@ -454,6 +454,7 @@ int __stdcall LoadPlugin // 対象が存在するならば対応するライブラリを調査、 // 対象が存在しないならば指示されたライブラリをロード。 + ::RemoveCwdFromSearchPath(); if (! ::wxFileExists(_szArcName)) { // 適当な位置まで移動。 diff --git a/src/plugin/eggArc/eggArc.cpp b/src/plugin/eggArc/eggArc.cpp index 9b2e6a6..da0fbdd 100644 --- a/src/plugin/eggArc/eggArc.cpp +++ b/src/plugin/eggArc/eggArc.cpp @@ -209,6 +209,7 @@ int __stdcall LoadPlugin wxULongLong_t ) { + ::RemoveCwdFromSearchPath(); g_hLib = ::LoadLibrary(L"UnEGG32.dll"); if (g_hLib == NULL) { diff --git a/src/plugin/rarArc/rarArc.cpp b/src/plugin/rarArc/rarArc.cpp index 0dd9348..3a8f5e4 100644 --- a/src/plugin/rarArc/rarArc.cpp +++ b/src/plugin/rarArc/rarArc.cpp @@ -190,6 +190,7 @@ int __stdcall LoadPlugin wxULongLong_t ) { + ::RemoveCwdFromSearchPath(); g_hLib.Load(g_hLib.CanonicalizeName(wxT("unrar"))); if (! g_hLib.IsLoaded()) {