'获取父进程PID
#Include Once "Inc/NtDef.bi"
' 获取父进程PID
Function Process_Parent(pid as Integer) as Integer
   Dim hProcess as HANDLE = OpenProcess(PROCESS_QUERY_INFORMATION, False, pid)
   If hProcess Then
      Dim pbi as PROCESS_BASIC_INFORMATION_32
      If NT_SUCCESS(NtQueryInformationProcess(hProcess, ProcessBasicInformation, @pbi, SizeOf(pbi), 0)) Then
         Function = pbi.InheritedFromUniqueProcessId
      EndIf
      CloseHandle(hProcess)
   EndIf
End Function