4

I checked the definition of MiniDumpWriteDump() method on MSDN as below:

BOOL WINAPI MiniDumpWriteDump(
  __in  HANDLE hProcess,
  __in  DWORD ProcessId,
  __in  HANDLE hFile,
  __in  MINIDUMP_TYPE DumpType,
  __in  PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
  __in  PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
  __in  PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);

Parameters:

hProcess [in]

A handle to the process for which the information is to be generated.

ProcessId [in]

The identifier of the process for which the information is to be generated.

Since either a process handle or a process ID can identify a process, why do we need to pass them both? Can't we infer one of them from the other? So there should be some differences between them, what are they?

Thanks.

Martin Ba
  • 37,187
  • 33
  • 183
  • 337
smwikipedia
  • 61,609
  • 92
  • 309
  • 482

1 Answers1

0

I think it's probably just for historical reasons. Note that the GetProcessId function, which lets you get a PID from a process handle, didn't exist prior to Windows Server 2003:

http://msdn.microsoft.com/en-us/library/ms683215%28v=vs.85%29.aspx

Ted Mielczarek
  • 3,919
  • 26
  • 32
  • 1
    But this doesn't answer the question at all, or does it? *Which* (historical) reasons would require both? – Martin Ba Dec 07 '12 at 09:58