In my COM component, I need to translate all errors into the most appropriate values HRESULT. Currently, if I call some method of the RPC interface (I call the MIDL called stub, which in turn calls NdrClientCall2 () ), and the call does not return E_FAIL, which is not very convenient.
HRESULT
E_FAIL
There is the so-called object in HRESULT . Can i use this?
I tried to do the following:
HRESULT RpcStatusToHresult( RPC_STATUS status ) { if( status <= 0 ) { return status; } return ( status & 0x0000FFFF ) | (FACILITY_RPC << 16) | 0x80000000; }
Will this translate RPC_STATUSto meaningful HRESULTs?
RPC_STATUS
RpcStatusToHresult () MAKE_HRESULT (1, FACILITY_RPC, ). HRESULT_FROM_WIN32 () MAKE_HRESULT (1, FACILITY_WIN32, ).
, , , , , , FormatMessage(), - , .
FWIW, , HRESULT_FROM_WIN32
Source: https://habr.com/ru/post/1752235/More articles:C # linq order depending on language - c #Use Scala as if it were Java - eclipseCustomers complaining about the slow speed of my osCommerce site - performanceComplex function - assemblyWhat is the best module in perl that can implement Paros proxy functions - securityIs it possible with GIT to delete a file only from the index? - gitрегулярное выражение, которое извлекает слова из строки - javaFiles in gitignore - gitProcessing URL parameters - value pairs separated by a slash - urlAndroid Android player to play a list of songs - androidAll Articles