#endif
#undef __int64
#define __int64 long long
-#elif defined(__WATCOMC__) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
+#elif (defined(__WATCOMC__) || defined(_MSC_VER)) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
#define _HAVE_INT64
#endif /* __GNUC__/__WATCOMC */
#if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
#define C_ASSERT(e) typedef char __C_ASSERT_JOIN(__C_ASSERT__, __LINE__)[(e) ? 1 : -1]
-#ifdef __GNUC__
#include "intrin.h"
-#endif
#define NTAPI __stdcall
#include <basetsd.h>
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
#define FILE_NAMED_STREAMS 0x00040000
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define IO_COMPLETION_QUERY_STATE 0x0001
#define IO_COMPLETION_MODIFY_STATE 0x0002
#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
-#endif
/* end ntifs.h */
/* also in ddk/winddk.h */
#define MAILSLOT_NO_MESSAGE ((DWORD)-1)
#define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define PROCESS_TERMINATE 1
#define PROCESS_CREATE_THREAD 2
#define PROCESS_SET_SESSIONID 4
#define PROCESS_SUSPEND_RESUME 2048
#define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
-#endif
#define PROCESS_DUP_HANDLE 64
#define THREAD_TERMINATE 1
#define THREAD_SUSPEND_RESUME 2
#define THREAD_GET_CONTEXT 8
#define THREAD_SET_CONTEXT 16
#define THREAD_SET_INFORMATION 32
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define THREAD_QUERY_INFORMATION 64
#define THREAD_SET_THREAD_TOKEN 128
#define THREAD_IMPERSONATE 256
#define THREAD_DIRECT_IMPERSONATION 0x200
-#endif
#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define MUTANT_QUERY_STATE 0x0001
#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
#define TIMER_QUERY_STATE 0x0001
#define THREAD_BASE_PRIORITY_MAX 2
#define THREAD_BASE_PRIORITY_MIN (-2)
#define THREAD_BASE_PRIORITY_IDLE (-15)
-#endif
/*
* To prevent gcc compiler warnings, bracket these defines when initialising
* a SID_IDENTIFIER_AUTHORITY, eg.
#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define SE_GROUP_MANDATORY 1
#define SE_GROUP_ENABLED_BY_DEFAULT 2
#define SE_GROUP_ENABLED 4
#define SE_GROUP_USE_FOR_DENY_ONLY 16
#define SE_GROUP_LOGON_ID 3221225472U
#define SE_GROUP_RESOURCE 536870912
-#endif
#define LANG_NEUTRAL 0x00
#define LANG_INVARIANT 0x7f
#define LANG_AFRIKAANS 0x36
#define MEM_WRITE_WATCH 0x200000 /* 98/Me */
#define MEM_PHYSICAL 0x400000
#define MEM_4MB_PAGES 0x80000000
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define MEM_IMAGE SEC_IMAGE
#define SEC_NO_CHANGE 0x00400000
#define SEC_FILE 0x00800000
#define SEC_RESERVE 0x04000000
#define SEC_COMMIT 0x08000000
#define SEC_NOCACHE 0x10000000
-#endif
#define SECTION_EXTEND_SIZE 16
#define SECTION_MAP_READ 4
#define SECTION_MAP_WRITE 2
#define SECTION_MAP_EXECUTE 8
#define SECTION_ALL_ACCESS 0xf001f
#define WRITE_WATCH_FLAG_RESET 0x01
-#ifndef _NTDDK_
#define MESSAGE_RESOURCE_UNICODE 1
-#endif
#define RTL_CRITSECT_TYPE 0
#define RTL_RESOURCE_TYPE 1
/* Also in winddk.h */
ACCESS_MASK GenericExecute;
ACCESS_MASK GenericAll;
} GENERIC_MAPPING, *PGENERIC_MAPPING;
-/* Sigh..when will they learn... */
-#ifndef _NTDDK_
typedef struct _ACE_HEADER {
BYTE AceType;
BYTE AceFlags;
GUID InheritedObjectType;
DWORD SidStart;
} SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
-#endif
typedef struct _ACL {
BYTE AclRevision;
BYTE Sbz1;
#ifndef PAGE_SIZE
#define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
#endif
-
+
/* The following flags control the contents of the CONTEXT structure. */
#define CONTEXT_ARM 0x0000040
BOOLEAN EffectiveOnly;
SECURITY_IMPERSONATION_LEVEL Level;
} SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
-/* Steven you are my hero when you fix the w32api ddk! */
-#if !defined(_NTDDK_)
typedef struct _SID_IDENTIFIER_AUTHORITY {
BYTE Value[6];
} SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
MaxTokenInfoClass
} TOKEN_INFORMATION_CLASS;
-#endif
typedef enum _SID_NAME_USE {
SidTypeUser=1,SidTypeGroup,SidTypeDomain,SidTypeAlias,
SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,
DWORD Count;
DWORD Size;
} TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION;
-/* Sigh..when will they learn... */
-#ifndef _NTDDK_
typedef struct _MEMORY_BASIC_INFORMATION {
PVOID BaseAddress;
PVOID AllocationBase;
DWORD AllocationProtect;
- DWORD RegionSize;
+ SIZE_T RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
DWORD NumberOfBlocks;
MESSAGE_RESOURCE_BLOCK Blocks[1];
} MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
-#endif
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
IN PSLIST_HEADER ListHead
);
-/* FIXME: Please oh please stop including winnt.h from the DDK... */
-#ifndef _NTDDK_
typedef struct _RTL_CRITICAL_SECTION_DEBUG {
WORD Type;
WORD CreatorBackTraceIndex;
HANDLE LockSemaphore;
ULONG_PTR SpinCount;
} RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
-#endif
NTSYSAPI
WORD
#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
#define JOB_OBJECT_ASSIGN_PROCESS 1
#define JOB_OBJECT_SET_ATTRIBUTES 2
#define JOB_OBJECT_QUERY 4
DWORD MemberLevel;
DWORD Flags;
} JOB_SET_ARRAY, *PJOB_SET_ARRAY;
-#endif
typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
LARGE_INTEGER TotalUserTime;
DWORD UIRestrictionsClass;
} JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
-/* Steven you are my hero when you fix the w32api ddk! */
-#ifndef _NTDDK_
typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
DWORD SecurityLimitFlags;
HANDLE JobToken;
PTOKEN_PRIVILEGES PrivilegesToDelete;
PTOKEN_GROUPS RestrictedSids;
} JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
-#endif
typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
DWORD EndOfJobTimeAction;
ULONG DefaultAlert2;
} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
-#ifndef _NTDDK_ /* HACK!!! ntddk.h shouldn't include winnt.h! */
typedef struct _PROCESSOR_POWER_INFORMATION {
ULONG Number;
ULONG MaxMhz;
ULONG MaxIdleState;
ULONG CurrentIdleState;
} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
-#endif
typedef DWORD EXECUTION_STATE;
typedef enum _POWER_INFORMATION_LEVEL {
}
#endif
-/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
-#ifndef _NTDDK_
-#ifdef _M_IX86
+#if defined(_M_IX86)
static __inline__ struct _TEB * NtCurrentTeb(void)
{
struct _TEB *ret;
return ret;
}
-#elif _M_ARM
+#elif defined(_M_ARM)
//
// NT-ARM is not documented
//
#include <armddk.h>
-#elif defined (_M_AMD64)
+#elif defined(_M_AMD64)
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
{
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
}
-#else
+#elif defined(_M_PPC)
static __inline__ struct _TEB * NtCurrentTeb(void)
{
return __readfsdword_winnt(0x18);
}
-#endif
-#elif defined(_M_PPC)
+#else
static __inline__ struct _TEB * NtCurrentTeb(void)
{
return __readfsdword_winnt(0x18);
#if (_MSC_FULL_VER >= 13012035)
-unsigned long __readfsdword(const unsigned long Offset);
-#pragma intrinsic(__readfsdword)
-
__inline PVOID GetCurrentFiber(void) { return (PVOID)(ULONG_PTR)__readfsdword(0x10); }
__inline struct _TEB * NtCurrentTeb(void) { return (struct _TEB *)(ULONG_PTR)__readfsdword(0x18); }