Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-07-20 16:30:52 -0400
committerAlain Magloire2004-07-20 16:30:52 -0400
commit243857d6effdc72517c52db2769fe9925e7a8358 (patch)
treed3ab3ea4eafc9527ca415a062ce9778d596370e6 /core/org.eclipse.cdt.core.win32/library
parent58562529e5149f91551ff41e04af64d5b146cba4 (diff)
downloadorg.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.tar.gz
org.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.tar.xz
org.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.zip
2004-07-20 Alain Magloire
Fix for PR 70359 Binaries regenerated * library/Win32ProcessEx.c * library/starter/starter.cpp * os/win32/x86/spawner.dll * os/win32/x86/starter.dll
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c21
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.cpp21
2 files changed, 36 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
index d69f02230b..3971fd2dd9 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 a60e8ac5b3..21087d46d6 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);

Back to the top