2016-09-21 03:57:24 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Józef Kucia for CodeWeavers
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VKD3D_WINDOWS_H
|
|
|
|
#define __VKD3D_WINDOWS_H
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#if !defined(_WIN32) || defined(__WIDL__)
|
|
|
|
|
|
|
|
/* HRESULT */
|
|
|
|
typedef int HRESULT;
|
2016-09-21 05:15:51 -07:00
|
|
|
# define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
|
|
|
|
# define FAILED(hr) ((HRESULT)(hr) < 0)
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 05:15:51 -07:00
|
|
|
# define _HRESULT_TYPEDEF_(x) ((HRESULT)x)
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 05:15:51 -07:00
|
|
|
# define S_OK _HRESULT_TYPEDEF_(0)
|
|
|
|
# define S_FALSE _HRESULT_TYPEDEF_(1)
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 05:15:51 -07:00
|
|
|
# define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001)
|
|
|
|
# define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002)
|
|
|
|
# define E_POINTER _HRESULT_TYPEDEF_(0x80004003)
|
|
|
|
# define E_ABORT _HRESULT_TYPEDEF_(0x80004004)
|
|
|
|
# define E_FAIL _HRESULT_TYPEDEF_(0x80004005)
|
|
|
|
# define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000E)
|
|
|
|
# define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057)
|
2016-09-21 03:57:24 -07:00
|
|
|
|
|
|
|
/* Basic types */
|
|
|
|
typedef unsigned char BYTE;
|
|
|
|
typedef unsigned int DWORD;
|
|
|
|
typedef int INT;
|
|
|
|
typedef unsigned int UINT;
|
|
|
|
typedef int LONG;
|
|
|
|
typedef unsigned int ULONG;
|
|
|
|
typedef float FLOAT;
|
|
|
|
typedef LONG BOOL;
|
|
|
|
|
2016-09-21 05:15:51 -07:00
|
|
|
/* Assuming LP64 model */
|
|
|
|
typedef char INT8;
|
2016-09-21 03:57:24 -07:00
|
|
|
typedef unsigned char UINT8;
|
2016-09-21 05:15:51 -07:00
|
|
|
typedef short INT16;
|
2016-09-21 03:57:24 -07:00
|
|
|
typedef unsigned short UINT16;
|
2016-09-21 05:15:51 -07:00
|
|
|
typedef int INT32;
|
2016-09-21 03:57:24 -07:00
|
|
|
typedef unsigned int UINT32;
|
2016-09-21 05:15:51 -07:00
|
|
|
# if defined(__x86_64__) || defined(__WIDL__)
|
2016-09-21 03:57:24 -07:00
|
|
|
typedef long INT64;
|
2016-09-21 05:15:51 -07:00
|
|
|
typedef unsigned long UINT64;
|
|
|
|
# else
|
|
|
|
typedef long long INT64;
|
|
|
|
typedef unsigned long long UINT64;
|
|
|
|
# endif
|
2016-09-21 03:57:24 -07:00
|
|
|
typedef long LONG_PTR;
|
|
|
|
typedef unsigned long ULONG_PTR;
|
|
|
|
|
|
|
|
typedef ULONG_PTR SIZE_T;
|
|
|
|
|
|
|
|
typedef unsigned short WCHAR;
|
|
|
|
typedef void *HANDLE;
|
|
|
|
|
|
|
|
/* GUID */
|
|
|
|
# ifdef __WIDL__
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned long Data1;
|
|
|
|
unsigned short Data2;
|
|
|
|
unsigned short Data3;
|
|
|
|
unsigned char Data4[8];
|
|
|
|
} GUID;
|
|
|
|
# else
|
|
|
|
typedef struct _GUID
|
|
|
|
{
|
|
|
|
unsigned int Data1;
|
|
|
|
unsigned short Data2;
|
|
|
|
unsigned short Data3;
|
|
|
|
unsigned char Data4[8];
|
|
|
|
} GUID;
|
|
|
|
# endif
|
|
|
|
|
|
|
|
typedef GUID IID;
|
|
|
|
|
|
|
|
# ifdef INITGUID
|
|
|
|
# ifndef __cplusplus
|
|
|
|
# define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
|
|
const GUID name DECLSPEC_HIDDEN; \
|
|
|
|
const GUID name = \
|
|
|
|
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 }}
|
|
|
|
# else
|
|
|
|
# define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
|
|
EXTERN_C const GUID name DECLSPEC_HIDDEN; \
|
|
|
|
EXTERN_C const GUID name = \
|
|
|
|
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 }}
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
|
|
EXTERN_C const GUID name DECLSPEC_HIDDEN;
|
|
|
|
# endif /* INITGUID */
|
|
|
|
|
|
|
|
typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
|
|
|
#endif /* !defined(_WIN32) || defined(__WIDL__) */
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
|
|
|
|
#ifndef _WIN32
|
2016-09-21 03:57:24 -07:00
|
|
|
# include <stddef.h>
|
2016-09-21 03:57:24 -07:00
|
|
|
# include <stdlib.h>
|
2016-09-21 03:57:24 -07:00
|
|
|
# include <string.h>
|
2016-09-21 03:57:24 -07:00
|
|
|
|
|
|
|
# define COM_NO_WINDOWS_H
|
|
|
|
|
|
|
|
# define FORCEINLINE inline
|
|
|
|
|
|
|
|
# define CONTAINING_RECORD(address, type, field) \
|
|
|
|
((type *)((char *)(address) - offsetof(type, field)))
|
|
|
|
|
|
|
|
# ifdef __x86_64__
|
|
|
|
# define WINAPI __attribute__((ms_abi))
|
|
|
|
# define STDMETHODCALLTYPE __attribute__((ms_abi))
|
|
|
|
# else
|
|
|
|
# define WINAPI __attribute__((__stdcall__))
|
|
|
|
# define STDMETHODCALLTYPE __attribute__((__stdcall__))
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# define DECLSPEC_SELECTANY __attribute__((weak))
|
|
|
|
# define DECLSPEC_HIDDEN __attribute__((visibility("hidden")))
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# define __C89_NAMELESS
|
|
|
|
# define __C89_NAMELESSUNIONNAME
|
|
|
|
|
|
|
|
/* Macros for COM interfaces */
|
|
|
|
# define interface struct
|
|
|
|
# define BEGIN_INTERFACE
|
|
|
|
# define END_INTERFACE
|
|
|
|
|
|
|
|
# ifdef __cplusplus
|
|
|
|
# define EXTERN_C extern "C"
|
|
|
|
# else
|
|
|
|
# define EXTERN_C extern
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# define CONST_VTBL const
|
|
|
|
|
|
|
|
# define TRUE 1
|
|
|
|
# define FALSE 0
|
|
|
|
|
|
|
|
# if defined(__cplusplus) && !defined(CINTERFACE)
|
|
|
|
# define REFIID const IID &
|
|
|
|
# define REFGUID const GUID &
|
|
|
|
# else
|
|
|
|
# define REFIID const IID * const
|
|
|
|
# define REFGUID const GUID * const
|
|
|
|
# endif
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#if defined(__cplusplus) && !defined(CINTERFACE)
|
|
|
|
# define IsEqualGUID(guid1, guid2) (!memcmp(&(guid1), &(guid2), sizeof(GUID)))
|
|
|
|
#else
|
|
|
|
# define IsEqualGUID(guid1, guid2) (!memcmp(guid1, guid2, sizeof(GUID)))
|
|
|
|
#endif
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#elif !defined(__WIDL__)
|
|
|
|
|
|
|
|
# include <windows.h>
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
# ifndef __C89_NAMELESS
|
|
|
|
# define __C89_NAMELESS
|
|
|
|
# define __C89_NAMELESSUNIONNAME
|
|
|
|
# endif /* __C89_NAMELESS */
|
|
|
|
|
|
|
|
#endif /* _WIN32 */
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#endif /* __VKD3D_WINDOWS_H */
|