| 360 | } |
| 361 | |
| 362 | DWORD GetParentProcessID() { |
| 363 | HANDLE hSnapshot; |
| 364 | PROCESSENTRY32 pe32; |
| 365 | DWORD ppid = 0, pid = GetCurrentProcessId(); |
| 366 | |
| 367 | hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
| 368 | if (hSnapshot == INVALID_HANDLE_VALUE) return 0; |
| 369 | |
| 370 | pe32.dwSize = sizeof(PROCESSENTRY32); |
| 371 | if (Process32First(hSnapshot, &pe32)) { |
| 372 | do { |
| 373 | if (pe32.th32ProcessID == pid) { |
| 374 | ppid = pe32.th32ParentProcessID; |
| 375 | break; |
| 376 | } |
| 377 | } while (Process32Next(hSnapshot, &pe32)); |
| 378 | } |
| 379 | |
| 380 | CloseHandle(hSnapshot); |
| 381 | return ppid; |
| 382 | } |
| 383 | |
| 384 | bool IsParentQQ() { |
| 385 | DWORD parentPID = GetParentProcessID(); |