mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 00:52:16 +00:00
Fix out of order function definitions.
[SVN r34211]
This commit is contained in:
@@ -897,67 +897,6 @@ check_process_exit(
|
||||
return result;
|
||||
}
|
||||
|
||||
int is_parent_child(DWORD parent, DWORD child)
|
||||
{
|
||||
HANDLE process_snapshot_h = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (parent == child)
|
||||
return 1;
|
||||
|
||||
process_snapshot_h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
|
||||
if (INVALID_HANDLE_VALUE != process_snapshot_h)
|
||||
{
|
||||
BOOL ok = TRUE;
|
||||
PROCESSENTRY32 pinfo;
|
||||
pinfo.dwSize = sizeof(PROCESSENTRY32);
|
||||
for (
|
||||
ok = Process32First(process_snapshot_h, &pinfo);
|
||||
ok == TRUE;
|
||||
ok = Process32Next(process_snapshot_h, &pinfo) )
|
||||
{
|
||||
if (pinfo.th32ProcessID == child && pinfo.th32ParentProcessID)
|
||||
return is_parent_child(parent, pinfo.th32ParentProcessID);
|
||||
}
|
||||
|
||||
CloseHandle(process_snapshot_h);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int related(HANDLE h, DWORD p)
|
||||
{
|
||||
return is_parent_child(get_process_id(h), p);
|
||||
}
|
||||
|
||||
BOOL CALLBACK window_enum(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
char buf[10] = {0};
|
||||
HANDLE h = *((HANDLE*) (lParam));
|
||||
DWORD pid = 0;
|
||||
|
||||
if (!GetClassNameA(hwnd, buf, 10))
|
||||
return TRUE; // failed to read class name
|
||||
|
||||
if (strcmp(buf, "#32770"))
|
||||
return TRUE; // not a dialog
|
||||
|
||||
GetWindowThreadProcessId(hwnd, &pid);
|
||||
if (related(h, pid))
|
||||
{
|
||||
PostMessage(hwnd, WM_QUIT, 0, 0);
|
||||
// just one window at a time
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void close_alert(HANDLE process)
|
||||
{
|
||||
EnumWindows(&window_enum, (LPARAM) &process);
|
||||
}
|
||||
|
||||
static double
|
||||
running_time(HANDLE process)
|
||||
{
|
||||
@@ -1059,6 +998,67 @@ kill_all(DWORD pid, HANDLE process)
|
||||
TerminateProcess(process,-2);
|
||||
}
|
||||
|
||||
int is_parent_child(DWORD parent, DWORD child)
|
||||
{
|
||||
HANDLE process_snapshot_h = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (parent == child)
|
||||
return 1;
|
||||
|
||||
process_snapshot_h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
|
||||
if (INVALID_HANDLE_VALUE != process_snapshot_h)
|
||||
{
|
||||
BOOL ok = TRUE;
|
||||
PROCESSENTRY32 pinfo;
|
||||
pinfo.dwSize = sizeof(PROCESSENTRY32);
|
||||
for (
|
||||
ok = Process32First(process_snapshot_h, &pinfo);
|
||||
ok == TRUE;
|
||||
ok = Process32Next(process_snapshot_h, &pinfo) )
|
||||
{
|
||||
if (pinfo.th32ProcessID == child && pinfo.th32ParentProcessID)
|
||||
return is_parent_child(parent, pinfo.th32ParentProcessID);
|
||||
}
|
||||
|
||||
CloseHandle(process_snapshot_h);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int related(HANDLE h, DWORD p)
|
||||
{
|
||||
return is_parent_child(get_process_id(h), p);
|
||||
}
|
||||
|
||||
BOOL CALLBACK window_enum(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
char buf[10] = {0};
|
||||
HANDLE h = *((HANDLE*) (lParam));
|
||||
DWORD pid = 0;
|
||||
|
||||
if (!GetClassNameA(hwnd, buf, 10))
|
||||
return TRUE; // failed to read class name
|
||||
|
||||
if (strcmp(buf, "#32770"))
|
||||
return TRUE; // not a dialog
|
||||
|
||||
GetWindowThreadProcessId(hwnd, &pid);
|
||||
if (related(h, pid))
|
||||
{
|
||||
PostMessage(hwnd, WM_QUIT, 0, 0);
|
||||
// just one window at a time
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void close_alert(HANDLE process)
|
||||
{
|
||||
EnumWindows(&window_enum, (LPARAM) &process);
|
||||
}
|
||||
|
||||
static int
|
||||
my_wait( int *status )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user