MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / getppid

Function getppid

libcppcryptfs/util/util.cpp:452–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450
451
452DWORD
453getppid(DWORD dwPid)
454{
455 HANDLE hSnapshot;
456 PROCESSENTRY32 pe32;
457 DWORD ppid = 0, pid = dwPid;
458
459 hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
460 __try{
461 if( hSnapshot == INVALID_HANDLE_VALUE ) __leave;
462
463 ZeroMemory( &pe32, sizeof( pe32 ) );
464 pe32.dwSize = sizeof( pe32 );
465 if( !Process32First( hSnapshot, &pe32 ) ) __leave;
466
467 do{
468 if( pe32.th32ProcessID == pid ){
469 ppid = pe32.th32ParentProcessID;
470 break;
471 }
472 }while( Process32Next( hSnapshot, &pe32 ) );
473
474 }
475 __finally{
476 if( hSnapshot != INVALID_HANDLE_VALUE ) CloseHandle( hSnapshot );
477 }
478 return ppid;
479}
480
481
482bool

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected