ifndef __WTYPESBASE_INC
define __WTYPESBASE_INC

ifndef __REQUIRED_RPCNDR_H_VERSION__
define __REQUIRED_RPCNDR_H_VERSION__ 500
endif
ifndef __REQUIRED_RPCSAL_H_VERSION__
define __REQUIRED_RPCSAL_H_VERSION__ 100
endif

include rpc.inc
include rpcndr.inc

ifndef __RPCNDR_H_VERSION__
.err <this stub requires an updated version of rpcndr.inc>
endif

ifndef COM_NO_WINDOWS_H
include windows.inc
include ole2.inc
endif

ifndef __wtypesbase_h__
define __wtypesbase_h__

.pragma pack(push, size_t)

include basetsd.inc
include guiddef.inc

ifndef __IWinTypesBase_INTERFACE_DEFINED__
define __IWinTypesBase_INTERFACE_DEFINED__

if defined(_WIN32) and not defined(OLE2ANSI)
OLECHAR		typedef word
LPOLESTR	typedef ptr OLECHAR
LPCOLESTR	typedef ptr OLECHAR

OLESTR macro s
    exitm<L&s&>
    endm

else

OLECHAR		typedef sbyte
LPOLESTR	typedef ptr OLECHAR
LPCOLESTR	typedef ptr OLECHAR

OLESTR macro s
    exitm<s>
    endm

endif

ifndef _WINDEF_
ifndef _MINWINDEF_
PVOID		typedef ptr
LPVOID		typedef ptr
FLOAT		typedef REAL4
endif
endif

UCHAR		typedef BYTE
USHORT		typedef WORD
ULONG		typedef DWORD
DOUBLE		typedef REAL8

ifndef _DWORDLONG_
DWORDLONG	typedef QWORD
PDWORDLONG	typedef ptr DWORDLONG
endif

ifndef _ULONGLONG_
LONGLONG	typedef SQWORD
ULONGLONG	typedef QWORD
PLONGLONG	typedef ptr LONGLONG
PULONGLONG	typedef ptr ULONGLONG
endif

ifndef _WINBASE_

ifndef _FILETIME_
define _FILETIME_
FILETIME	STRUC
dwLowDateTime	dd ?
dwHighDateTime	dd ?
FILETIME	ENDS
PFILETIME	typedef ptr FILETIME
LPFILETIME	typedef ptr FILETIME
endif

ifndef _SYSTEMTIME_
define _SYSTEMTIME_
SYSTEMTIME	STRUC
wYear		dw ?
wMonth		dw ?
wDayOfWeek	dw ?
wDay		dw ?
wHour		dw ?
wMinute		dw ?
wSecond		dw ?
wMilliseconds	dw ?
SYSTEMTIME	ENDS
PSYSTEMTIME	typedef ptr SYSTEMTIME
LPSYSTEMTIME	typedef ptr SYSTEMTIME
endif

ifndef _SECURITY_ATTRIBUTES_
define _SECURITY_ATTRIBUTES_
SECURITY_ATTRIBUTES	STRUC
nLength			dd ?
lpSecurityDescriptor	LPVOID ?
bInheritHandle		BOOL ?
SECURITY_ATTRIBUTES	ENDS
PSECURITY_ATTRIBUTES	typedef ptr SECURITY_ATTRIBUTES
LPSECURITY_ATTRIBUTES	typedef ptr SECURITY_ATTRIBUTES
endif

ifndef SECURITY_DESCRIPTOR_REVISION
SECURITY_DESCRIPTOR_CONTROL typedef USHORT
PSECURITY_DESCRIPTOR_CONTROL typedef ptr USHORT
PSID			typedef PVOID

ACL			STRUC
AclRevision		db ?
Sbz1			db ?
AclSize			dw ?
AceCount		dw ?
Sbz2			dw ?
ACL			ENDS
PACL			typedef ptr ACL

SECURITY_DESCRIPTOR	STRUC
Revision		db ?
Sbz1			db ?
Control			SECURITY_DESCRIPTOR_CONTROL <>
Owner			PSID ?
_Group			PSID ?
Sacl			PACL ?
Dacl			PACL ?
SECURITY_DESCRIPTOR	ENDS
PISECURITY_DESCRIPTOR	typedef ptr SECURITY_DESCRIPTOR

endif
endif

COAUTHIDENTITY		STRUC
User			LPWORD ?
UserLength		ULONG ?
Domain			LPWORD ?
DomainLength		ULONG ?
Password		LPWORD ?
PasswordLength		ULONG ?
Flags			ULONG ?
COAUTHIDENTITY		ENDS
LPCOAUTHIDENTITY	typedef ptr COAUTHIDENTITY

COAUTHINFO		STRUC
dwAuthnSvc		dd ?
dwAuthzSvc		dd ?
pwszServerPrincName	LPWSTR ?
dwAuthnLevel		dd ?
dwImpersonationLevel	dd ?
pAuthIdentityData	LPCOAUTHIDENTITY ?
dwCapabilities		dd ?
COAUTHINFO		ENDS
SCODE			typedef LONG
PSCODE			typedef ptr SCODE

ifndef _HRESULT_DEFINED
define _HRESULT_DEFINED
HRESULT			typedef LONG
endif

ifndef __OBJECTID_DEFINED
define __OBJECTID_DEFINED
define _OBJECTID_DEFINED
OBJECTID		STRUC
Lineage			GUID <>
Uniquifier		ULONG ?
OBJECTID		ENDS
endif

.enum MEMCTX {
    MEMCTX_TASK	     = 1,
    MEMCTX_SHARED    = 2,
    MEMCTX_MACSYSTEM = 3,
    MEMCTX_UNKNOWN   = -1,
    MEMCTX_SAME	     = -2
    }

ifndef _ROTREGFLAGS_DEFINED
define _ROTREGFLAGS_DEFINED
define ROTREGFLAGS_ALLOWANYCLIENT 0x1
endif

ifndef _APPIDREGFLAGS_DEFINED
define _APPIDREGFLAGS_DEFINED
define APPIDREGFLAGS_ACTIVATE_IUSERVER_INDESKTOP 0x1
define APPIDREGFLAGS_SECURE_SERVER_PROCESS_SD_AND_BIND 0x2
define APPIDREGFLAGS_ISSUE_ACTIVATION_RPC_AT_IDENTIFY 0x4
define APPIDREGFLAGS_IUSERVER_UNMODIFIED_LOGON_TOKEN 0x8
define APPIDREGFLAGS_IUSERVER_SELF_SID_IN_LAUNCH_PERMISSION 0x10
define APPIDREGFLAGS_IUSERVER_ACTIVATE_IN_CLIENT_SESSION_ONLY 0x20
define APPIDREGFLAGS_RESERVED1 0x40
define APPIDREGFLAGS_RESERVED2 0x80
endif

ifndef _DCOMSCM_REMOTECALL_FLAGS_DEFINED
define _DCOMSCM_REMOTECALL_FLAGS_DEFINED
define DCOMSCM_ACTIVATION_USE_ALL_AUTHNSERVICES 0x1
define DCOMSCM_ACTIVATION_DISALLOW_UNSECURE_CALL 0x2
define DCOMSCM_RESOLVE_USE_ALL_AUTHNSERVICES 0x4
define DCOMSCM_RESOLVE_DISALLOW_UNSECURE_CALL 0x8
define DCOMSCM_PING_USE_MID_AUTHNSERVICE 0x10
define DCOMSCM_PING_DISALLOW_UNSECURE_CALL 0x20
endif

.enum CLSCTX {
    CLSCTX_INPROC_SERVER	= 0x1,
    CLSCTX_INPROC_HANDLER	= 0x2,
    CLSCTX_LOCAL_SERVER		= 0x4,
    CLSCTX_INPROC_SERVER16	= 0x8,
    CLSCTX_REMOTE_SERVER	= 0x10,
    CLSCTX_INPROC_HANDLER16	= 0x20,
    CLSCTX_RESERVED1		= 0x40,
    CLSCTX_RESERVED2		= 0x80,
    CLSCTX_RESERVED3		= 0x100,
    CLSCTX_RESERVED4		= 0x200,
    CLSCTX_NO_CODE_DOWNLOAD	= 0x400,
    CLSCTX_RESERVED5		= 0x800,
    CLSCTX_NO_CUSTOM_MARSHAL	= 0x1000,
    CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
    CLSCTX_NO_FAILURE_LOG	= 0x4000,
    CLSCTX_DISABLE_AAA		= 0x8000,
    CLSCTX_ENABLE_AAA		= 0x10000,
    CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
    CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000,
    CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000,
    CLSCTX_ENABLE_CLOAKING	= 0x100000,
    CLSCTX_APPCONTAINER		= 0x400000,
    CLSCTX_ACTIVATE_AAA_AS_IU	= 0x800000,
    CLSCTX_PS_DLL		= 0x80000000
    }

CLSCTX_VALID_MASK equ \
   (CLSCTX_INPROC_SERVER or \
    CLSCTX_INPROC_HANDLER or \
    CLSCTX_LOCAL_SERVER or \
    CLSCTX_INPROC_SERVER16 or \
    CLSCTX_REMOTE_SERVER or \
    CLSCTX_NO_CODE_DOWNLOAD or \
    CLSCTX_NO_CUSTOM_MARSHAL or \
    CLSCTX_ENABLE_CODE_DOWNLOAD or \
    CLSCTX_NO_FAILURE_LOG or \
    CLSCTX_DISABLE_AAA or \
    CLSCTX_ENABLE_AAA or \
    CLSCTX_FROM_DEFAULT_CONTEXT or \
    CLSCTX_ACTIVATE_32_BIT_SERVER or \
    CLSCTX_ACTIVATE_64_BIT_SERVER or \
    CLSCTX_ENABLE_CLOAKING or \
    CLSCTX_APPCONTAINER or \
    CLSCTX_ACTIVATE_AAA_AS_IU or \
    CLSCTX_PS_DLL)

.enum MSHLFLAGS {
	MSHLFLAGS_NORMAL	= 0,
	MSHLFLAGS_TABLESTRONG	= 1,
	MSHLFLAGS_TABLEWEAK	= 2,
	MSHLFLAGS_NOPING	= 4,
	MSHLFLAGS_RESERVED1	= 8,
	MSHLFLAGS_RESERVED2	= 16,
	MSHLFLAGS_RESERVED3	= 32,
	MSHLFLAGS_RESERVED4	= 64
	}


.enum MSHCTX {
	MSHCTX_LOCAL		= 0,
	MSHCTX_NOSHAREDMEM	= 1,
	MSHCTX_DIFFERENTMACHINE = 2,
	MSHCTX_INPROC		= 3,
	MSHCTX_CROSSCTX		= 4
	}

BYTE_BLOB		STRUC
clSize			dd ?
abData			db 1 dup(?)
BYTE_BLOB		ENDS
UP_BYTE_BLOB		typedef ptr BYTE_BLOB

WORD_BLOB		STRUC
clSize			dd ?
asData			dw 1 dup(?)
WORD_BLOB		ENDS
UP_WORD_BLOB		typedef ptr WORD_BLOB

DWORD_BLOB		STRUC
clSize			dd ?
alData			dd 1 dup(?)
DWORD_BLOB		ENDS
UP_DWORD_BLOB		typedef ptr DWORD_BLOB

FLAGGED_BYTE_BLOB	STRUC
fFlags			dd ?
clSize			dd ?
abData			db 1 dup(?)
FLAGGED_BYTE_BLOB	ENDS
UP_FLAGGED_BYTE_BLOB	typedef ptr FLAGGED_BYTE_BLOB

FLAGGED_WORD_BLOB	STRUC
fFlags			dd ?
clSize			dd ?
asData			dw 1 dup(?)
FLAGGED_WORD_BLOB	ENDS
UP_FLAGGED_WORD_BLOB	typedef ptr FLAGGED_WORD_BLOB

BYTE_SIZEDARR		STRUC
clSize			dd ?
pData			LPBYTE ?
BYTE_SIZEDARR		ENDS

WORD_SIZEDARR		STRUC
clSize			dd ?
pData			LPSHORT ?
WORD_SIZEDARR		ENDS

DWORD_SIZEDARR		STRUC
clSize			dd ?
pData			LPLONG ?
DWORD_SIZEDARR		ENDS

HYPER_SIZEDARR		STRUC
clSize			dd ?
pData			ptr hyper ?
HYPER_SIZEDARR		ENDS

endif

BOOLEAN			typedef byte

ifndef _BLOB_DEFINED
define _BLOB_DEFINED
define _LPBLOB_DEFINED
BLOB			STRUC
cbSize			ULONG ?
pBlobData		LPBYTE ?
BLOB			ENDS
LPBLOB			typedef ptr BLOB
endif

ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
define SID_IDENTIFIER_AUTHORITY_DEFINED
SID_IDENTIFIER_AUTHORITY STRUC
Value			db 6 dup(?)
SID_IDENTIFIER_AUTHORITY ENDS
PSID_IDENTIFIER_AUTHORITY typedef ptr SID_IDENTIFIER_AUTHORITY
endif

ifndef SID_DEFINED
define SID_DEFINED
SID			STRUC
Revision		db ?
SubAuthorityCount	db ?
IdentifierAuthority	SID_IDENTIFIER_AUTHORITY <>
SubAuthority		dd 1 dup(?)
SID			ENDS
PISID			typedef ptr SID

SID_AND_ATTRIBUTES	STRUC
Sid			PISID ?
Attributes		dd ?
SID_AND_ATTRIBUTES	ENDS
PSID_AND_ATTRIBUTES	typedef ptr SID_AND_ATTRIBUTES
endif

.pragma pack(pop)

endif
endif
