diff --git a/include/wsl/stubs/basetsd.h b/include/wsl/stubs/basetsd.h index b1e57f4..5d68389 100644 --- a/include/wsl/stubs/basetsd.h +++ b/include/wsl/stubs/basetsd.h @@ -57,10 +57,13 @@ typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR; typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR; typedef const wchar_t *LPCWSTR, *PCWSTR; +typedef signed int HRESULT; + #undef LONG_MAX #define LONG_MAX INT_MAX #undef ULONG_MAX #define ULONG_MAX UINT_MAX +#define interface struct // Misc defines #define MIDL_INTERFACE(x) interface @@ -76,8 +79,6 @@ typedef const wchar_t *LPCWSTR, *PCWSTR; #define EXTERN_C extern #endif #define APIENTRY -#define OUT -#define IN #define CONST const #define MAX_PATH 260 #define GENERIC_ALL 0x10000000L @@ -118,23 +119,25 @@ typedef struct _GUID { typedef GUID IID; typedef GUID UUID; typedef GUID CLSID; + #ifdef __cplusplus -#define REFGUID const GUID & -#define REFIID const IID & -#define REFCLSID const IID & -__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2) +typedef const GUID &REFGUID; +typedef const GUID &REFCLSID; +typedef const IID &REFIID; + +__inline int IsEqualGUID(REFGUID rguid1, REFGUID rguid2) { - return ( - ((uint32_t *)&rguid1)[0] == ((uint32_t *)&rguid2)[0] && - ((uint32_t *)&rguid1)[1] == ((uint32_t *)&rguid2)[1] && - ((uint32_t *)&rguid1)[2] == ((uint32_t *)&rguid2)[2] && - ((uint32_t *)&rguid1)[3] == ((uint32_t *)&rguid2)[3]); + // Optimization: + if (&rguid1 == &rguid2) + return true; + + return !memcmp(&rguid1, &rguid2, sizeof(GUID)); } inline bool operator==(REFGUID guidOne, REFGUID guidOther) { - return !!InlineIsEqualGUID(guidOne, guidOther); + return !!IsEqualGUID(guidOne, guidOther); } inline bool operator!=(REFGUID guidOne, REFGUID guidOther) @@ -218,7 +221,6 @@ inline bool operator!=(REFGUID guidOne, REFGUID guidOther) #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE #define WINAPI -#define interface struct #if defined (__cplusplus) && !defined (CINTERFACE) #define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method #define STDMETHOD_(type, method) virtual type STDMETHODCALLTYPE method @@ -229,6 +231,7 @@ inline bool operator!=(REFGUID guidOne, REFGUID guidOther) #define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface interface IUnknown; + extern "C++" { template void** IID_PPV_ARGS_Helper(T** pp) @@ -260,7 +263,6 @@ extern "C++" #endif // Error codes -typedef LONG HRESULT; #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) #define FAILED(hr) (((HRESULT)(hr)) < 0) #define S_OK ((HRESULT)0L) @@ -329,7 +331,7 @@ typedef struct _SECURITY_ATTRIBUTES { WINBOOL bInheritHandle; } SECURITY_ATTRIBUTES; -struct STATSTG; +typedef struct tagSTATSTG STATSTG; #ifdef __cplusplus // ENUM_FLAG_OPERATORS @@ -387,20 +389,12 @@ inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((_ #endif // D3DX12 uses these + +#ifndef LLVM_SUPPORT_WIN_ADAPTER_H #include #define HeapAlloc(heap, flags, size) malloc(size) #define HeapFree(heap, flags, ptr) free(ptr) - -#if defined(lint) -// Note: lint -e530 says don't complain about uninitialized variables for -// this variable. Error 527 has to do with unreachable code. -// -restore restores checking to the -save state -#define UNREFERENCED_PARAMETER(P) \ - /*lint -save -e527 -e530 */ \ - { \ - (P) = (P); \ - } \ - /*lint -restore */ -#else -#define UNREFERENCED_PARAMETER(P) (P) #endif + + +#define UNREFERENCED_PARAMETER(P) (void)(P) diff --git a/include/wsl/stubs/rpc.h b/include/wsl/stubs/rpc.h index 76f5b5f..a124495 100644 --- a/include/wsl/stubs/rpc.h +++ b/include/wsl/stubs/rpc.h @@ -2,4 +2,4 @@ // Licensed under the MIT License. // Stub header to satisfy d3d12.h include -#pragma once \ No newline at end of file +#pragma once