'转换 打开的进程句柄 转换成进程ID
'主要是用在拦截别的进程读写内存API，将打开的进程，转换回来，得到进程ID
Declare Function ZwQueryInformationProcess  Lib  "Ntdll.dll" Alias "ZwQueryInformationProcess" (ByVal ProcessHandle as  UInteger ,ByVal ProcessInformationClass as UInteger, ByVal ProcessInformation as UInteger, ByVal ProcessInformationLength as UInteger, ByRef ReturnLength as UInteger) as UInteger   

Function GetPidFromHandle(ByVal hProcess as UInteger) as DWord  '转换 打开的进程句柄 转换成进程ID
   Dim Ret as UInteger, r as UInteger
   Dim p(5) as UInteger
   Ret = ZwQueryInformationProcess(hProcess, 0, @p(0), Len(r) * 6, r)
   If Ret >= 0 Then
      Function = p(4)
   End If
End Function