mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Add some ctypes generation + HRESULT_FACILITY macro
This commit is contained in:
@@ -2,4 +2,22 @@
|
||||
#define ERROR_SEVERITY_SUCCESS 0x00000000
|
||||
#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
|
||||
#define ERROR_SEVERITY_WARNING 0x80000000
|
||||
#define ERROR_SEVERITY_ERROR 0xC0000000
|
||||
#define ERROR_SEVERITY_ERROR 0xC0000000
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/com/structure-of-com-error-codes
|
||||
// Define the facility codes
|
||||
//
|
||||
#define FACILITY_WINDOWS 0x8
|
||||
#define FACILITY_WIN32 0x7
|
||||
#define FACILITY_STORAGE 0x3
|
||||
#define FACILITY_RPC 0x1
|
||||
#define FACILITY_NULL 0x0
|
||||
#define FACILITY_ITF 0x4
|
||||
#define FACILITY_DISPATCH 0x2
|
||||
|
||||
|
||||
//
|
||||
// Define the severity codes
|
||||
//
|
||||
#define STATUS_SEVERITY_SUCCESS 0x0
|
||||
#define STATUS_SEVERITY_COERROR 0x2
|
||||
@@ -17,3 +17,10 @@ NATIVE_WORD_MAX_VALUE = 0xffffffff if bitness == 32 else 0xffffffffffffffff
|
||||
|
||||
def CTL_CODE(DeviceType, Function, Method, Access):
|
||||
return (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
|
||||
|
||||
# https://learn.microsoft.com/en-us/windows/win32/api/winerror/nf-winerror-hresult_facility
|
||||
# Original MACRO:
|
||||
# #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
|
||||
|
||||
def HRESULT_FACILITY(hr):
|
||||
return (((hr) >> 16) & 0x1fff)
|
||||
|
||||
Reference in New Issue
Block a user