There are three different return/error/status code types I get while calling native function using P/Invoke.
The first one is the usual error code I get by calling
Marshal.GetLastWin32Errorstatic method.The second one is
HRESULTI get while calling some COM-helper functions.And the third one is
NTSTATUSI get while calling native apis from ntdll.dll library. I have a loging function that logs the return/error/status code as a hexidecimal number, then when an error is found in the logs I need to use google to find out what the actual error is.
So I'd like to ask if there is a good way to convert these return/error/status codes to string (preferably in English) to log the return/error/status string description instead of a number?
Is there a way to convert between LastError/HRESULT/NTSTATUS codes, so that the semantics of the error message would stay the same?