microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.34k stars 117 forks source link

RPC_S_ACCESS_DENIED has wrong value #1857

Closed kennykerr closed 7 months ago

kennykerr commented 8 months ago

In MSVC (default configuration) the following holds true:

#include <rpc.h>

int main()
{
    static_assert(RPC_S_ACCESS_DENIED == ERROR_ACCESS_DENIED);
}

Both ERROR_ACCESS_DENIED and RPC_S_ACCESS_DENIED are 5 because RPC_S_ACCESS_DENIED is defined as ERROR_ACCESS_DENIED in rpcnterr.h (line 41).

But the Win32 metadata seems to choose the definition from rpcnterr.h (line 540) where RPC_S_ACCESS_DENIED is defined as STATUS_ACCESS_DENIED. The difference is whether _KRPCENV_ is defined.

kennykerr commented 8 months ago

The RPC constants in Windows.Win32.Foundation are also incorrectly typed as int while the RPC constants in Windows.Win32.System.Rpc use the RPC_STATUS type. Can we get them all consolidated under the Windows.Win32.System.Rpc.RPC_STATUS enum?

mikebattista commented 8 months ago

The enum is typed as int. Should that be uint?

kennykerr commented 8 months ago

The sign bit does not appear to be used for RPC_STATUS so it behaves more like WIN32_ERROR but it is defined as long which is int so I don't have a problem with leaving it as is.