diff --git a/core/org.eclipse.cdt.core.win32/ChangeLog b/core/org.eclipse.cdt.core.win32/ChangeLog index 25e25bd91c5..4c4ef9577b5 100644 --- a/core/org.eclipse.cdt.core.win32/ChangeLog +++ b/core/org.eclipse.cdt.core.win32/ChangeLog @@ -1,3 +1,13 @@ +2004-07-20 Alex Chapiro + + Fix for PR 70359 + Binaries regenerated + + * library/Win32ProcessEx.c + * library/starter/starter.cpp + * os/win32/x86/spawner.dll + * os/win32/x86/starter.dll + 2004-04-29 Alex Chapiro Support for I18N within spawner. diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c index d69f02230bd..3971fd2dd9a 100644 --- a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c +++ b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c @@ -108,7 +108,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0 int ret = 0; _TCHAR szCmdLine[MAX_CMD_SIZE]; int nBlkSize = MAX_ENV_SIZE; - _TCHAR * szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR)); + _TCHAR * szEnvBlock = NULL; jsize nCmdTokens = 0; jsize nEnvVars = 0; int i; @@ -220,10 +220,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0 szCmdLine[nPos] = _T('\0'); + +#ifdef DEBUG_MONITOR + _stprintf(buffer, _T("There are %i environment variables \n"), nEnvVars); + OutputDebugStringW(buffer); +#endif // Prepare environment block if (nEnvVars > 0) { nPos = 0; + szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR)); for(i = 0; i < nEnvVars; ++i) { jobject item = (*env) -> GetObjectArrayElement(env, envp, i); @@ -298,7 +304,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0 0, /* thread security attribute */ FALSE, /* inherits system handles */ flags, /* normal attached process */ - envBlk, /* environment block */ + szEnvBlock, /* environment block */ cwd, /* change to the new current directory */ &si, /* (in) startup information */ &pi); /* (out) process information */ @@ -307,8 +313,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0 if(NULL != cwd) free((void *)cwd); - - free(szEnvBlock); + + if(NULL != szEnvBlock) + free(szEnvBlock); if (!ret) // Launching error { @@ -411,7 +418,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1 int nPos; _TCHAR szCmdLine[MAX_CMD_SIZE]; int nBlkSize = MAX_ENV_SIZE; - _TCHAR * szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR)); + _TCHAR * szEnvBlock = NULL; sa.nLength = sizeof(sa); @@ -450,6 +457,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1 // Prepare environment block if (nEnvVars > 0) { + szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR)); nPos = 0; for(i = 0; i < nEnvVars; ++i) { @@ -516,7 +524,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1 if(NULL != cwd) free(cwd); - free(szEnvBlock); + if(NULL != szEnvBlock) + free(szEnvBlock); if (!ret) // error { diff --git a/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp b/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp index a60e8ac5b32..21087d46d6b 100644 --- a/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp +++ b/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp @@ -151,6 +151,27 @@ extern "C" int _tmain(int argc, _TCHAR * argv[]) { return -1;; } + + +#ifdef DEBUG_MONITOR + _TCHAR * lpvEnv = GetEnvironmentStringsW(); + + // If the returned pointer is NULL, exit. + if (lpvEnv == NULL) + OutputDebugStringW(_T("Cannot Read Environment\n")); + else { + // Variable strings are separated by NULL byte, and the block is + // terminated by a NULL byte. + + OutputDebugStringW(_T("Starter: Environment\n")); + for (_TCHAR * lpszVariable = (_TCHAR *) lpvEnv; *lpszVariable; lpszVariable+=_tcslen(lpszVariable) + 1) { + _stprintf(buffer, _T("%s\n"), lpszVariable); + OutputDebugStringW(buffer); + } + + FreeEnvironmentStringsW(lpvEnv); + } +#endif #ifdef DEBUG_MONITOR _stprintf(buffer, _T("Starting: %s\n"), szCmdLine); OutputDebugStringW(buffer); diff --git a/core/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll b/core/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll index a654506805e..d2bb0a6563e 100644 Binary files a/core/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll and b/core/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll differ diff --git a/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe b/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe index 8161d7fece3..105b0a1ba76 100644 Binary files a/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe and b/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe differ