smwikipedia
smwikipedia

Reputation: 64223

MiniDumpWriteDump() function's parameters: Why do we need a handle and an ID?

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.

Upvotes: 4

Views: 835

Answers (1)

Ted Mielczarek
Ted Mielczarek

Reputation: 3967

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

Upvotes: 0

Related Questions