Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2007-05-15 22:05:04 -0400
committerDoug Schaefer2007-05-15 22:05:04 -0400
commit7a63a01f7b209cd13979d701c5c15a83d18cc21b (patch)
treee93c60356752151ccdbf199f16cdb8a94939961a /core/org.eclipse.cdt.core.win32/library
parent10323d137c66289f2c82463f27372148d74828f8 (diff)
downloadorg.eclipse.cdt-7a63a01f7b209cd13979d701c5c15a83d18cc21b.tar.gz
org.eclipse.cdt-7a63a01f7b209cd13979d701c5c15a83d18cc21b.tar.xz
org.eclipse.cdt-7a63a01f7b209cd13979d701c5c15a83d18cc21b.zip
Bug 176353 - For cygwin apps started by the Spawner, use the cygwin kill utility to send it signals. Also wrote the makefile to use g++ for the spawner. Finally replace all VS projects with makefiles for MinGW.
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Makefile18
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c183
-rw-r--r--core/org.eclipse.cdt.core.win32/library/iostream.c23
-rw-r--r--core/org.eclipse.cdt.core.win32/library/raise.c4
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.c12
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.dep18
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.dsp181
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.dsw29
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.mak301
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/Makefile23
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.cpp490
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.dep5
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.dsp90
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.dsw29
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.mak193
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/Makefile10
16 files changed, 424 insertions, 1185 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/Makefile b/core/org.eclipse.cdt.core.win32/library/Makefile
index c00aa7f93e..176727fc01 100644
--- a/core/org.eclipse.cdt.core.win32/library/Makefile
+++ b/core/org.eclipse.cdt.core.win32/library/Makefile
@@ -1,7 +1,7 @@
# makefile for libspawner.so
ifeq ($(JAVA_HOME),)
-$(warning JAVA_HOME not set in environment)
+$(error JAVA_HOME not set in environment)
endif
# Defaults which can be overridden.
@@ -11,8 +11,8 @@ ARCH = x86
JDK_INCLUDES= "$(JAVA_HOME)/include"
JDK_OS_INCLUDES= "$(JAVA_HOME)/include/$(OS)"
-CC=gcc
-CFLAGS = -DUNICODE -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
+CC=g++
+CFLAGS = -DUNICODE -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
CXX=g++
CXXFLAGS=$(CFLAGS)
@@ -22,18 +22,12 @@ LIB_NAME_SPAWNER = spawner.dll
LIB_NAME_FULL_SPAWNER = $(INSTALL_DIR)/spawner.dll
OBJS_SPAWNER=StdAfx.o Win32ProcessEx.o iostream.o raise.o spawner.o
-WINREG = $(INSTALL_DIR)/winreg.dll
-OBJS_WINREG = winreg.o
-
-all: $(LIB_NAME_FULL_SPAWNER) $(WINREG)
+all: $(LIB_NAME_FULL_SPAWNER)
rebuild: clean all
$(LIB_NAME_FULL_SPAWNER) : $(OBJS_SPAWNER)
- $(CC) -Wl,--kill-at -shared -o $(LIB_NAME_FULL_SPAWNER) $(OBJS_SPAWNER)
+ $(CC) -Wl,--kill-at -shared -o $(LIB_NAME_FULL_SPAWNER) $(OBJS_SPAWNER) -lpsapi
clean :
- $(RM) $(OBJS_SPAWNER) $(LIB_NAME_FULL_SPAWNER) $(OBJS_WINREG) $(WINREG)
-
-$(WINREG) : $(OBJS_WINREG)
- $(CXX) -Wl,--kill-at -shared -o $(WINREG) $(OBJS_WINREG)
+ $(RM) $(OBJS_SPAWNER)
diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
index bd7d583694..a88df2aa7f 100644
--- a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
+++ b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
@@ -49,7 +49,7 @@ static int procCounter = 0; // Number of running processes
// This is a VM helper
-JNIEXPORT void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg);
+void ThrowByName(JNIEnv *env, const char *name, const char *msg);
// Creates _procInfo block for every launched procss
pProcInfo_t createProcInfo();
@@ -61,7 +61,7 @@ pProcInfo_t findProcInfo(int pid);
unsigned int _stdcall waitProcTermination(void* pv) ;
// This is a helper function to prevent losing of quotatin marks
-static int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLenght, int availSpace);
+static int copyTo(wchar_t * target, const wchar_t * source, int cpyLenght, int availSpace);
// Use this function to clean project descriptor and return it to the pool of available blocks.
static void cleanUpProcBlock(pProcInfo_t pCurProcInfo);
@@ -79,7 +79,7 @@ typedef enum {
extern CRITICAL_SECTION cs;
-extern _TCHAR path[MAX_PATH]; // Directory where spawner.dll is located
+extern wchar_t path[MAX_PATH]; // Directory where spawner.dll is located
static HMODULE hVM = NULL; // VM handler
@@ -97,13 +97,14 @@ static int nCounter = 0; // We use it to build unique synchronisation object nam
// [out] channels - streams handlers
/////////////////////////////////////////////////////////////////////////////////////
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
(JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir, jintArray channels, jstring slaveName, jint fdm)
{
return -1;
}
-void ensureSize(_TCHAR** ptr, int* psize, int requiredLength)
+void ensureSize(wchar_t** ptr, int* psize, int requiredLength)
{
int size= *psize;
if (requiredLength > size) {
@@ -111,7 +112,7 @@ void ensureSize(_TCHAR** ptr, int* psize, int requiredLength)
if (size < requiredLength) {
size= requiredLength;
}
- *ptr= (_TCHAR *)realloc(*ptr, size * sizeof(_TCHAR));
+ *ptr= (wchar_t *)realloc(*ptr, size * sizeof(wchar_t));
if (NULL == *ptr) {
*psize= 0;
}
@@ -121,6 +122,7 @@ void ensureSize(_TCHAR** ptr, int* psize, int requiredLength)
}
}
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
(JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir, jintArray channels)
{
@@ -128,13 +130,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
PROCESS_INFORMATION pi = {0};
STARTUPINFOW si;
DWORD flags = 0;
- const _TCHAR * cwd = NULL;
+ const wchar_t * cwd = NULL;
LPVOID envBlk = NULL;
int ret = 0;
int nCmdLineLength= 0;
- _TCHAR * szCmdLine= 0;
+ wchar_t * szCmdLine= 0;
int nBlkSize = MAX_ENV_SIZE;
- _TCHAR * szEnvBlock = NULL;
+ wchar_t * szEnvBlock = NULL;
jsize nCmdTokens = 0;
jsize nEnvVars = 0;
int i;
@@ -142,19 +144,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
int nPos;
pProcInfo_t pCurProcInfo;
DWORD dwThreadId;
- _TCHAR eventBreakName[20];
- _TCHAR eventWaitName[20];
- _TCHAR eventTerminateName[20];
+ wchar_t eventBreakName[20];
+ wchar_t eventWaitName[20];
+ wchar_t eventTerminateName[20];
#ifdef DEBUG_MONITOR
- _TCHAR buffer[1000];
+ wchar_t buffer[1000];
#endif
int nLocalCounter;
- _TCHAR inPipeName[PIPE_NAME_LENGTH];
- _TCHAR outPipeName[PIPE_NAME_LENGTH];
- _TCHAR errPipeName[PIPE_NAME_LENGTH];
+ wchar_t inPipeName[PIPE_NAME_LENGTH];
+ wchar_t outPipeName[PIPE_NAME_LENGTH];
+ wchar_t errPipeName[PIPE_NAME_LENGTH];
nCmdLineLength= MAX_CMD_SIZE;
- szCmdLine= (_TCHAR *)malloc(nCmdLineLength * sizeof(_TCHAR));
+ szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine[0]= _T('\0');
if((HIBYTE(LOWORD(GetVersion()))) & 0x80)
{
@@ -172,14 +174,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
// Create pipe names
EnterCriticalSection(&cs);
- _stprintf(inPipeName, L"\\\\.\\pipe\\stdin%08i%010i", pid, nCounter);
- _stprintf(outPipeName, L"\\\\.\\pipe\\stdout%08i%010i", pid, nCounter);
- _stprintf(errPipeName, L"\\\\.\\pipe\\stderr%08i%010i", pid, nCounter);
+ swprintf(inPipeName, L"\\\\.\\pipe\\stdin%08i%010i", pid, nCounter);
+ swprintf(outPipeName, L"\\\\.\\pipe\\stdout%08i%010i", pid, nCounter);
+ swprintf(errPipeName, L"\\\\.\\pipe\\stderr%08i%010i", pid, nCounter);
nLocalCounter = nCounter;
++nCounter;
LeaveCriticalSection(&cs);
-
if ((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateNamedPipeW(inPipeName, PIPE_ACCESS_OUTBOUND,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, PIPE_SIZE, PIPE_SIZE, PIPE_TIMEOUT, NULL))) ||
@@ -197,13 +198,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
}
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Opened pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
+ swprintf(buffer, _T("Opened pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
OutputDebugStringW(buffer);
#endif
- nCmdTokens = (*env) -> GetArrayLength(env, cmdarray);
- nEnvVars = (*env) -> GetArrayLength(env, envp);
+ nCmdTokens = env->GetArrayLength(cmdarray);
+ nEnvVars = env->GetArrayLength(envp);
pCurProcInfo = createProcInfo();
@@ -214,9 +215,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
}
// Construct starter's command line
- _stprintf(eventBreakName, L"SABreak%p", pCurProcInfo);
- _stprintf(eventWaitName, L"SAWait%p", pCurProcInfo);
- _stprintf(eventTerminateName, L"SATerm%p", pCurProcInfo);
+ swprintf(eventBreakName, L"SABreak%p", pCurProcInfo);
+ swprintf(eventWaitName, L"SAWait%p", pCurProcInfo);
+ swprintf(eventTerminateName, L"SATerm%p", pCurProcInfo);
pCurProcInfo -> eventBreak = CreateEventW(NULL, TRUE, FALSE, eventBreakName);
ResetEvent(pCurProcInfo -> eventBreak);
pCurProcInfo -> eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
@@ -224,15 +225,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
pCurProcInfo -> eventTerminate = CreateEventW(NULL, TRUE, FALSE, eventTerminateName);
ResetEvent(pCurProcInfo -> eventTerminate);
- nPos = _stprintf(szCmdLine, L"%sstarter.exe %i %i %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName);
+ swprintf(szCmdLine, L"%sstarter.exe %i %i %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName);
+ nPos = wcslen(szCmdLine);
// Prepare command line
for(i = 0; i < nCmdTokens; ++i)
{
- jobject item = (*env) -> GetObjectArrayElement(env, cmdarray, i);
- jsize len = (*env) -> GetStringLength(env, item);
+ jstring item = (jstring)env->GetObjectArrayElement(cmdarray, i);
+ jsize len = env->GetStringLength(item);
int nCpyLen;
- const _TCHAR * str = (*env) -> GetStringChars(env, item, 0);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(item, 0);
if(NULL != str)
{
int requiredSize= nPos+len+2;
@@ -254,52 +256,51 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
- (*env) -> ReleaseStringChars(env, item, str);
+ env->ReleaseStringChars(item, (const jchar *)str);
}
}
szCmdLine[nPos] = _T('\0');
-
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("There are %i environment variables \n"), nEnvVars);
+ swprintf(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));
+ szEnvBlock = (wchar_t *)malloc(nBlkSize * sizeof(wchar_t));
for(i = 0; i < nEnvVars; ++i)
{
- jobject item = (*env) -> GetObjectArrayElement(env, envp, i);
- jsize len = (*env) -> GetStringLength(env, item);
- const _TCHAR * str = (*env) -> GetStringChars(env, item, 0);
+ jstring item = (jstring)env->GetObjectArrayElement(envp, i);
+ jsize len = env->GetStringLength(item);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(item, 0);
if(NULL != str)
{
while((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
{
nBlkSize += MAX_ENV_SIZE;
- szEnvBlock = (_TCHAR *)realloc(szEnvBlock, nBlkSize * sizeof(_TCHAR));
+ szEnvBlock = (wchar_t *)realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
if(NULL == szEnvBlock)
{
ThrowByName(env, "java/io/IOException", "Not enough memory");
return 0;
}
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Realloc environment block; new length is %i \n"), nBlkSize);
+ swprintf(buffer, _T("Realloc environment block; new length is %i \n"), nBlkSize);
OutputDebugStringW(buffer);
#endif
}
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("%s\n"), str);
+ swprintf(buffer, _T("%s\n"), str);
OutputDebugStringW(buffer);
#endif
- _tcsncpy(szEnvBlock + nPos, str, len);
+ wcsncpy(szEnvBlock + nPos, str, len);
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
- (*env) -> ReleaseStringChars(env, item, str);
+ env->ReleaseStringChars(item, (const jchar *)str);
}
}
szEnvBlock[nPos] = _T('\0');
@@ -309,11 +310,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
if (dir != 0)
{
- const _TCHAR * str = (*env) -> GetStringChars(env, dir, 0);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(dir, 0);
if(NULL != str)
{
- cwd = _tcsdup(str);
- (*env) -> ReleaseStringChars(env, dir, str);
+ cwd = wcsdup(str);
+ env->ReleaseStringChars(dir, (const jchar *)str);
}
}
@@ -348,7 +349,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
cwd, /* change to the new current directory */
&si, /* (in) startup information */
&pi); /* (out) process information */
-
+
if(NULL != cwd)
free((void *)cwd);
@@ -364,7 +365,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
CloseHandle(stdHandles[2]);
- FormatMessage(
+ FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -387,9 +388,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
HANDLE h[2];
int what;
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
-
EnterCriticalSection(&cs);
pCurProcInfo -> pid = pi.dwProcessId;
@@ -401,7 +399,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
if((what != WAIT_OBJECT_0) && (pCurProcInfo -> pid > 0)) // CreateProcess failed
{
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Process %i failed\n"), pi.dwProcessId);
+ swprintf(buffer, _T("Process %i failed\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
#endif
cleanUpProcBlock(pCurProcInfo);
@@ -418,7 +416,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
file_handles[0] = (int)stdHandles[0];
file_handles[1] = (int)stdHandles[1];
file_handles[2] = (int)stdHandles[2];
- (*env) -> SetIntArrayRegion(env, channels, 0, 3, (jint *)file_handles);
+ env->SetIntArrayRegion(channels, 0, 3, (jint *)file_handles);
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Process started\n"));
#endif
@@ -428,6 +426,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
}
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
return ret;
@@ -441,6 +441,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
// [in] envp - array of environment variables
// [in] dir - working directory
/////////////////////////////////////////////////////////////////////////////////////
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
(JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir)
{
@@ -449,20 +450,20 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
PROCESS_INFORMATION pi = {0};
STARTUPINFOW si;
DWORD flags = 0;
- _TCHAR * cwd = NULL;
- _TCHAR * envBlk = NULL;
+ wchar_t * cwd = NULL;
+ wchar_t * envBlk = NULL;
int ret = 0;
jsize nCmdTokens = 0;
jsize nEnvVars = 0;
int i;
int nPos;
int nCmdLineLength= 0;
- _TCHAR * szCmdLine= 0;
+ wchar_t * szCmdLine= 0;
int nBlkSize = MAX_ENV_SIZE;
- _TCHAR * szEnvBlock = NULL;
+ wchar_t * szEnvBlock = NULL;
nCmdLineLength= MAX_CMD_SIZE;
- szCmdLine= (_TCHAR *)malloc(nCmdLineLength * sizeof(_TCHAR));
+ szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine[0]= 0;
sa.nLength = sizeof(sa);
@@ -470,18 +471,18 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
sa.bInheritHandle = TRUE;
- nCmdTokens = (*env) -> GetArrayLength(env, cmdarray);
- nEnvVars = (*env) -> GetArrayLength(env, envp);
+ nCmdTokens = env->GetArrayLength(cmdarray);
+ nEnvVars = env->GetArrayLength(envp);
nPos = 0;
// Prepare command line
for(i = 0; i < nCmdTokens; ++i)
{
- jobject item = (*env) -> GetObjectArrayElement(env, cmdarray, i);
- jsize len = (*env) -> GetStringLength(env, item);
+ jstring item = (jstring)env->GetObjectArrayElement(cmdarray, i);
+ jsize len = env->GetStringLength(item);
int nCpyLen;
- const _TCHAR * str = (*env) -> GetStringChars(env, item, 0);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(item, 0);
if(NULL != str)
{
int requiredSize= nPos+len+2;
@@ -503,7 +504,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
- (*env) -> ReleaseStringChars(env, item, str);
+ env->ReleaseStringChars(item, (const jchar *)str);
}
}
@@ -512,30 +513,30 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
// Prepare environment block
if (nEnvVars > 0)
{
- szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR));
+ szEnvBlock = (wchar_t *)malloc(nBlkSize * sizeof(wchar_t));
nPos = 0;
for(i = 0; i < nEnvVars; ++i)
{
- jobject item = (*env) -> GetObjectArrayElement(env, envp, i);
- jsize len = (*env) -> GetStringLength(env, item);
- const _TCHAR * str = (*env) -> GetStringChars(env, item, 0);
+ jstring item = (jstring)env->GetObjectArrayElement(envp, i);
+ jsize len = env->GetStringLength(item);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(item, 0);
if(NULL != str)
{
while((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
{
nBlkSize += MAX_ENV_SIZE;
- szEnvBlock = (_TCHAR *)realloc(szEnvBlock, nBlkSize * sizeof(_TCHAR));
+ szEnvBlock = (wchar_t *)realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
if(NULL == szEnvBlock)
{
ThrowByName(env, "java/io/Exception", "Not enough memory");
return 0;
}
}
- _tcsncpy(szEnvBlock + nPos, str, len);
+ wcsncpy(szEnvBlock + nPos, str, len);
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
- (*env) -> ReleaseStringChars(env, item, str);
+ env->ReleaseStringChars(item, (const jchar *)str);
}
}
szEnvBlock[nPos] = _T('\0');
@@ -546,11 +547,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
if (dir != 0)
{
- const _TCHAR * str = (*env) -> GetStringChars(env, dir, 0);
+ const wchar_t * str = (const wchar_t *)env->GetStringChars(dir, 0);
if(NULL != str)
{
- cwd = _tcsdup(str);
- (*env) -> ReleaseStringChars(env, dir, str);
+ cwd = wcsdup(str);
+ env->ReleaseStringChars(dir, (const jchar *)str);
}
}
@@ -595,7 +596,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (char *)&lpMsgBuf,
+ (wchar_t *)&lpMsgBuf,
0,
NULL
);
@@ -624,6 +625,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
// [in] uid - unique process ID
// [in] signal - signal to raise
/////////////////////////////////////////////////////////////////////////////////////
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
(JNIEnv * env, jobject process, jint uid, jint signal)
{
@@ -632,7 +634,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
HANDLE hProc;
pProcInfo_t pCurProcInfo = findProcInfo(uid);
#ifdef DEBUG_MONITOR
- _TCHAR buffer[100];
+ wchar_t buffer[100];
#endif
if(NULL == pCurProcInfo) {
@@ -643,7 +645,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
}
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Spawner received signal %i for process %i\n"), signal, pCurProcInfo -> pid);
+ swprintf(buffer, _T("Spawner received signal %i for process %i\n"), signal, pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
@@ -665,7 +667,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
case SIG_KILL:
case SIG_TERM:
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Spawner received KILL or TERM signal for process %i\n"),
+ swprintf(buffer, _T("Spawner received KILL or TERM signal for process %i\n"),
pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
@@ -697,10 +699,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
// Arguments: (see Spawner.java)
// [in] uid - unique process ID
/////////////////////////////////////////////////////////////////////////////////////
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
(JNIEnv * env, jobject process, jint uid)
{
- long exit_code;
+ DWORD exit_code;
int what=0;
HANDLE hProc;
pProcInfo_t pCurProcInfo = findProcInfo(uid);
@@ -740,16 +743,15 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
// [in] name - name of exception class
// [in] message to assign thi event
/////////////////////////////////////////////////////////////////////////////////////
-JNIEXPORT void JNICALL
-ThrowByName(JNIEnv *env, const char *name, const char *msg)
+void ThrowByName(JNIEnv *env, const char *name, const char *msg)
{
- jclass cls = (*env)->FindClass(env, name);
+ jclass cls = env->FindClass(name);
if (cls != 0) /* Otherwise an exception has already been thrown */
- (*env)->ThrowNew(env, cls, msg);
+ env->ThrowNew(cls, msg);
/* It's a good practice to clean up the local references. */
- (*env)->DeleteLocalRef(env, cls);
+ env->DeleteLocalRef(cls);
}
@@ -769,7 +771,7 @@ pProcInfo_t createProcInfo()
if(NULL == pInfo)
{
- pInfo = malloc(sizeof(procInfo_t) * MAX_PROCS);
+ pInfo = (pProcInfo_t)malloc(sizeof(procInfo_t) * MAX_PROCS);
ZeroMemory(pInfo, sizeof(procInfo_t) * MAX_PROCS);
}
@@ -850,7 +852,7 @@ unsigned int _stdcall waitProcTermination(void* pv)
int i;
int pid = (int)pv;
#ifdef DEBUG_MONITOR
- _TCHAR buffer[1000];
+ wchar_t buffer[1000];
#endif
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
@@ -858,7 +860,7 @@ unsigned int _stdcall waitProcTermination(void* pv)
if(NULL == hProc)
{
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("waitProcTermination: cannot get handler for PID %i (error %i)\n"),
+ swprintf(buffer, _T("waitProcTermination: cannot get handler for PID %i (error %i)\n"),
pid,
GetLastError());
OutputDebugStringW(buffer);
@@ -868,7 +870,7 @@ unsigned int _stdcall waitProcTermination(void* pv)
{
WaitForSingleObject(hProc, INFINITE);
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Process PID %i terminated\n"), pid);
+ swprintf(buffer, _T("Process PID %i terminated\n"), pid);
OutputDebugStringW(buffer);
#endif
}
@@ -880,7 +882,7 @@ unsigned int _stdcall waitProcTermination(void* pv)
if(WaitForSingleObject(pInfo[i].eventWait, 1) == WAIT_OBJECT_0) // Correct finish
{
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("waitProcTermination: set PID %i to 0\n"),
+ swprintf(buffer, _T("waitProcTermination: set PID %i to 0\n"),
pid,
GetLastError());
OutputDebugStringW(buffer);
@@ -906,7 +908,7 @@ unsigned int _stdcall waitProcTermination(void* pv)
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
-int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace)
+int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpace)
{
BOOL bSlash = FALSE;
int i = 0, j = 0;
@@ -928,7 +930,7 @@ int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace
nQuotationMode = QUOTATION_DONE;
}
else
- if(_tcschr(source, _T(' ')) == NULL)
+ if(wcschr(source, _T(' ')) == NULL)
{
// No reason to quotate term becase it doesn't have embedded spaces
nQuotationMode = QUOTATION_NONE;
@@ -977,4 +979,3 @@ int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace
return j;
}
-
diff --git a/core/org.eclipse.cdt.core.win32/library/iostream.c b/core/org.eclipse.cdt.core.win32/library/iostream.c
index 183d26269f..e323776272 100644
--- a/core/org.eclipse.cdt.core.win32/library/iostream.c
+++ b/core/org.eclipse.cdt.core.win32/library/iostream.c
@@ -25,7 +25,7 @@
//#define READ_REPORT
-JNIEXPORT void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg);
+void ThrowByName(JNIEnv *env, const char *name, const char *msg);
#define BUFF_SIZE (1024)
@@ -35,10 +35,11 @@ JNIEXPORT void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *ms
* Method: read0
* Signature: (I)I
*/
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
(JNIEnv * env, jobject proc, jint fd, jbyteArray buf, jint len)
{
- BYTE tmpBuf[BUFF_SIZE];
+ jbyte tmpBuf[BUFF_SIZE];
int nBuffOffset = 0;
#ifdef DEBUG_MONITOR
_TCHAR buffer[1000];
@@ -60,7 +61,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (char *) &lpMsgBuf,
+ (wchar_t *) &lpMsgBuf,
0,
NULL
);
@@ -114,7 +115,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (char *) &lpMsgBuf,
+ (wchar_t *) &lpMsgBuf,
0,
NULL
);
@@ -127,7 +128,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
}
}
if(nNumberOfBytesRead > 0)
- (*env) -> SetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesRead, tmpBuf);
+ env->SetByteArrayRegion(buf, nBuffOffset, nNumberOfBytesRead, tmpBuf);
else
break;
nBuffOffset += nNumberOfBytesRead;
@@ -150,6 +151,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
* Method: close0
* Signature: (I)I
*/
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
(JNIEnv * env, jobject proc, jint fd)
{
@@ -168,10 +170,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_clo
return (rc ? GetLastError() : 0);
}
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0
(JNIEnv * env, jobject proc, jint fd)
{
- int nAvail = 0;
+ DWORD nAvail = 0;
if (0 == PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nAvail, NULL)) {
// error
@@ -185,10 +188,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_ava
* Method: write0
* Signature: (I[BI)I
*/
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
(JNIEnv * env, jobject proc, jint fd, jbyteArray buf, jint len)
{
- BYTE tmpBuf[BUFF_SIZE];
+ jbyte tmpBuf[BUFF_SIZE];
int nBuffOffset = 0;
@@ -196,7 +200,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
{
DWORD nNumberOfBytesToWrite = min(len - nBuffOffset, BUFF_SIZE);
DWORD nNumberOfBytesWritten;
- (*env) -> GetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesToWrite, tmpBuf);
+ env->GetByteArrayRegion(buf, nBuffOffset, nNumberOfBytesToWrite, tmpBuf);
if(0 == WriteFile((HANDLE)fd, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL))
{
char * lpMsgBuf;
@@ -207,7 +211,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (char *) &lpMsgBuf,
+ (wchar_t *) &lpMsgBuf,
0,
NULL
);
@@ -226,6 +230,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
* Method: close0
* Signature: (I)I
*/
+extern "C"
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
(JNIEnv * env, jobject proc, jint fd)
{
diff --git a/core/org.eclipse.cdt.core.win32/library/raise.c b/core/org.eclipse.cdt.core.win32/library/raise.c
index b49437fb30..62abd4c2c3 100644
--- a/core/org.eclipse.cdt.core.win32/library/raise.c
+++ b/core/org.eclipse.cdt.core.win32/library/raise.c
@@ -41,10 +41,10 @@ find_child_console (HWND hwnd, LPARAM arg)
thread_id = GetWindowThreadProcessId (hwnd, &process_id);
if (process_id == pid)
{
- char window_class[32];
+ wchar_t window_class[32];
GetClassName (hwnd, window_class, sizeof (window_class));
- if (strcmp (window_class, "ConsoleWindowClass") == 0)
+ if (wcscmp (window_class, L"ConsoleWindowClass") == 0)
{
consoleHWND = hwnd;
return FALSE;
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.c b/core/org.eclipse.cdt.core.win32/library/spawner.c
index 47baf4d1c1..53b99eb1a3 100644
--- a/core/org.eclipse.cdt.core.win32/library/spawner.c
+++ b/core/org.eclipse.cdt.core.win32/library/spawner.c
@@ -20,10 +20,10 @@
CRITICAL_SECTION cs;
-_TCHAR path[MAX_PATH + 1] = {_T('\0') }; // Directory where spawner.dll is located
+wchar_t path[MAX_PATH + 1] = {_T('\0') }; // Directory where spawner.dll is located
-
-BOOL APIENTRY DllMain( HANDLE hModule,
+extern "C"
+BOOL APIENTRY DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
@@ -32,14 +32,14 @@ BOOL APIENTRY DllMain( HANDLE hModule,
{
case DLL_PROCESS_ATTACH:
{
- _TCHAR * p;
+ wchar_t * p;
InitializeCriticalSection(&cs);
GetModuleFileNameW(hModule, path, MAX_PATH);
- p = _tcsrchr(path, _T('\\'));
+ p = wcsrchr(path, _T('\\'));
if(NULL != p)
*(p + 1) = _T('\0');
else
- _tcscat(path, L"\\");
+ wcscat(path, L"\\");
}
break;
case DLL_THREAD_ATTACH:
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.dep b/core/org.eclipse.cdt.core.win32/library/spawner.dep
deleted file mode 100644
index 97f1d543d9..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/spawner.dep
+++ /dev/null
@@ -1,18 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by spawner.mak
-
-.\iostream.c : \
- "$(JAVA_HOME)\include\jni.h"\
- "$(JAVA_HOME)\include\win32\jni_md.h"\
- ".\SpawnerInputStream.h"\
- ".\SpawnerOutputStream.h"\
-
-
-.\StdAfx.c : \
- ".\StdAfx.h"\
-
-
-.\Win32ProcessEx.c : \
- "$(JAVA_HOME)\include\jni.h"\
- "$(JAVA_HOME)\include\win32\jni_md.h"\
- ".\Spawner.h"\
-
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.dsp b/core/org.eclipse.cdt.core.win32/library/spawner.dsp
deleted file mode 100644
index 51657d6d04..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/spawner.dsp
+++ /dev/null
@@ -1,181 +0,0 @@
-# Microsoft Developer Studio Project File - Name="spawner" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=spawner - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "spawner.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "spawner.mak" CFG="spawner - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "spawner - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "spawner - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "spawner - Win32 Release"
-# Name "spawner - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\iostream.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-# ADD CPP /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /FAcs
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\raise.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\spawner.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-# ADD CPP /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32"
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-# ADD CPP /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /Yc"stdafx.h"
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-# ADD CPP /Yc"stdafx.h"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\Win32ProcessEx.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-# ADD CPP /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /FAcs
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\Spawner.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SpawnerInputStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SpawnerOutputStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.dsw b/core/org.eclipse.cdt.core.win32/library/spawner.dsw
deleted file mode 100644
index 2e6aa59612..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/spawner.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "spawner"=.\spawner.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.mak b/core/org.eclipse.cdt.core.win32/library/spawner.mak
deleted file mode 100644
index 585baf6462..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/spawner.mak
+++ /dev/null
@@ -1,301 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on spawner.dsp
-!IF "$(CFG)" == ""
-CFG=spawner - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to spawner - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "spawner - Win32 Release" && "$(CFG)" != "spawner - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "spawner.mak" CFG="spawner - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "spawner - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "spawner - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\spawner.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\iostream.obj"
- -@erase "$(INTDIR)\raise.obj"
- -@erase "$(INTDIR)\spawner.obj"
- -@erase "$(INTDIR)\spawner.pch"
- -@erase "$(INTDIR)\StdAfx.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\Win32ProcessEx.obj"
- -@erase "$(OUTDIR)\spawner.dll"
- -@erase "$(OUTDIR)\spawner.exp"
- -@erase "$(OUTDIR)\spawner.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\spawner.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\spawner.pdb" /machine:I386 /out:"$(OUTDIR)\spawner.dll" /implib:"$(OUTDIR)\spawner.lib"
-LINK32_OBJS= \
- "$(INTDIR)\iostream.obj" \
- "$(INTDIR)\raise.obj" \
- "$(INTDIR)\spawner.obj" \
- "$(INTDIR)\StdAfx.obj" \
- "$(INTDIR)\Win32ProcessEx.obj"
-
-"$(OUTDIR)\spawner.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\spawner.dll" "$(OUTDIR)\spawner.bsc"
-
-
-CLEAN :
- -@erase "$(INTDIR)\iostream.obj"
- -@erase "$(INTDIR)\iostream.sbr"
- -@erase "$(INTDIR)\raise.obj"
- -@erase "$(INTDIR)\raise.sbr"
- -@erase "$(INTDIR)\spawner.obj"
- -@erase "$(INTDIR)\spawner.pch"
- -@erase "$(INTDIR)\spawner.sbr"
- -@erase "$(INTDIR)\StdAfx.obj"
- -@erase "$(INTDIR)\StdAfx.sbr"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(INTDIR)\Win32ProcessEx.obj"
- -@erase "$(INTDIR)\Win32ProcessEx.sbr"
- -@erase "$(OUTDIR)\spawner.bsc"
- -@erase "$(OUTDIR)\spawner.dll"
- -@erase "$(OUTDIR)\spawner.exp"
- -@erase "$(OUTDIR)\spawner.ilk"
- -@erase "$(OUTDIR)\spawner.lib"
- -@erase "$(OUTDIR)\spawner.map"
- -@erase "$(OUTDIR)\spawner.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\spawner.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\iostream.sbr" \
- "$(INTDIR)\raise.sbr" \
- "$(INTDIR)\spawner.sbr" \
- "$(INTDIR)\StdAfx.sbr" \
- "$(INTDIR)\Win32ProcessEx.sbr"
-
-"$(OUTDIR)\spawner.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\spawner.pdb" /map:"$(INTDIR)\spawner.map" /debug /machine:I386 /out:"$(OUTDIR)\spawner.dll" /implib:"$(OUTDIR)\spawner.lib" /pdbtype:sept
-LINK32_OBJS= \
- "$(INTDIR)\iostream.obj" \
- "$(INTDIR)\raise.obj" \
- "$(INTDIR)\spawner.obj" \
- "$(INTDIR)\StdAfx.obj" \
- "$(INTDIR)\Win32ProcessEx.obj"
-
-"$(OUTDIR)\spawner.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("spawner.dep")
-!INCLUDE "spawner.dep"
-!ELSE
-!MESSAGE Warning: cannot find "spawner.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "spawner - Win32 Release" || "$(CFG)" == "spawner - Win32 Debug"
-SOURCE=.\iostream.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-CPP_SWITCHES=/nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FAcs /Fa"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\iostream.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-CPP_SWITCHES=/nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-
-"$(INTDIR)\iostream.obj" "$(INTDIR)\iostream.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-SOURCE=.\raise.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-
-"$(INTDIR)\raise.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
-
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-
-"$(INTDIR)\raise.obj" "$(INTDIR)\raise.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
-
-
-!ENDIF
-
-SOURCE=.\spawner.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-CPP_SWITCHES=/nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\spawner.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-CPP_SWITCHES=/nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-
-"$(INTDIR)\spawner.obj" "$(INTDIR)\spawner.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-SOURCE=.\StdAfx.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-CPP_SWITCHES=/nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /Fp"$(INTDIR)\spawner.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\StdAfx.obj" "$(INTDIR)\spawner.pch" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-CPP_SWITCHES=/nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-
-"$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" "$(INTDIR)\spawner.pch" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-SOURCE=.\Win32ProcessEx.c
-
-!IF "$(CFG)" == "spawner - Win32 Release"
-
-CPP_SWITCHES=/nologo /Gz /MT /W3 /GX /O2 /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /I "E:\Java\jdk1.3.1\include" /I "E:\Java\jdk1.3.1\include\Win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FA /Fa"$(INTDIR)\Win32ProcessEx.asm-only" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\Win32ProcessEx.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "spawner - Win32 Debug"
-
-CPP_SWITCHES=/nologo /Gz /MD /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\Win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "_USRDLL" /D "SPAWNER_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\spawner.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
-
-"$(INTDIR)\Win32ProcessEx.obj" "$(INTDIR)\Win32ProcessEx.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\spawner.pch"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/core/org.eclipse.cdt.core.win32/library/starter/Makefile b/core/org.eclipse.cdt.core.win32/library/starter/Makefile
new file mode 100644
index 0000000000..363da73242
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/starter/Makefile
@@ -0,0 +1,23 @@
+OS = win32
+ARCH = x86
+
+TARGET = $(INSTALL_DIR)/starter.exe
+
+OBJS = starter.o
+
+LIBS = -lpsapi
+
+CXX = g++
+CXXFLAGS = -DUNICODE
+
+INSTALL_DIR = ../../os/$(OS)/$(ARCH)
+
+all: $(TARGET)
+
+rebuild: clean all
+
+clean :
+ $(RM) $(OBJS)
+
+$(TARGET) : $(OBJS)
+ $(CXX) -o $(TARGET) $(OBJS) $(LIBS)
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 3a0fa472bf..a59c661031 100644
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp
@@ -14,93 +14,153 @@
* This is a small utility for windows spawner
*******************************************************************************/
-
-
#define STRICT
#include <Windows.h>
#include <process.h>
#include <tchar.h>
#include <stdio.h>
+#include <psapi.h>
//#define DEBUG_MONITOR
#define MAX_CMD_LINE_LENGTH (2049)
#define PIPE_NAME_LENGTH 100
-int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace);
+int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
+ int availSpace);
void DisplayErrorMessage();
//BOOL KillProcessEx(DWORD dwProcessId); // Handle of the process
///////////////////////////////////////////////////////////////////////////////
-BOOL WINAPI HandlerRoutine( DWORD dwCtrlType) // control signal type
+BOOL WINAPI HandlerRoutine( DWORD dwCtrlType) // control signal type
{
BOOL ret = TRUE;
switch(dwCtrlType)
{
case CTRL_C_EVENT:
- break;
+ break;
case CTRL_BREAK_EVENT:
- break;
+ break;
case CTRL_CLOSE_EVENT:
- ret = FALSE;
- break;
+ ret = FALSE;
+ break;
case CTRL_LOGOFF_EVENT:
- ret = FALSE;
- break;
+ ret = FALSE;
+ break;
case CTRL_SHUTDOWN_EVENT:
- ret = FALSE;
- break;
+ ret = FALSE;
+ break;
default:
- break;
+ break;
}
return ret;
}
-void ensureSize(_TCHAR** ptr, int* psize, int requiredLength)
-{
+// The default here means we haven't checked yet
+// i.e. cygwin is true but the bin dir hasn't been captured
+wchar_t * cygwinBin = NULL;
+bool _isCygwin = true;
+
+bool isCygwin(HANDLE process) {
+ // Have we checked before?
+ if (cygwinBin != NULL || !_isCygwin)
+ return _isCygwin;
+
+ // See if this process loaded cygwin, need a different SIGINT for them
+ HMODULE mods[1024];
+ DWORD needed;
+ if (EnumProcessModules(process, mods, sizeof(mods), &needed)) {
+ int i;
+ needed /= sizeof(HMODULE);
+ for (i = 0; i < needed; ++i ) {
+ wchar_t modName[MAX_PATH];
+ if (GetModuleFileNameEx(process, mods[i], modName, MAX_PATH)) {
+ wchar_t * p = wcsrchr(modName, L'\\');
+ if (p) {
+ *p = 0; // Null terminate there for future reference
+ if (!wcscmp(++p, L"cygwin1.dll")) {
+ _isCygwin = true;
+ // Store away the bind dir
+ cygwinBin = wcsdup(modName);
+ return _isCygwin;
+ }
+ }
+ }
+ }
+ }
+
+ _isCygwin = false;
+ return _isCygwin;
+}
+
+bool runCygwinCommand(wchar_t * command) {
+ wchar_t cygcmd[1024];
+ swprintf(cygcmd, L"%s\\%s", cygwinBin, command);
+
+ STARTUPINFO si;
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+ PROCESS_INFORMATION pi;
+ ZeroMemory(&pi, sizeof(pi));
+ if (CreateProcess(NULL, cygcmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
+ return true;
+ } else if (CreateProcess(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
+ return true;
+ }
+ return false;
+}
+
+void ensureSize(wchar_t** ptr, int* psize, int requiredLength) {
int size= *psize;
- if (requiredLength > size) {
- size= 2*size;
- if (size < requiredLength) {
- size= requiredLength;
- }
- *ptr= (_TCHAR *)realloc(*ptr, size * sizeof(_TCHAR));
- if (NULL == *ptr) {
- *psize= 0;
- }
- else {
- *psize= size;
- }
- }
+ if (requiredLength > size) {
+ size= 2*size;
+ if (size < requiredLength) {
+ size= requiredLength;
+ }
+ *ptr= (wchar_t *)realloc(*ptr, size * sizeof(wchar_t));
+ if (NULL == *ptr) {
+ *psize= 0;
+ } else {
+ *psize= size;
+ }
+ }
}
+int main() {
-extern "C" int _tmain(int argc, _TCHAR * argv[]) {
+ int argc;
+ wchar_t ** argv = CommandLineToArgvW(GetCommandLine(), &argc);
// Make sure that we've been passed the right number of arguments
- if (argc < 7) {
- _tprintf(_T("Usage: %s (Three InheritableEventHandles) (CommandLineToSpawn)\n"),
- argv[0]);
- return(0);
- }
-
- // Construct the full command line
- int nCmdLineLength= MAX_CMD_LINE_LENGTH;
- _TCHAR * szCmdLine= (_TCHAR *)malloc(nCmdLineLength * sizeof(_TCHAR));
- szCmdLine[0]= 0;
- int nPos = 0;
-
- for(int i = 6; i < argc; ++i)
- {
+ if (argc < 7) {
+ _tprintf(_T("Usage: %s (Three InheritableEventHandles) (CommandLineToSpawn)\n"),
+ argv[0]);
+ return(0);
+ }
+
+ // Construct the full command line
+ int nCmdLineLength= MAX_CMD_LINE_LENGTH;
+ wchar_t * szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
+ szCmdLine[0]= 0;
+ int nPos = 0;
+
+ for(int i = 6; i < argc; ++i)
+ {
int nCpyLen;
- int len= _tcslen(argv[i]);
+ int len= wcslen(argv[i]);
int requiredSize= nPos+len+2;
if (requiredSize > 32*1024) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Command line too long!\n"));
#endif
return 0;
- }
+ }
ensureSize(&szCmdLine, &nCmdLineLength, requiredSize);
if (NULL == szCmdLine) {
#ifdef DEBUG_MONITOR
@@ -109,100 +169,97 @@ extern "C" int _tmain(int argc, _TCHAR * argv[]) {
return 0;
}
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, argv[i], len, nCmdLineLength - nPos)))
- {
+ {
#ifdef DEBUG_MONITOR
- OutputDebugStringW(_T("Not enough space to build command line\n"));
+ OutputDebugStringW(_T("Not enough space to build command line\n"));
#endif
- return 0;
+ return 0;
}
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
- }
- szCmdLine[nPos] = _T('\0');
+ }
+ szCmdLine[nPos] = _T('\0');
- STARTUPINFOW si = { sizeof(si) };
- PROCESS_INFORMATION pi = { 0 };
- DWORD dwExitCode = 0;
+ STARTUPINFOW si = {sizeof(si)};
+ PROCESS_INFORMATION pi = {0};
+ DWORD dwExitCode = 0;
#ifdef DEBUG_MONITOR
- int currentPID = GetCurrentProcessId();
- _TCHAR buffer[MAX_CMD_LINE_LENGTH];
+ int currentPID = GetCurrentProcessId();
+ wchar_t buffer[MAX_CMD_LINE_LENGTH];
#endif
-
- BOOL exitProc = FALSE;
- HANDLE waitEvent = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[4]);
- HANDLE h[3];
- h[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]);
- h[2] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[5]); // This is a terminate event
- SetConsoleCtrlHandler(HandlerRoutine, TRUE);
-
-
- int parentPid = _tcstol(argv[1], NULL, 10);
- int nCounter = _tcstol(argv[2], NULL, 10);
- _TCHAR inPipeName[PIPE_NAME_LENGTH];
- _TCHAR outPipeName[PIPE_NAME_LENGTH];
- _TCHAR errPipeName[PIPE_NAME_LENGTH];
-
- _stprintf(inPipeName, _T("\\\\.\\pipe\\stdin%08i%010i"), parentPid, nCounter);
- _stprintf(outPipeName, _T("\\\\.\\pipe\\stdout%08i%010i"), parentPid, nCounter);
- _stprintf(errPipeName, _T("\\\\.\\pipe\\stderr%08i%010i"), parentPid, nCounter);
+
+ BOOL exitProc = FALSE;
+ HANDLE waitEvent = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[4]);
+ HANDLE h[3];
+ h[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]);
+ h[2] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[5]); // This is a terminate event
+ SetConsoleCtrlHandler(HandlerRoutine, TRUE);
+
+ int parentPid = wcstol(argv[1], NULL, 10);
+ int nCounter = wcstol(argv[2], NULL, 10);
+ wchar_t inPipeName[PIPE_NAME_LENGTH];
+ wchar_t outPipeName[PIPE_NAME_LENGTH];
+ wchar_t errPipeName[PIPE_NAME_LENGTH];
+
+ swprintf(inPipeName, L"\\\\.\\pipe\\stdin%08i%010i", parentPid, nCounter);
+ swprintf(outPipeName, L"\\\\.\\pipe\\stdout%08i%010i", parentPid, nCounter);
+ swprintf(errPipeName, L"\\\\.\\pipe\\stderr%08i%010i", parentPid, nCounter);
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
+ swprintf(buffer, _T("Pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
OutputDebugStringW(buffer);
#endif
-
- HANDLE stdHandles[3];
-
- SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.bInheritHandle = TRUE;
- sa.lpSecurityDescriptor = NULL;
-
- if((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))))
- {
+
+ HANDLE stdHandles[3];
+
+ SECURITY_ATTRIBUTES sa;
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.bInheritHandle = TRUE;
+ sa.lpSecurityDescriptor = NULL;
+
+ if((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa))) ||
+ (INVALID_HANDLE_VALUE == (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))) ||
+ (INVALID_HANDLE_VALUE == (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))))
+ {
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Failed to open pipe %i, %i, %i: %i\n"), stdHandles[0], stdHandles[1], stdHandles[2], GetLastError());
- OutputDebugStringW(buffer);
+ swprintf(buffer, _T("Failed to open pipe %i, %i, %i: %i\n"), stdHandles[0], stdHandles[1], stdHandles[2], GetLastError());
+ OutputDebugStringW(buffer);
#endif
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
CloseHandle(stdHandles[2]);
return -1;;
- }
- SetHandleInformation(stdHandles[0], HANDLE_FLAG_INHERIT, TRUE);
- SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, TRUE);
- SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, TRUE);
+ }
+ SetHandleInformation(stdHandles[0], HANDLE_FLAG_INHERIT, TRUE);
+ SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, TRUE);
+ SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, TRUE);
- if(!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) ||
- !SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1]) ||
- !SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
+ if(!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) ||
+ !SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1]) ||
+ !SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Failed to reassign standard streams: %i\n"), GetLastError());
- OutputDebugStringW(buffer);
+ swprintf(buffer, _T("Failed to reassign standard streams: %i\n"), GetLastError());
+ OutputDebugStringW(buffer);
#endif
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
CloseHandle(stdHandles[2]);
return -1;;
- }
-
+ }
-
#ifdef DEBUG_MONITOR
- _TCHAR * lpvEnv = GetEnvironmentStringsW();
+ wchar_t * lpvEnv = GetEnvironmentStringsW();
// If the returned pointer is NULL, exit.
if (lpvEnv == NULL)
- OutputDebugStringW(_T("Cannot Read Environment\n"));
+ 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);
+ for (wchar_t * lpszVariable = (wchar_t *) lpvEnv; *lpszVariable; lpszVariable+=wcslen(lpszVariable) + 1) {
+ swprintf(buffer, _T("%s\n"), lpszVariable);
OutputDebugStringW(buffer);
}
@@ -210,86 +267,111 @@ extern "C" int _tmain(int argc, _TCHAR * argv[]) {
}
#endif
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Starting: %s\n"), szCmdLine);
+ swprintf(buffer, _T("Starting: %s\n"), szCmdLine);
OutputDebugStringW(buffer);
#endif
// Create job object if it is possible
- HMODULE hKernel = GetModuleHandle("kernel32.dll");
+ HMODULE hKernel = GetModuleHandle(L"kernel32.dll");
HANDLE hJob = NULL;
- HANDLE (WINAPI * pCreateJobObject)(LPSECURITY_ATTRIBUTES lpJobAttributes,
- char * lpName);
+ HANDLE (WINAPI * pCreateJobObject)(LPSECURITY_ATTRIBUTES lpJobAttributes,
+ char * lpName);
*(FARPROC *)&pCreateJobObject =
- GetProcAddress(hKernel, "CreateJobObjectA");
+ GetProcAddress(hKernel, "CreateJobObjectA");
if(NULL != pCreateJobObject)
- hJob = pCreateJobObject(NULL, NULL);
- // Spawn the other processes as part of this Process Group
- BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
- 0, NULL, NULL, &si, &pi);
- // We don't need them any more
- CloseHandle(stdHandles[0]);
- CloseHandle(stdHandles[1]);
- CloseHandle(stdHandles[2]);
- if (f) {
+ hJob = pCreateJobObject(NULL, NULL);
+ // Spawn the other processes as part of this Process Group
+ BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
+ 0, NULL, NULL, &si, &pi);
+ // We don't need them any more
+ CloseHandle(stdHandles[0]);
+ CloseHandle(stdHandles[1]);
+ CloseHandle(stdHandles[2]);
+ if (f) {
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Process %i started\n"), pi.dwProcessId);
- OutputDebugStringW(buffer);
+ swprintf(buffer, _T("Process %i started\n"), pi.dwProcessId);
+ OutputDebugStringW(buffer);
#endif
- SetEvent(waitEvent); // Means thar process has been spawned
- CloseHandle(pi.hThread);
- h[1] = pi.hProcess;
+ SetEvent(waitEvent); // Means thar process has been spawned
+ CloseHandle(pi.hThread);
+ h[1] = pi.hProcess;
- if(NULL != hJob) {
- HANDLE (WINAPI * pAssignProcessToJobObject)(HANDLE job, HANDLE process);
- *(FARPROC *)&pAssignProcessToJobObject =
+ if(NULL != hJob) {
+ HANDLE (WINAPI * pAssignProcessToJobObject)(HANDLE job, HANDLE process);
+ *(FARPROC *)&pAssignProcessToJobObject =
GetProcAddress(hKernel, "AssignProcessToJobObjectA");
- if(NULL != pAssignProcessToJobObject)
+ if(NULL != pAssignProcessToJobObject)
if(!pAssignProcessToJobObject(hJob, pi.hProcess)) {
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Cannot assign process %i to a job\n"), pi.dwProcessId);
+ swprintf(buffer, _T("Cannot assign process %i to a job\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
DisplayErrorMessage();
#endif
}
- }
+ }
- while(!exitProc)
- {
- // Wait for the spawned-process to die or for the event
- // indicating that the processes should be forcibly killed.
- switch (WaitForMultipleObjects(3, h, FALSE, INFINITE))
+ while(!exitProc)
+ {
+ // Wait for the spawned-process to die or for the event
+ // indicating that the processes should be forcibly killed.
+ switch (WaitForMultipleObjects(3, h, FALSE, INFINITE))
{
- case WAIT_OBJECT_0 + 0: // Send Ctrl-C
+ case WAIT_OBJECT_0 + 0: // Send Ctrl-C
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("starter (PID %i) received CTRL-C event\n"), currentPID);
+ swprintf(buffer, _T("starter (PID %i) received CTRL-C event\n"), currentPID);
OutputDebugStringW(buffer);
#endif
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ if (isCygwin(h[1])) {
+ // Need to issue a kill command
+ wchar_t kill[1024];
+ swprintf(kill, L"kill -SIGINT %d", pi.dwProcessId);
+ if (!runCygwinCommand(kill)) {
+ // fall back to console event
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ }
+ } else {
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ }
+
SetEvent(waitEvent);
break;
- case WAIT_OBJECT_0 + 1: // App terminated normally
+ case WAIT_OBJECT_0 + 1: // App terminated normally
// Make it's exit code our exit code
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("starter: launched process has been terminated(PID %i)\n"),
- pi.dwProcessId);
+ swprintf(buffer, _T("starter: launched process has been terminated(PID %i)\n"),
+ pi.dwProcessId);
OutputDebugStringW(buffer);
#endif
GetExitCodeProcess(pi.hProcess, &dwExitCode);
exitProc = TRUE;
break;
- case WAIT_OBJECT_0 + 2: // Kill
+
+ case WAIT_OBJECT_0 + 2: // Kill
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("starter received KILL event (PID %i)\n"), currentPID);
+ swprintf(buffer, _T("starter received KILL event (PID %i)\n"), currentPID);
OutputDebugStringW(buffer);
#endif
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ if (isCygwin(h[1])) {
+ // Need to issue a kill command
+ wchar_t kill[1024];
+ swprintf(kill, L"kill -SIGTERM %d", pi.dwProcessId);
+ if (!runCygwinCommand(kill)) {
+ // fall back to console event
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ }
+ } else {
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
+ }
+
+ SetEvent(waitEvent);
+
if(NULL != hJob) {
HANDLE (WINAPI * pTerminateJobObject)(HANDLE job, UINT uExitCode);
*(FARPROC *)&pTerminateJobObject =
- GetProcAddress(hKernel, "TerminateJobObjectA");
+ GetProcAddress(hKernel, "TerminateJobObjectA");
if(NULL != pTerminateJobObject) {
- if(!pTerminateJobObject(hJob, -1)) {
+ if(!pTerminateJobObject(hJob, (DWORD)-1)) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Cannot terminate job\n"));
DisplayErrorMessage();
@@ -299,37 +381,37 @@ extern "C" int _tmain(int argc, _TCHAR * argv[]) {
} else
exitProc = TRUE;
break;
- default:
- // Unexpected code
+ default:
+ // Unexpected code
#ifdef DEBUG_MONITOR
DisplayErrorMessage();
#endif
exitProc = TRUE;
break;
- }
-
- }
- CloseHandle(pi.hProcess);
- } else {
+ }
+
+ }
+ CloseHandle(pi.hProcess);
+ } else {
#ifdef DEBUG_MONITOR
- _stprintf(buffer, _T("Cannot start: %s\n"), szCmdLine);
- OutputDebugStringW(buffer);
+ swprintf(buffer, _T("Cannot start: %s\n"), szCmdLine);
+ OutputDebugStringW(buffer);
- DisplayErrorMessage();
+ DisplayErrorMessage();
#endif
- }
-
- if (NULL != szCmdLine)
- {
- free(szCmdLine);
- }
-
- CloseHandle(waitEvent);
- CloseHandle(h[0]);
- CloseHandle(h[1]);
- CloseHandle(h[2]);
-
- return(dwExitCode);
+ }
+
+ if (NULL != szCmdLine)
+ {
+ free(szCmdLine);
+ }
+
+ CloseHandle(waitEvent);
+ CloseHandle(h[0]);
+ CloseHandle(h[1]);
+ CloseHandle(h[2]);
+
+ return(dwExitCode);
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -341,8 +423,8 @@ extern "C" int _tmain(int argc, _TCHAR * argv[]) {
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
-int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace)
-{
+int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
+ int availSpace) {
BOOL bSlash = FALSE;
int i = 0, j = 0;
int totCpyLength = cpyLength;
@@ -352,81 +434,61 @@ int copyTo(_TCHAR * target, const _TCHAR * source, int cpyLength, int availSpace
#define QUOTATION_NONE 2
int nQuotationMode = 0;
- if(availSpace <= cpyLength) // = to reserve space for '\0'
+ if (availSpace <= cpyLength) // = to reserve space for '\0'
return -1;
- if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1)))
- {
+ if ((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1))) {
// Already done
nQuotationMode = QUOTATION_DONE;
- }
- else
- if(_tcschr(source, _T(' ')) == NULL)
- {
+ } else if (wcschr(source, _T(' '))== NULL) {
// No reason to quotate term becase it doesn't have embedded spaces
nQuotationMode = QUOTATION_NONE;
- }
- else
- {
+ } else {
// Needs to be quotated
nQuotationMode = QUOTATION_DO;
*target = _T('\"');
++j;
- }
+ }
- for(; i < cpyLength; ++i, ++j)
- {
- if(source[i] == _T('\\'))
+ for (; i < cpyLength; ++i, ++j) {
+ if (source[i] == _T('\\'))
bSlash = TRUE;
else
// Don't escape embracing quotation marks
- if((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) ) )
- {
- if(!bSlash)
- {
- if(j == availSpace)
+ if ((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) )) {
+ if (!bSlash) {
+ if (j == availSpace)
return -1;
target[j] = _T('\\');
++j;
- }
- bSlash = FALSE;
}
- else
+ bSlash = FALSE;
+ } else
bSlash = FALSE;
- if(j == availSpace)
+ if (j == availSpace)
return -1;
target[j] = source[i];
- }
+ }
- if(nQuotationMode == QUOTATION_DO)
- {
- if(j == availSpace)
+ if (nQuotationMode == QUOTATION_DO) {
+ if (j == availSpace)
return -1;
target[j] = _T('\"');
++j;
- }
+ }
return j;
}
-
void DisplayErrorMessage() {
- _TCHAR * lpMsgBuf;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (_TCHAR *) &lpMsgBuf,
- 0,
- NULL
- );
+ wchar_t * lpMsgBuf;
+ FormatMessageW(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t *) &lpMsgBuf, 0, NULL);
OutputDebugStringW(lpMsgBuf);
// Free the buffer.
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
}
-
//////////////////////////////// End of File //////////////////////////////////
diff --git a/core/org.eclipse.cdt.core.win32/library/starter/starter.dep b/core/org.eclipse.cdt.core.win32/library/starter/starter.dep
deleted file mode 100644
index 3f69f7967a..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.dep
+++ /dev/null
@@ -1,5 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by starter.mak
-
-.\starter.cpp : \
- "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
-
diff --git a/core/org.eclipse.cdt.core.win32/library/starter/starter.dsp b/core/org.eclipse.cdt.core.win32/library/starter/starter.dsp
deleted file mode 100644
index c9a65e318c..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.dsp
+++ /dev/null
@@ -1,90 +0,0 @@
-# Microsoft Developer Studio Project File - Name="starter" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=starter - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "starter.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "starter.mak" CFG="starter - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "starter - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "starter - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "starter - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /FR /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "starter - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "starter - Win32 Release"
-# Name "starter - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\starter.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/core/org.eclipse.cdt.core.win32/library/starter/starter.dsw b/core/org.eclipse.cdt.core.win32/library/starter/starter.dsw
deleted file mode 100644
index 6ece142ca9..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "starter"=.\starter.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/core/org.eclipse.cdt.core.win32/library/starter/starter.mak b/core/org.eclipse.cdt.core.win32/library/starter/starter.mak
deleted file mode 100644
index dcc47aeb67..0000000000
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.mak
+++ /dev/null
@@ -1,193 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on starter.dsp
-!IF "$(CFG)" == ""
-CFG=starter - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to starter - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "starter - Win32 Release" && "$(CFG)" != "starter - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "starter.mak" CFG="starter - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "starter - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "starter - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "starter - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\starter.exe" "$(OUTDIR)\starter.bsc"
-
-
-CLEAN :
- -@erase "$(INTDIR)\killer.obj"
- -@erase "$(INTDIR)\killer.sbr"
- -@erase "$(INTDIR)\starter.obj"
- -@erase "$(INTDIR)\starter.sbr"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\starter.bsc"
- -@erase "$(OUTDIR)\starter.exe"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\starter.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\starter.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\killer.sbr" \
- "$(INTDIR)\starter.sbr"
-
-"$(OUTDIR)\starter.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\starter.pdb" /machine:I386 /out:"$(OUTDIR)\starter.exe"
-LINK32_OBJS= \
- "$(INTDIR)\killer.obj" \
- "$(INTDIR)\starter.obj"
-
-"$(OUTDIR)\starter.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "starter - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\starter.exe"
-
-
-CLEAN :
- -@erase "$(INTDIR)\killer.obj"
- -@erase "$(INTDIR)\starter.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\starter.exe"
- -@erase "$(OUTDIR)\starter.ilk"
- -@erase "$(OUTDIR)\starter.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /Fp"$(INTDIR)\starter.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\starter.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\starter.pdb" /debug /machine:I386 /out:"$(OUTDIR)\starter.exe" /pdbtype:sept
-LINK32_OBJS= \
- "$(INTDIR)\killer.obj" \
- "$(INTDIR)\starter.obj"
-
-"$(OUTDIR)\starter.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("starter.dep")
-!INCLUDE "starter.dep"
-!ELSE
-!MESSAGE Warning: cannot find "starter.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "starter - Win32 Release" || "$(CFG)" == "starter - Win32 Debug"
-SOURCE=.\killer.cpp
-
-!IF "$(CFG)" == "starter - Win32 Release"
-
-
-"$(INTDIR)\killer.obj" "$(INTDIR)\killer.sbr" : $(SOURCE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "starter - Win32 Debug"
-
-
-"$(INTDIR)\killer.obj" : $(SOURCE) "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\starter.cpp
-
-!IF "$(CFG)" == "starter - Win32 Release"
-
-
-"$(INTDIR)\starter.obj" "$(INTDIR)\starter.sbr" : $(SOURCE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "starter - Win32 Debug"
-
-
-"$(INTDIR)\starter.obj" : $(SOURCE) "$(INTDIR)"
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/Makefile b/core/org.eclipse.cdt.core.win32/library/winreg/Makefile
index be8a06fa3e..3db60b0824 100644
--- a/core/org.eclipse.cdt.core.win32/library/winreg/Makefile
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/Makefile
@@ -1,8 +1,11 @@
ifeq ($(JAVA_HOME),)
-$(warning JAVA_HOME not set in environment)
+$(error JAVA_HOME not set in environment)
endif
-# Defaults which can be overridden.
+TARGET = $(INSTALL_DIR)/winreg.dll
+
+OBJS = winreg.o
+
OS = win32
ARCH = x86
@@ -14,9 +17,6 @@ CXXFLAGS = -DUNICODE -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
INSTALL_DIR = ../../os/$(OS)/$(ARCH)
-TARGET = $(INSTALL_DIR)/winreg.dll
-OBJS = winreg.o
-
all: $(TARGET)
rebuild: clean all

Back to the top