-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
8
While looking at all of the instances of create process, we should look into creating a job so that the instance of Java is tied to Javaws. here is an example:
STARTUPINFOW siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
HANDLE jobHandle = CreateJobObject(NULL, NULL);
if (jobHandle == NULL)
{
::MessageBox(0, TEXT("CreateJobObject Failed"), TEXT("hgMerge"), MB_OK);
}
// Configure all child processes associated with the job to terminate when the
JOBOBJECT_EXTENDED_LIMIT_INFORMATION JobInfo = { 0 };
JobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
if (SetInformationJobObject( jobHandle, JobObjectExtendedLimitInformation, &JobInfo, sizeof(JobInfo)) == 0)
{
::MessageBox(0, TEXT("SetInformationJobObject Failed"), TEXT("hgMerge"), MB_OK);
}
if (CreateProcessW(app, params, 0, 0, false, /*CREATE_DEFAULT_ERROR_MODE*/NORMAL_PRIORITY_CLASS | CREATE_BREAKAWAY_FROM_JOB, 0, 0,
&siStartupInfo, &piProcessInfo) != false)
{
if (AssignProcessToJobObject(jobHandle, piProcessInfo.hProcess) == 0)
{
}
DWORD dwExitCode = WaitForSingleObject(piProcessInfo.hProcess, INFINITE);
//TODO do something with dwExitCode
}
CloseHandle(jobHandle);
STARTUPINFOW siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
HANDLE jobHandle = CreateJobObject(NULL, NULL);
if (jobHandle == NULL)
{
::MessageBox(0, TEXT("CreateJobObject Failed"), TEXT("hgMerge"), MB_OK);
}
// Configure all child processes associated with the job to terminate when the
JOBOBJECT_EXTENDED_LIMIT_INFORMATION JobInfo = { 0 };
JobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
if (SetInformationJobObject( jobHandle, JobObjectExtendedLimitInformation, &JobInfo, sizeof(JobInfo)) == 0)
{
::MessageBox(0, TEXT("SetInformationJobObject Failed"), TEXT("hgMerge"), MB_OK);
}
if (CreateProcessW(app, params, 0, 0, false, /*CREATE_DEFAULT_ERROR_MODE*/NORMAL_PRIORITY_CLASS | CREATE_BREAKAWAY_FROM_JOB, 0, 0,
&siStartupInfo, &piProcessInfo) != false)
{
if (AssignProcessToJobObject(jobHandle, piProcessInfo.hProcess) == 0)
{
}
DWORD dwExitCode = WaitForSingleObject(piProcessInfo.hProcess, INFINITE);
//TODO do something with dwExitCode
}
CloseHandle(jobHandle);