diff --git a/winpr/include/winpr/error.h b/winpr/include/winpr/error.h index b0b78db13..7e1c96e9e 100644 --- a/winpr/include/winpr/error.h +++ b/winpr/include/winpr/error.h @@ -42,59 +42,60 @@ #define NO_ERROR 0 #endif -#define E_UNEXPECTED 0x8000FFFFL -#define E_NOTIMPL 0x80004001L -#define E_OUTOFMEMORY 0x8007000EL -#define E_INVALIDARG 0x80070057L -#define E_NOINTERFACE 0x80004002L -#define E_POINTER 0x80004003L -#define E_HANDLE 0x80070006L -#define E_ABORT 0x80004004L -#define E_FAIL 0x80004005L -#define E_ACCESSDENIED 0x80070005L +#define E_UNEXPECTED -2147418113l // 0x8000FFFFL +#define E_ACCESSDENIED -2147024891l // 0x80070005L +#define E_HANDLE -2147024890l // 0x80070006L +#define E_OUTOFMEMORY -2147024882l // 0x8007000EL -#define CO_E_INIT_TLS 0x80004006 -#define CO_E_INIT_SHARED_ALLOCATOR 0x80004007 -#define CO_E_INIT_MEMORY_ALLOCATOR 0x80004008 -#define CO_E_INIT_CLASS_CACHE 0x80004009 -#define CO_E_INIT_RPC_CHANNEL 0x8000400A -#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL 0x8000400B -#define CO_E_INIT_TLS_CHANNEL_CONTROL 0x8000400C -#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR 0x8000400D -#define CO_E_INIT_SCM_MUTEX_EXISTS 0x8000400E -#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS 0x8000400F -#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE 0x80004010 -#define CO_E_INIT_SCM_EXEC_FAILURE 0x80004011 -#define CO_E_INIT_ONLY_SINGLE_THREADED 0x80004012 -#define CO_E_CANT_REMOTE 0x80004013 -#define CO_E_BAD_SERVER_NAME 0x80004014 -#define CO_E_WRONG_SERVER_IDENTITY 0x80004015 -#define CO_E_OLE1DDE_DISABLED 0x80004016 -#define CO_E_RUNAS_SYNTAX 0x80004017 -#define CO_E_CREATEPROCESS_FAILURE 0x80004018 -#define CO_E_RUNAS_CREATEPROCESS_FAILURE 0x80004019 -#define CO_E_RUNAS_LOGON_FAILURE 0x8000401A -#define CO_E_LAUNCH_PERMSSION_DENIED 0x8000401B -#define CO_E_START_SERVICE_FAILURE 0x8000401C -#define CO_E_REMOTE_COMMUNICATION_FAILURE 0x8000401D -#define CO_E_SERVER_START_TIMEOUT 0x8000401E -#define CO_E_CLSREG_INCONSISTENT 0x8000401F -#define CO_E_IIDREG_INCONSISTENT 0x80004020 -#define CO_E_NOT_SUPPORTED 0x80004021 -#define CO_E_RELOAD_DLL 0x80004022 -#define CO_E_MSI_ERROR 0x80004023 -#define CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT 0x80004024 -#define CO_E_SERVER_PAUSED 0x80004025 -#define CO_E_SERVER_NOT_PAUSED 0x80004026 -#define CO_E_CLASS_DISABLED 0x80004027 -#define CO_E_CLRNOTAVAILABLE 0x80004028 -#define CO_E_ASYNC_WORK_REJECTED 0x80004029 -#define CO_E_SERVER_INIT_TIMEOUT 0x8000402A -#define CO_E_NO_SECCTX_IN_ACTIVATE 0x8000402B -#define CO_E_TRACKER_CONFIG 0x80004030 -#define CO_E_THREADPOOL_CONFIG 0x80004031 -#define CO_E_SXS_CONFIG 0x80004032 -#define CO_E_MALFORMED_SPN 0x80004033 +#define E_INVALIDARG -2147024809l // 0x80070057L +#define E_NOTIMPL -2147467263l // 0x80004001L +#define E_NOINTERFACE -2147467262l // 0x80004002L +#define E_POINTER -2147467261l // 0x80004003L +#define E_ABORT -2147467260l // 0x80004004L +#define E_FAIL -2147467259l // 0x80004005L + +#define CO_E_INIT_TLS -2147467258l // 0x80004006l +#define CO_E_INIT_SHARED_ALLOCATOR -2147467257l // 0x80004007l +#define CO_E_INIT_MEMORY_ALLOCATOR -2147467256l // 0x80004008l +#define CO_E_INIT_CLASS_CACHE -2147467255l // 0x80004009l +#define CO_E_INIT_RPC_CHANNEL -2147467254l // 0x8000400Al +#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL -2147467253l // 0x8000400Bl +#define CO_E_INIT_TLS_CHANNEL_CONTROL -2147467252l // 0x8000400Cl +#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR -2147467251l // 0x8000400Dl +#define CO_E_INIT_SCM_MUTEX_EXISTS -2147467250l // 0x8000400El +#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS -2147467249l // 0x8000400Fl +#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE -2147467248l // 0x80004010l +#define CO_E_INIT_SCM_EXEC_FAILURE -2147467247l // 0x80004011l +#define CO_E_INIT_ONLY_SINGLE_THREADED -2147467246l // 0x80004012l +#define CO_E_CANT_REMOTE -2147467245l // 0x80004013l +#define CO_E_BAD_SERVER_NAME -2147467244l // 0x80004014l +#define CO_E_WRONG_SERVER_IDENTITY -2147467243l // 0x80004015l +#define CO_E_OLE1DDE_DISABLED -2147467242l // 0x80004016l +#define CO_E_RUNAS_SYNTAX -2147467241l // 0x80004017l +#define CO_E_CREATEPROCESS_FAILURE -2147467240l // 0x80004018l +#define CO_E_RUNAS_CREATEPROCESS_FAILURE -2147467239l // 0x80004019l +#define CO_E_RUNAS_LOGON_FAILURE -2147467238l // 0x8000401Al +#define CO_E_LAUNCH_PERMSSION_DENIED -2147467237l // 0x8000401Bl +#define CO_E_START_SERVICE_FAILURE -2147467236l // 0x8000401Cl +#define CO_E_REMOTE_COMMUNICATION_FAILURE -2147467235l // 0x8000401Dl +#define CO_E_SERVER_START_TIMEOUT -2147467234l // 0x8000401El +#define CO_E_CLSREG_INCONSISTENT -2147467233l // 0x8000401Fl +#define CO_E_IIDREG_INCONSISTENT -2147467232l // 0x80004020l +#define CO_E_NOT_SUPPORTED -2147467231l // 0x80004021l +#define CO_E_RELOAD_DLL -2147467230l // 0x80004022l +#define CO_E_MSI_ERROR -2147467229l // 0x80004023l +#define CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT -2147467228l // 0x80004024l +#define CO_E_SERVER_PAUSED -2147467227l // 0x80004025l +#define CO_E_SERVER_NOT_PAUSED -2147467226l // 0x80004026l +#define CO_E_CLASS_DISABLED -2147467225l // 0x80004027l +#define CO_E_CLRNOTAVAILABLE -2147467224l // 0x80004028l +#define CO_E_ASYNC_WORK_REJECTED -2147467223l // 0x80004029l +#define CO_E_SERVER_INIT_TIMEOUT -2147467222l // 0x8000402Al +#define CO_E_NO_SECCTX_IN_ACTIVATE -2147467221l // 0x8000402Bl +#define CO_E_TRACKER_CONFIG -2147467216l // 0x80004030l +#define CO_E_THREADPOOL_CONFIG -2147467215l // 0x80004031l +#define CO_E_SXS_CONFIG -2147467214l // 0x80004032l +#define CO_E_MALFORMED_SPN -2147467213l // 0x80004033l #define FACILITY_WINDOWSUPDATE 36 #define FACILITY_WINDOWS_CE 24 diff --git a/winpr/test/TestTypes.c b/winpr/test/TestTypes.c index 639e2ca5d..a7257851c 100644 --- a/winpr/test/TestTypes.c +++ b/winpr/test/TestTypes.c @@ -20,7 +20,98 @@ #include #include -BOOL TestSucceededFailedMacros(HRESULT hr, char* sym, BOOL isSuccess) +static BOOL test_co_errors(void) +{ + size_t x; + const LONG should[] = { + (LONG)0x80004006l, (LONG)0x80004007l, (LONG)0x80004008l, (LONG)0x80004009l, + (LONG)0x8000400Al, (LONG)0x8000400Bl, (LONG)0x8000400Cl, (LONG)0x8000400Dl, + (LONG)0x8000400El, (LONG)0x8000400Fl, (LONG)0x80004010l, (LONG)0x80004011l, + (LONG)0x80004012l, (LONG)0x80004013l, (LONG)0x80004014l, (LONG)0x80004015l, + (LONG)0x80004016l, (LONG)0x80004017l, (LONG)0x80004018l, (LONG)0x80004019l, + (LONG)0x8000401Al, (LONG)0x8000401Bl, (LONG)0x8000401Cl, (LONG)0x8000401Dl, + (LONG)0x8000401El, (LONG)0x8000401Fl, (LONG)0x80004020l, (LONG)0x80004021l, + (LONG)0x80004022l, (LONG)0x80004023l, (LONG)0x80004024l, (LONG)0x80004025l, + (LONG)0x80004026l, (LONG)0x80004027l, (LONG)0x80004028l, (LONG)0x80004029l, + (LONG)0x8000402Al, (LONG)0x8000402Bl, (LONG)0x80004030l, (LONG)0x80004031l, + (LONG)0x80004032l, (LONG)0x80004033l, (LONG)0x8000FFFFL, (LONG)0x80070005L, + (LONG)0x80070006L, (LONG)0x8007000EL, (LONG)0x80070057L, (LONG)0x80004001L, + (LONG)0x80004002L, (LONG)0x80004003L, (LONG)0x80004004L, (LONG)0x80004005L + }; + const LONG are[] = { CO_E_INIT_TLS, + CO_E_INIT_SHARED_ALLOCATOR, + CO_E_INIT_MEMORY_ALLOCATOR, + CO_E_INIT_CLASS_CACHE, + CO_E_INIT_RPC_CHANNEL, + CO_E_INIT_TLS_SET_CHANNEL_CONTROL, + CO_E_INIT_TLS_CHANNEL_CONTROL, + CO_E_INIT_UNACCEPTED_USER_ALLOCATOR, + CO_E_INIT_SCM_MUTEX_EXISTS, + CO_E_INIT_SCM_FILE_MAPPING_EXISTS, + CO_E_INIT_SCM_MAP_VIEW_OF_FILE, + CO_E_INIT_SCM_EXEC_FAILURE, + CO_E_INIT_ONLY_SINGLE_THREADED, + CO_E_CANT_REMOTE, + CO_E_BAD_SERVER_NAME, + CO_E_WRONG_SERVER_IDENTITY, + CO_E_OLE1DDE_DISABLED, + CO_E_RUNAS_SYNTAX, + CO_E_CREATEPROCESS_FAILURE, + CO_E_RUNAS_CREATEPROCESS_FAILURE, + CO_E_RUNAS_LOGON_FAILURE, + CO_E_LAUNCH_PERMSSION_DENIED, + CO_E_START_SERVICE_FAILURE, + CO_E_REMOTE_COMMUNICATION_FAILURE, + CO_E_SERVER_START_TIMEOUT, + CO_E_CLSREG_INCONSISTENT, + CO_E_IIDREG_INCONSISTENT, + CO_E_NOT_SUPPORTED, + CO_E_RELOAD_DLL, + CO_E_MSI_ERROR, + CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT, + CO_E_SERVER_PAUSED, + CO_E_SERVER_NOT_PAUSED, + CO_E_CLASS_DISABLED, + CO_E_CLRNOTAVAILABLE, + CO_E_ASYNC_WORK_REJECTED, + CO_E_SERVER_INIT_TIMEOUT, + CO_E_NO_SECCTX_IN_ACTIVATE, + CO_E_TRACKER_CONFIG, + CO_E_THREADPOOL_CONFIG, + CO_E_SXS_CONFIG, + CO_E_MALFORMED_SPN, + E_UNEXPECTED, + E_ACCESSDENIED, + E_HANDLE, + E_OUTOFMEMORY, + E_INVALIDARG, + E_NOTIMPL, + E_NOINTERFACE, + E_POINTER, + E_ABORT, + E_FAIL }; + + if (ARRAYSIZE(should) != ARRAYSIZE(are)) + { + const size_t a = ARRAYSIZE(should); + const size_t b = ARRAYSIZE(are); + printf("mismatch: %" PRIuz " vs %" PRIuz "\n", a, b); + return FALSE; + } + for (x = 0; x < ARRAYSIZE(are); x++) + { + const LONG a = are[x]; + const LONG b = should[x]; + if (a != b) + { + printf("mismatch[%" PRIuz "]: %0x" PRIx32 " vs %08" PRIx32 "\n", x, a, b); + return FALSE; + } + } + return TRUE; +} + +static BOOL TestSucceededFailedMacros(HRESULT hr, char* sym, BOOL isSuccess) { BOOL rv = TRUE; @@ -56,6 +147,9 @@ int TestTypes(int argc, char* argv[]) WINPR_UNUSED(argc); WINPR_UNUSED(argv); + if (!test_co_errors()) + goto err; + if (S_OK != 0L) { printf("Error: S_OK should be 0\n");