Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2007-08-31 18:17:11 +0000
committerDoug Schaefer2007-08-31 18:17:11 +0000
commit5e002f83a23b6e1caa655ec54d1fcb5e9caeb7aa (patch)
treefc3d7ee59127bbcc2f636a884cf3fb43b409b40e /core/org.eclipse.cdt.core.win32
parentadaa921a978211e15634e5a0e03fe272b0dd9dab (diff)
downloadorg.eclipse.cdt-5e002f83a23b6e1caa655ec54d1fcb5e9caeb7aa.tar.gz
org.eclipse.cdt-5e002f83a23b6e1caa655ec54d1fcb5e9caeb7aa.tar.xz
org.eclipse.cdt-5e002f83a23b6e1caa655ec54d1fcb5e9caeb7aa.zip
Fix for 182099 - The wrong proc names were use for the Job object calls. To fix, I've gotten rid of the GetProcAddress calls and called these functions directly. Since these functions are only available on Windows 2000 and later, we have now officially dropped Windows NT4.0 and earlier.
Diffstat (limited to 'core/org.eclipse.cdt.core.win32')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/starter/starter.cpp35
-rw-r--r--core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exebin30331 -> 30051 bytes
2 files changed, 11 insertions, 24 deletions
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 7cd91cdfdae..29de0b5ced4 100644
--- a/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/starter/starter.cpp
@@ -15,7 +15,8 @@
*******************************************************************************/
#define STRICT
-#include <Windows.h>
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
#include <process.h>
#include <tchar.h>
#include <stdio.h>
@@ -270,23 +271,18 @@ int main() {
swprintf(buffer, _T("Starting: %s\n"), szCmdLine);
OutputDebugStringW(buffer);
#endif
- // Create job object if it is possible
- HMODULE hKernel = GetModuleHandle(L"kernel32.dll");
- HANDLE hJob = NULL;
- HANDLE (WINAPI * pCreateJobObject)(LPSECURITY_ATTRIBUTES lpJobAttributes,
- char * lpName);
- *(FARPROC *)&pCreateJobObject =
- GetProcAddress(hKernel, "CreateJobObjectA");
-
- if(NULL != pCreateJobObject)
- hJob = pCreateJobObject(NULL, NULL);
+ // Create job object
+ HANDLE hJob = CreateJobObject(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
swprintf(buffer, _T("Process %i started\n"), pi.dwProcessId);
@@ -297,11 +293,7 @@ int main() {
h[1] = pi.hProcess;
if(NULL != hJob) {
- HANDLE (WINAPI * pAssignProcessToJobObject)(HANDLE job, HANDLE process);
- *(FARPROC *)&pAssignProcessToJobObject =
- GetProcAddress(hKernel, "AssignProcessToJobObjectA");
- if(NULL != pAssignProcessToJobObject)
- if(!pAssignProcessToJobObject(hJob, pi.hProcess)) {
+ if(!AssignProcessToJobObject(hJob, pi.hProcess)) {
#ifdef DEBUG_MONITOR
swprintf(buffer, _T("Cannot assign process %i to a job\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
@@ -367,16 +359,11 @@ int main() {
SetEvent(waitEvent);
if(NULL != hJob) {
- HANDLE (WINAPI * pTerminateJobObject)(HANDLE job, UINT uExitCode);
- *(FARPROC *)&pTerminateJobObject =
- GetProcAddress(hKernel, "TerminateJobObjectA");
- if(NULL != pTerminateJobObject) {
- if(!pTerminateJobObject(hJob, (DWORD)-1)) {
+ if(!TerminateJobObject(hJob, (DWORD)-1)) {
#ifdef DEBUG_MONITOR
- OutputDebugStringW(_T("Cannot terminate job\n"));
- DisplayErrorMessage();
+ OutputDebugStringW(_T("Cannot terminate job\n"));
+ DisplayErrorMessage();
#endif
- }
}
} else
exitProc = TRUE;
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 1c9214dde75..be5741c82bd 100644
--- a/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe
+++ b/core/org.eclipse.cdt.core.win32/os/win32/x86/starter.exe
Binary files differ

Back to the top