Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-12-22 16:28:43 +0000
committerAndrew Niefer2010-12-22 16:28:43 +0000
commit020ac23dc9923a08784b5cd624e4232aa1466141 (patch)
treeb2fd35ab804a88464012aefcbd6dd47f52a5d309 /bundles/org.eclipse.equinox.executable/library/eclipse.c
parent47231733deb557a0d8d89dca58f48ec660ba4afb (diff)
downloadrt.equinox.framework-020ac23dc9923a08784b5cd624e4232aa1466141.tar.gz
rt.equinox.framework-020ac23dc9923a08784b5cd624e4232aa1466141.tar.xz
rt.equinox.framework-020ac23dc9923a08784b5cd624e4232aa1466141.zip
bug 325902 - win32 loadLibrary & cwd
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/eclipse.c')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c
index a657d643a..470900721 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -346,6 +346,7 @@ static const _TCHAR* getVMArch();
#ifdef _WIN32
static void createConsole();
+static void fixDLLSearchPath();
static int isConsoleLauncher();
#endif
static int consoleLauncher = 0;
@@ -406,6 +407,9 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
#elif _WIN32
/* this must be before doing any console stuff, platforms other than win32 leave this set to 0 */
consoleLauncher = isConsoleLauncher();
+
+ /*fix the DLL search path for security */
+ fixDLLSearchPath();
#endif
/* Find the directory where the Eclipse program is installed. */
@@ -1315,6 +1319,23 @@ static int isConsoleLauncher() {
}
return 0;
}
+
+static void fixDLLSearchPath() {
+#ifdef UNICODE
+ _TCHAR* functionName = _T_ECLIPSE("SetDllDirectoryW");
+#else
+ _TCHAR* functionName = _T_ECLIPSE("SetDllDirectoryA");
+#endif
+
+ BOOL (WINAPI *SetDLLDirectory)(LPCTSTR);
+ void * handle = loadLibrary(_T_ECLIPSE("Kernel32.dll"));
+ if (handle != NULL) {
+ if ( (SetDLLDirectory = findSymbol(handle, functionName)) != NULL) {
+ SetDLLDirectory(_T_ECLIPSE(""));
+ }
+ }
+}
+
#endif
/* Set the vm to use based on the given .ee file.

Back to the top