public static uint GetLastErrorEx(IntPtr hProcess) { IntPtr fnGetLastError = PInvoke.GetProcAddress(PInvoke.GetModuleHandleA("kernel32.dll"), "GetLastError"); return(RunThread(hProcess, fnGetLastError, IntPtr.Zero)); }