- More MSVC fixes (down to 19 errors):

- Header changes: fix FILE_LOCK_INFO, LARGE_MCB, BASE_MCB, MM_SYSTEMSIZE.
- Remove many things in W32API which are incorrectly there (due to winnt being used by the win32api DDK). Defined them in the NDK instead, where appropriate (mostly definitions that are present in user-mode headers, but not kernel-mode headers).
- Hacked the ERESOURCE functions to define a special ERESOURCE_XP type. This is necessary because ERESOURCE is an opaque-yet-exported structure, and its structure changed in Vista.
- Removed support for IMAGE_SCN_TYPE_NO_LOAD. It is a reserved field and Windows does not "respect" it. (sections marked as no-load will still be loaded by NT).

svn path=/trunk/; revision=23972
This commit is contained in:
Alex Ionescu 2006-09-07 21:36:15 +00:00
parent 7d80cdabff
commit 254f6b62ac
26 changed files with 314 additions and 138 deletions

View file

@ -225,7 +225,7 @@ InbvInitVGAMode(VOID)
} }
static BOOL STDCALL static BOOLEAN STDCALL
VidResetDisplay(VOID) VidResetDisplay(VOID)
{ {
/* /*

View file

@ -9,5 +9,5 @@
typedef struct typedef struct
{ {
BOOL (STDCALL *ResetDisplay)(VOID); BOOLEAN (NTAPI *ResetDisplay)(VOID);
} NTBOOTVID_FUNCTION_TABLE; } NTBOOTVID_FUNCTION_TABLE;

View file

@ -272,11 +272,7 @@ extern LARGE_INTEGER IoOtherTransferCount;
#define IO_ATTACH_DEVICE 0x0400 #define IO_ATTACH_DEVICE 0x0400
#define IO_ATTACH_DEVICE_API 0x80000000 #define IO_ATTACH_DEVICE_API 0x80000000
/* also in winnt.h */
#define IO_COMPLETION_QUERY_STATE 0x0001
#define IO_COMPLETION_MODIFY_STATE 0x0002
#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
/* end winnt.h */
#define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64 #define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64
#define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024 #define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024
@ -297,9 +293,7 @@ extern LARGE_INTEGER IoOtherTransferCount;
#define MAP_PROCESS 1L #define MAP_PROCESS 1L
#define MAP_SYSTEM 2L #define MAP_SYSTEM 2L
#define MEM_DOS_LIM 0x40000000 #define MEM_DOS_LIM 0x40000000
/* also in winnt.h */
#define MEM_IMAGE SEC_IMAGE
/* end winnt.h */
#define OB_TYPE_TYPE 1 #define OB_TYPE_TYPE 1
#define OB_TYPE_DIRECTORY 2 #define OB_TYPE_DIRECTORY 2
#define OB_TYPE_SYMBOLIC_LINK 3 #define OB_TYPE_SYMBOLIC_LINK 3
@ -332,15 +326,7 @@ extern LARGE_INTEGER IoOtherTransferCount;
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2 #define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
/* also in winnt.h */
#define SEC_BASED 0x00200000 #define SEC_BASED 0x00200000
#define SEC_NO_CHANGE 0x00400000
#define SEC_FILE 0x00800000
#define SEC_IMAGE 0x01000000
#define SEC_VLM 0x02000000
#define SEC_RESERVE 0x04000000
#define SEC_COMMIT 0x08000000
#define SEC_NOCACHE 0x10000000
#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
#define SECURITY_WORLD_RID (0x00000000L) #define SECURITY_WORLD_RID (0x00000000L)
@ -921,14 +907,15 @@ typedef struct _FILE_LINK_INFORMATION {
WCHAR FileName[1]; WCHAR FileName[1];
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
typedef struct _FILE_LOCK_INFO { typedef struct _FILE_LOCK_INFO
LARGE_INTEGER StartingByte; {
LARGE_INTEGER Length; LARGE_INTEGER StartingByte;
BOOLEAN ExclusiveLock; LARGE_INTEGER Length;
ULONG Key; BOOLEAN ExclusiveLock;
PFILE_OBJECT FileObject; ULONG Key;
PEPROCESS Process; PFILE_OBJECT FileObject;
LARGE_INTEGER EndingByte; PVOID ProcessId;
LARGE_INTEGER EndingByte;
} FILE_LOCK_INFO, *PFILE_LOCK_INFO; } FILE_LOCK_INFO, *PFILE_LOCK_INFO;
/* raw internal file lock struct returned from FsRtlGetNextFileLock */ /* raw internal file lock struct returned from FsRtlGetNextFileLock */
@ -1227,25 +1214,21 @@ typedef struct _BASE_MCB
{ {
ULONG MaximumPairCount; ULONG MaximumPairCount;
ULONG PairCount; ULONG PairCount;
POOL_TYPE PoolType; USHORT PoolType;
USHORT Flags;
PVOID Mapping; PVOID Mapping;
} BASE_MCB; } BASE_MCB, *PBASE_MCB;
typedef BASE_MCB *PBASE_MCB;
typedef struct _LARGE_MCB { typedef struct _LARGE_MCB
PFAST_MUTEX FastMutex; {
ULONG MaximumPairCount; PKGUARDED_MUTEX GuardedMutex;
ULONG PairCount; BASE_MCB BaseMcb;
POOL_TYPE PoolType; } LARGE_MCB, *PLARGE_MCB;
PVOID Mapping;
} LARGE_MCB;
typedef LARGE_MCB *PLARGE_MCB;
typedef struct _MCB typedef struct _MCB
{ {
LARGE_MCB DummyFieldThatSizesThisStructureCorrectly; LARGE_MCB DummyFieldThatSizesThisStructureCorrectly;
} MCB; } MCB, *PMCB;
typedef MCB *PMCB;
typedef struct _GENERATE_NAME_CONTEXT { typedef struct _GENERATE_NAME_CONTEXT {
USHORT Checksum; USHORT Checksum;
@ -1268,10 +1251,6 @@ typedef struct _GET_RETRIEVAL_DESCRIPTOR {
MAPPING_PAIR Pair[1]; MAPPING_PAIR Pair[1];
} GET_RETRIEVAL_DESCRIPTOR, *PGET_RETRIEVAL_DESCRIPTOR; } GET_RETRIEVAL_DESCRIPTOR, *PGET_RETRIEVAL_DESCRIPTOR;
typedef struct _IO_COMPLETION_BASIC_INFORMATION {
LONG Depth;
} IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION;
typedef struct _KQUEUE { typedef struct _KQUEUE {
DISPATCHER_HEADER Header; DISPATCHER_HEADER Header;
LIST_ENTRY EntryListHead; LIST_ENTRY EntryListHead;

View file

@ -397,7 +397,6 @@ extern POBJECT_TYPE NTSYSAPI IoDriverObjectType;
extern POBJECT_TYPE NTSYSAPI IoFileObjectType; extern POBJECT_TYPE NTSYSAPI IoFileObjectType;
extern POBJECT_TYPE NTSYSAPI PsThreadType; extern POBJECT_TYPE NTSYSAPI PsThreadType;
extern POBJECT_TYPE NTSYSAPI LpcPortObjectType; extern POBJECT_TYPE NTSYSAPI LpcPortObjectType;
extern POBJECT_TYPE NTSYSAPI MmSectionObjectType;
extern POBJECT_TYPE NTSYSAPI SeTokenObjectType; extern POBJECT_TYPE NTSYSAPI SeTokenObjectType;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) #if (NTDDI_VERSION >= NTDDI_LONGHORN)
@ -4627,7 +4626,7 @@ typedef enum _MM_SYSTEM_SIZE {
MmSmallSystem, MmSmallSystem,
MmMediumSystem, MmMediumSystem,
MmLargeSystem MmLargeSystem
} MM_SYSTEM_SIZE; } MM_SYSTEMSIZE;
typedef struct _OBJECT_HANDLE_INFORMATION { typedef struct _OBJECT_HANDLE_INFORMATION {
ULONG HandleAttributes; ULONG HandleAttributes;
@ -5114,7 +5113,6 @@ typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
#define CLOCK1_LEVEL 28 #define CLOCK1_LEVEL 28
#define CLOCK2_LEVEL 28 #define CLOCK2_LEVEL 28
#define IPI_LEVEL 29 #define IPI_LEVEL 29
#define SYNCH_LEVEL (IPI_LEVEL-1)
#define POWER_LEVEL 30 #define POWER_LEVEL 30
#define HIGH_LEVEL 31 #define HIGH_LEVEL 31
@ -9466,7 +9464,7 @@ MmProbeAndLockPages(
IN LOCK_OPERATION Operation); IN LOCK_OPERATION Operation);
NTOSAPI NTOSAPI
MM_SYSTEM_SIZE MM_SYSTEMSIZE
DDKAPI DDKAPI
MmQuerySystemSize( MmQuerySystemSize(
VOID); VOID);
@ -10246,7 +10244,6 @@ ZwSetValueKey(
/* [Nt|Zw]MapViewOfSection.InheritDisposition constants */ /* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
#define AT_EXTENDABLE_FILE 0x00002000 #define AT_EXTENDABLE_FILE 0x00002000
#define SEC_NO_CHANGE 0x00400000
#define AT_RESERVED 0x20000000 #define AT_RESERVED 0x20000000
#define AT_ROUND_TO_PAGE 0x40000000 #define AT_ROUND_TO_PAGE 0x40000000

View file

@ -92,9 +92,18 @@ extern ULONG NTSYSAPI NtBuildNumber;
#define EVENT_QUERY_STATE 0x0001 #define EVENT_QUERY_STATE 0x0001
// //
// Semaphore Object Acess Masks // Semaphore Object Access Masks
// //
#define SEMAPHORE_QUERY_STATE 0x0001 #define SEMAPHORE_QUERY_STATE 0x0001
#else
//
// Mutant Object Access Masks
//
#define MUTANT_QUERY_STATE 0x0001
#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
SYNCHRONIZE | \
MUTANT_QUERY_STATE)
#endif #endif
// //
@ -343,6 +352,29 @@ NTSTATUS
#else #else
//
// Compatibility with Windows XP Drivers using ERESOURCE
//
typedef struct _ERESOURCE_XP
{
LIST_ENTRY SystemResourcesList;
POWNER_ENTRY OwnerTable;
SHORT ActiveCount;
USHORT Flag;
PKSEMAPHORE SharedWaiters;
PKEVENT ExclusiveWaiters;
OWNER_ENTRY OwnerThreads[2];
ULONG ContentionCount;
USHORT NumberOfSharedWaiters;
USHORT NumberOfExclusiveWaiters;
union
{
PVOID Address;
ULONG_PTR CreatorBackTraceIndex;
};
KSPIN_LOCK SpinLock;
} ERESOURCE_XP, *PERESOURCE_XP;
// //
// Executive Work Queue Structures // Executive Work Queue Structures
// //
@ -519,6 +551,14 @@ typedef struct _HANDLE_TABLE_ENTRY
}; };
} HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY; } HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
//
// FIXME
//
#ifdef _REACTOS_
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN2K
#endif
typedef struct _HANDLE_TABLE typedef struct _HANDLE_TABLE
{ {
#if (NTDDI_VERSION >= NTDDI_WINXP) #if (NTDDI_VERSION >= NTDDI_WINXP)

View file

@ -106,6 +106,15 @@ Author:
// //
#define KSEG0_BASE 0x80000000 #define KSEG0_BASE 0x80000000
//
// Synchronization-level IRQL
//
#if defined(NT_UP)
#define SYNCH_LEVEL DISPATCH_LEVEL
#else
#define SYNCH_LEVEL (IPI_LEVEL - 1)
#endif
// //
// Macro to get current KPRCB // Macro to get current KPRCB
// //

View file

@ -27,7 +27,15 @@ Author:
typedef PVOID PFS_FILTER_CALLBACKS; typedef PVOID PFS_FILTER_CALLBACKS;
#endif #endif
//
// I/O Completion Access Rights
//
#define IO_COMPLETION_QUERY_STATE 0x0001
#ifndef NTOS_MODE_USER #ifndef NTOS_MODE_USER
#define IO_COMPLETION_MODIFY_STATE 0x0002
#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
SYNCHRONIZE | \
0x3)
// //
// Kernel Exported Object Types // Kernel Exported Object Types
@ -649,6 +657,14 @@ typedef struct _IO_ERROR_LOG_MESSAGE
#endif #endif
//
// I/O Completion Information structures
//
typedef struct _IO_COMPLETION_BASIC_INFORMATION
{
LONG Depth;
} IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION;
// //
// Parameters for NtCreateMailslotFile/NtCreateNamedPipeFile // Parameters for NtCreateMailslotFile/NtCreateNamedPipeFile
// //

View file

@ -28,27 +28,50 @@ Author:
// //
// Page-Rounding Macros // Page-Rounding Macros
// //
#define PAGE_ROUND_DOWN(x) (((ULONG_PTR)x)&(~(PAGE_SIZE-1))) #define PAGE_ROUND_DOWN(x) \
#define PAGE_ROUND_UP(x) \ (((ULONG_PTR)x)&(~(PAGE_SIZE-1)))
( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) ) #define PAGE_ROUND_UP(x) \
( (((ULONG_PTR)x)%PAGE_SIZE) ? \
((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : \
((ULONG_PTR)x) )
#ifdef NTOS_MODE_USER #ifdef NTOS_MODE_USER
#define ROUND_TO_PAGES(Size) (((ULONG_PTR)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) #define ROUND_TO_PAGES(Size) \
(((ULONG_PTR)(Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#endif #endif
#define ROUND_TO_ALLOCATION_GRANULARITY(Size) (((ULONG_PTR)(Size) + MM_ALLOCATION_GRANULARITY - 1) \ #define ROUND_TO_ALLOCATION_GRANULARITY(Size) \
(((ULONG_PTR)(Size) + MM_ALLOCATION_GRANULARITY - 1) \
& ~(MM_ALLOCATION_GRANULARITY - 1)) & ~(MM_ALLOCATION_GRANULARITY - 1))
// //
// Macro for generating pool tags // Macro for generating pool tags
// //
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24)) #define TAG(A, B, C, D) \
(ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#ifdef NTOS_MODE_USER #ifndef NTOS_MODE_USER
//
// Virtual Memory Flags
//
#define MEM_WRITE_WATCH 0x200000
#define MEM_PHYSICAL 0x400000
#define MEM_ROTATE 0x800000
#define MEM_IMAGE SEC_IMAGE
// //
// Section Flags for NtCreateSection // Section Flags for NtCreateSection
// //
#define SEC_BASED 0x00200000 #define SEC_NO_CHANGE 0x400000
#define SEC_NO_CHANGE 0x00400000 #define SEC_FILE 0x800000
#define SEC_IMAGE 0x1000000
#define SEC_PROTECTED_IMAGE 0x2000000
#define SEC_RESERVE 0x4000000
#define SEC_COMMIT 0x8000000
#define SEC_NOCACHE 0x10000000
#define SEC_WRITECOMBINE 0x40000000
#define SEC_LARGE_PAGES 0x80000000
#else
#define SEC_BASED 0x200000
// //
// Section Inherit Flags for NtCreateSection // Section Inherit Flags for NtCreateSection
@ -583,11 +606,6 @@ typedef struct _MEMORY_BASIC_INFORMATION
ULONG Type; ULONG Type;
} MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION; } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
//
// Mm Global Variables
//
// //
// Default heap size values. For user mode, these values are copied to a new // Default heap size values. For user mode, these values are copied to a new
// process's PEB by the kernel in MmCreatePeb. In kernel mode, RtlCreateHeap // process's PEB by the kernel in MmCreatePeb. In kernel mode, RtlCreateHeap
@ -601,6 +619,11 @@ extern SIZE_T MmHeapSegmentCommit;
extern SIZE_T MmHeapDeCommitTotalFreeThreshold; extern SIZE_T MmHeapDeCommitTotalFreeThreshold;
extern SIZE_T MmHeapDeCommitFreeBlockThreshold; extern SIZE_T MmHeapDeCommitFreeBlockThreshold;
//
// Section Object Type
//
extern POBJECT_TYPE MmSectionObjectType;
#endif // !NTOS_MODE_USER #endif // !NTOS_MODE_USER
#endif // _MMTYPES_H #endif // _MMTYPES_H

View file

@ -175,6 +175,27 @@ NtCreateThread(
IN BOOLEAN CreateSuspended IN BOOLEAN CreateSuspended
); );
#ifndef NTOS_MODE_USER
FORCEINLINE
PTEB
NtCurrentTeb(VOID)
{
#ifndef __GNUC__
return (PTEB)(ULONG_PTR)__readfsdword(0x18);
#else
struct _TEB *ret;
__asm__ __volatile__ (
"movl %%fs:0x18, %0\n"
: "=r" (ret)
: /* no inputs */
);
return ret;
#endif
}
#endif
NTSYSCALLAPI NTSYSCALLAPI
NTSTATUS NTSTATUS
NTAPI NTAPI

View file

@ -119,10 +119,19 @@ extern NTSYSAPI POBJECT_TYPE PsProcessType;
// //
#define TLS_EXPANSION_SLOTS 64 #define TLS_EXPANSION_SLOTS 64
#ifndef NTOS_MODE_USER
//
// Thread Access Types
//
#define THREAD_QUERY_INFORMATION 0x0040
#define THREAD_SET_THREAD_TOKEN 0x0080
#define THREAD_IMPERSONATE 0x0100
#define THREAD_DIRECT_IMPERSONATION 0x0200
// //
// Process Access Types // Process Access Types
// //
#ifndef NTOS_MODE_USER
#define PROCESS_TERMINATE 0x0001 #define PROCESS_TERMINATE 0x0001
#define PROCESS_CREATE_THREAD 0x0002 #define PROCESS_CREATE_THREAD 0x0002
#define PROCESS_SET_SESSIONID 0x0004 #define PROCESS_SET_SESSIONID 0x0004

View file

@ -59,8 +59,33 @@ Author:
#define SE_CHANGE_NOTIFY_PRIVILEGE (23L) #define SE_CHANGE_NOTIFY_PRIVILEGE (23L)
#define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L) #define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L)
#define SE_MAX_WELL_KNOWN_PRIVILEGE (SE_REMOTE_SHUTDOWN_PRIVILEGE) #define SE_MAX_WELL_KNOWN_PRIVILEGE (SE_REMOTE_SHUTDOWN_PRIVILEGE)
#else #else
//
// User and Group-related SID Attributes
//
#define SE_GROUP_MANDATORY 0x00000001
#define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
#define SE_GROUP_ENABLED 0x00000004
#define SE_GROUP_OWNER 0x00000008
#define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
#define SE_GROUP_INTEGRITY 0x00000020
#define SE_GROUP_INTEGRITY_ENABLED 0x00000040
#define SE_GROUP_RESOURCE 0x20000000
#define SE_GROUP_LOGON_ID 0xC0000000
#define SE_GROUP_VALID_ATTRIBUTES \
(SE_GROUP_MANDATORY | \
SE_GROUP_ENABLED_BY_DEFAULT | \
SE_GROUP_ENABLED | \
SE_GROUP_OWNER | \
SE_GROUP_USE_FOR_DENY_ONLY | \
SE_GROUP_LOGON_ID | \
SE_GROUP_RESOURCE | \
SE_GROUP_INTEGRITY | \
SE_GROUP_INTEGRITY_ENABLED)
// //
// Audit and Policy Structures // Audit and Policy Structures
// //
@ -142,5 +167,11 @@ typedef struct _AUX_DATA
ULONG Reserved; ULONG Reserved;
} AUX_DATA, *PAUX_DATA; } AUX_DATA, *PAUX_DATA;
//
// External SRM Data
//
extern PACL SePublicDefaultDacl;
extern PACL SeSystemDefaultDacl;
#endif #endif
#endif #endif

View file

@ -424,9 +424,12 @@ typedef DWORD FLONG;
#define FILE_SUPPORTS_ENCRYPTION 0x00020000 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
#define FILE_NAMED_STREAMS 0x00040000 #define FILE_NAMED_STREAMS 0x00040000
/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
#define IO_COMPLETION_QUERY_STATE 0x0001 #define IO_COMPLETION_QUERY_STATE 0x0001
#define IO_COMPLETION_MODIFY_STATE 0x0002 #define IO_COMPLETION_MODIFY_STATE 0x0002
#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
#endif
/* end ntifs.h */ /* end ntifs.h */
/* also in ddk/winddk.h */ /* also in ddk/winddk.h */
@ -457,10 +460,13 @@ typedef DWORD FLONG;
#define THREAD_GET_CONTEXT 8 #define THREAD_GET_CONTEXT 8
#define THREAD_SET_CONTEXT 16 #define THREAD_SET_CONTEXT 16
#define THREAD_SET_INFORMATION 32 #define THREAD_SET_INFORMATION 32
/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
#define THREAD_QUERY_INFORMATION 64 #define THREAD_QUERY_INFORMATION 64
#define THREAD_SET_THREAD_TOKEN 128 #define THREAD_SET_THREAD_TOKEN 128
#define THREAD_IMPERSONATE 256 #define THREAD_IMPERSONATE 256
#define THREAD_DIRECT_IMPERSONATION 0x200 #define THREAD_DIRECT_IMPERSONATION 0x200
#endif
#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF) #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
#define THREAD_BASE_PRIORITY_LOWRT 15 #define THREAD_BASE_PRIORITY_LOWRT 15
#define THREAD_BASE_PRIORITY_MAX 2 #define THREAD_BASE_PRIORITY_MAX 2
@ -468,8 +474,11 @@ typedef DWORD FLONG;
#define THREAD_BASE_PRIORITY_IDLE (-15) #define THREAD_BASE_PRIORITY_IDLE (-15)
#define EXCEPTION_NONCONTINUABLE 1 #define EXCEPTION_NONCONTINUABLE 1
#define EXCEPTION_MAXIMUM_PARAMETERS 15 #define EXCEPTION_MAXIMUM_PARAMETERS 15
/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
#define MUTANT_QUERY_STATE 0x0001 #define MUTANT_QUERY_STATE 0x0001
#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE) #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
#endif
#define TIMER_QUERY_STATE 0x0001 #define TIMER_QUERY_STATE 0x0001
#define TIMER_MODIFY_STATE 0x0002 #define TIMER_MODIFY_STATE 0x0002
#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE) #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
@ -654,6 +663,8 @@ typedef enum
#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege") #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
#define SE_GROUP_MANDATORY 1 #define SE_GROUP_MANDATORY 1
#define SE_GROUP_ENABLED_BY_DEFAULT 2 #define SE_GROUP_ENABLED_BY_DEFAULT 2
#define SE_GROUP_ENABLED 4 #define SE_GROUP_ENABLED 4
@ -661,6 +672,7 @@ typedef enum
#define SE_GROUP_USE_FOR_DENY_ONLY 16 #define SE_GROUP_USE_FOR_DENY_ONLY 16
#define SE_GROUP_LOGON_ID 3221225472U #define SE_GROUP_LOGON_ID 3221225472U
#define SE_GROUP_RESOURCE 536870912 #define SE_GROUP_RESOURCE 536870912
#endif
#define LANG_NEUTRAL 0x00 #define LANG_NEUTRAL 0x00
#define LANG_ARABIC 0x01 #define LANG_ARABIC 0x01
#define LANG_BULGARIAN 0x02 #define LANG_BULGARIAN 0x02
@ -1005,9 +1017,9 @@ typedef enum
#define MEM_WRITE_WATCH 0x200000 /* 98/Me */ #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
#define MEM_PHYSICAL 0x400000 #define MEM_PHYSICAL 0x400000
#define MEM_4MB_PAGES 0x80000000 #define MEM_4MB_PAGES 0x80000000
/* also in ddk/ntifs.h */ /* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
#define MEM_IMAGE SEC_IMAGE #define MEM_IMAGE SEC_IMAGE
#define SEC_BASED 0x00200000
#define SEC_NO_CHANGE 0x00400000 #define SEC_NO_CHANGE 0x00400000
#define SEC_FILE 0x00800000 #define SEC_FILE 0x00800000
#define SEC_IMAGE 0x01000000 #define SEC_IMAGE 0x01000000
@ -1015,7 +1027,7 @@ typedef enum
#define SEC_RESERVE 0x04000000 #define SEC_RESERVE 0x04000000
#define SEC_COMMIT 0x08000000 #define SEC_COMMIT 0x08000000
#define SEC_NOCACHE 0x10000000 #define SEC_NOCACHE 0x10000000
/* end ntifs.h */ #endif
#define SECTION_EXTEND_SIZE 16 #define SECTION_EXTEND_SIZE 16
#define SECTION_MAP_READ 4 #define SECTION_MAP_READ 4
#define SECTION_MAP_WRITE 2 #define SECTION_MAP_WRITE 2
@ -3772,6 +3784,8 @@ static __inline__ PVOID GetCurrentFiber(void)
return ret; return ret;
} }
/* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
#ifndef __NTDDK_H
static __inline__ struct _TEB * NtCurrentTeb(void) static __inline__ struct _TEB * NtCurrentTeb(void)
{ {
struct _TEB *ret; struct _TEB *ret;
@ -3784,6 +3798,7 @@ static __inline__ struct _TEB * NtCurrentTeb(void)
return ret; return ret;
} }
#endif
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)

View file

@ -57,7 +57,7 @@ BOOLEAN ExResourceStrict = FALSE; /* FIXME */
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExpVerifyResource(IN PERESOURCE Resource) ExpVerifyResource(IN PERESOURCE_XP Resource)
{ {
/* Verify the resource data */ /* Verify the resource data */
ASSERT((((ULONG_PTR)Resource) & (sizeof(ULONG_PTR) - 1)) == 0); ASSERT((((ULONG_PTR)Resource) & (sizeof(ULONG_PTR) - 1)) == 0);
@ -94,7 +94,7 @@ ExpVerifyResource(IN PERESOURCE Resource)
VOID VOID
NTAPI NTAPI
ExpCheckForApcsDisabled(IN BOOLEAN BreakIfTrue, ExpCheckForApcsDisabled(IN BOOLEAN BreakIfTrue,
IN PERESOURCE Resource, IN PERESOURCE_XP Resource,
IN PETHREAD Thread) IN PETHREAD Thread)
{ {
/* Check if we should care and check if we should break */ /* Check if we should care and check if we should break */
@ -156,7 +156,7 @@ ExpResourceInitialization(VOID)
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource, ExpAllocateExclusiveWaiterEvent(IN PERESOURCE_XP Resource,
IN PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
PKEVENT Event; PKEVENT Event;
@ -205,7 +205,7 @@ ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource,
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource, ExpAllocateSharedWaiterSemaphore(IN PERESOURCE_XP Resource,
IN PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
@ -254,7 +254,7 @@ ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource,
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExpExpandResourceOwnerTable(IN PERESOURCE Resource, ExpExpandResourceOwnerTable(IN PERESOURCE_XP Resource,
IN PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
POWNER_ENTRY Owner, Table; POWNER_ENTRY Owner, Table;
@ -354,7 +354,7 @@ ExpExpandResourceOwnerTable(IN PERESOURCE Resource,
*--*/ *--*/
POWNER_ENTRY POWNER_ENTRY
FASTCALL FASTCALL
ExpFindFreeEntry(IN PERESOURCE Resource, ExpFindFreeEntry(IN PERESOURCE_XP Resource,
IN PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
POWNER_ENTRY Owner, Limit; POWNER_ENTRY Owner, Limit;
@ -440,7 +440,7 @@ ExpFindFreeEntry(IN PERESOURCE Resource,
*--*/ *--*/
POWNER_ENTRY POWNER_ENTRY
FASTCALL FASTCALL
ExpFindEntryForThread(IN PERESOURCE Resource, ExpFindEntryForThread(IN PERESOURCE_XP Resource,
IN ERESOURCE_THREAD Thread, IN ERESOURCE_THREAD Thread,
IN PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
@ -598,7 +598,7 @@ ExpBoostOwnerThread(IN PKTHREAD Thread,
*--*/ *--*/
VOID VOID
FASTCALL FASTCALL
ExpWaitForResource(IN PERESOURCE Resource, ExpWaitForResource(IN PERESOURCE_XP Resource,
IN PVOID Object) IN PVOID Object)
{ {
#if DBG #if DBG
@ -767,12 +767,13 @@ ExpWaitForResource(IN PERESOURCE Resource,
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExAcquireResourceExclusiveLite(PERESOURCE Resource, ExAcquireResourceExclusiveLite(PERESOURCE resource,
BOOLEAN Wait) BOOLEAN Wait)
{ {
KIRQL OldIrql = PASSIVE_LEVEL; KIRQL OldIrql = PASSIVE_LEVEL;
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
BOOLEAN Success; BOOLEAN Success;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Sanity check */ /* Sanity check */
ASSERT((Resource->Flag & ResourceNeverExclusive) == 0); ASSERT((Resource->Flag & ResourceNeverExclusive) == 0);
@ -883,12 +884,13 @@ TryAcquire:
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExAcquireResourceSharedLite(PERESOURCE Resource, ExAcquireResourceSharedLite(PERESOURCE resource,
BOOLEAN Wait) BOOLEAN Wait)
{ {
KIRQL OldIrql; KIRQL OldIrql;
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Get the thread */ /* Get the thread */
Thread = ExGetCurrentResourceThread(); Thread = ExGetCurrentResourceThread();
@ -1044,12 +1046,13 @@ TryAcquire:
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExAcquireSharedStarveExclusive(PERESOURCE Resource, ExAcquireSharedStarveExclusive(PERESOURCE resource,
BOOLEAN Wait) BOOLEAN Wait)
{ {
KIRQL OldIrql; KIRQL OldIrql;
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Get the thread */ /* Get the thread */
Thread = ExGetCurrentResourceThread(); Thread = ExGetCurrentResourceThread();
@ -1191,12 +1194,13 @@ TryAcquire:
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExAcquireSharedWaitForExclusive(PERESOURCE Resource, ExAcquireSharedWaitForExclusive(PERESOURCE resource,
BOOLEAN Wait) BOOLEAN Wait)
{ {
KIRQL OldIrql; KIRQL OldIrql;
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Get the thread */ /* Get the thread */
Thread = ExGetCurrentResourceThread(); Thread = ExGetCurrentResourceThread();
@ -1363,10 +1367,11 @@ TryAcquire:
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExConvertExclusiveToSharedLite(PERESOURCE Resource) ExConvertExclusiveToSharedLite(PERESOURCE resource)
{ {
ULONG OldWaiters; ULONG OldWaiters;
KIRQL OldIrql; KIRQL OldIrql;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
DPRINT("ExConvertExclusiveToSharedLite(Resource 0x%p)\n", Resource); DPRINT("ExConvertExclusiveToSharedLite(Resource 0x%p)\n", Resource);
/* Lock the resource */ /* Lock the resource */
@ -1418,9 +1423,10 @@ ExConvertExclusiveToSharedLite(PERESOURCE Resource)
*--*/ *--*/
NTSTATUS NTSTATUS
NTAPI NTAPI
ExDeleteResourceLite(PERESOURCE Resource) ExDeleteResourceLite(PERESOURCE resource)
{ {
KIRQL OldIrql; KIRQL OldIrql;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
DPRINT("ExDeleteResourceLite(Resource 0x%p)\n", Resource); DPRINT("ExDeleteResourceLite(Resource 0x%p)\n", Resource);
/* Sanity checks */ /* Sanity checks */
@ -1464,9 +1470,10 @@ ExDeleteResourceLite(PERESOURCE Resource)
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExDisableResourceBoostLite(PERESOURCE Resource) ExDisableResourceBoostLite(PERESOURCE resource)
{ {
KIRQL OldIrql; KIRQL OldIrql;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Sanity check */ /* Sanity check */
ExpVerifyResource(Resource); ExpVerifyResource(Resource);
@ -1498,8 +1505,10 @@ ExDisableResourceBoostLite(PERESOURCE Resource)
*--*/ *--*/
ULONG ULONG
NTAPI NTAPI
ExGetExclusiveWaiterCount(PERESOURCE Resource) ExGetExclusiveWaiterCount(PERESOURCE resource)
{ {
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Return the count */ /* Return the count */
return Resource->NumberOfExclusiveWaiters; return Resource->NumberOfExclusiveWaiters;
} }
@ -1521,8 +1530,10 @@ ExGetExclusiveWaiterCount(PERESOURCE Resource)
*--*/ *--*/
ULONG ULONG
NTAPI NTAPI
ExGetSharedWaiterCount(PERESOURCE Resource) ExGetSharedWaiterCount(PERESOURCE resource)
{ {
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Return the count */ /* Return the count */
return Resource->NumberOfSharedWaiters; return Resource->NumberOfSharedWaiters;
} }
@ -1545,12 +1556,13 @@ ExGetSharedWaiterCount(PERESOURCE Resource)
*--*/ *--*/
NTSTATUS NTSTATUS
NTAPI NTAPI
ExInitializeResourceLite(PERESOURCE Resource) ExInitializeResourceLite(PERESOURCE resource)
{ {
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
DPRINT("ExInitializeResourceLite(Resource 0x%p)\n", Resource); DPRINT("ExInitializeResourceLite(Resource 0x%p)\n", Resource);
/* Clear the structure */ /* Clear the structure */
RtlZeroMemory(Resource, sizeof(ERESOURCE)); RtlZeroMemory(Resource, sizeof(ERESOURCE_XP));
/* Initialize the lock */ /* Initialize the lock */
KeInitializeSpinLock(&Resource->SpinLock); KeInitializeSpinLock(&Resource->SpinLock);
@ -1582,10 +1594,11 @@ ExInitializeResourceLite(PERESOURCE Resource)
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExIsResourceAcquiredExclusiveLite(PERESOURCE Resource) ExIsResourceAcquiredExclusiveLite(PERESOURCE resource)
{ {
ERESOURCE_THREAD Thread = ExGetCurrentResourceThread(); ERESOURCE_THREAD Thread = ExGetCurrentResourceThread();
BOOLEAN IsAcquired = FALSE; BOOLEAN IsAcquired = FALSE;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Sanity check */ /* Sanity check */
ExpVerifyResource(Resource); ExpVerifyResource(Resource);
@ -1622,13 +1635,14 @@ ExIsResourceAcquiredExclusiveLite(PERESOURCE Resource)
*--*/ *--*/
ULONG ULONG
NTAPI NTAPI
ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource) ExIsResourceAcquiredSharedLite(IN PERESOURCE resource)
{ {
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
ULONG i, Size; ULONG i, Size;
ULONG Count = 0; ULONG Count = 0;
KIRQL OldIrql; KIRQL OldIrql;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Sanity check */ /* Sanity check */
ExpVerifyResource(Resource); ExpVerifyResource(Resource);
@ -1719,12 +1733,13 @@ ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
*--*/ *--*/
NTSTATUS NTSTATUS
NTAPI NTAPI
ExReinitializeResourceLite(PERESOURCE Resource) ExReinitializeResourceLite(PERESOURCE resource)
{ {
PKEVENT Event; PKEVENT Event;
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
ULONG i, Size; ULONG i, Size;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Get the owner table */ /* Get the owner table */
Owner = Resource->OwnerTable; Owner = Resource->OwnerTable;
@ -1784,12 +1799,13 @@ ExReinitializeResourceLite(PERESOURCE Resource)
*--*/ *--*/
VOID VOID
FASTCALL FASTCALL
ExReleaseResourceLite(PERESOURCE Resource) ExReleaseResourceLite(PERESOURCE resource)
{ {
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
ULONG Count, i; ULONG Count, i;
KIRQL OldIrql; KIRQL OldIrql;
POWNER_ENTRY Owner, Limit; POWNER_ENTRY Owner, Limit;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
DPRINT("ExReleaseResourceLite: %p\n", Resource); DPRINT("ExReleaseResourceLite: %p\n", Resource);
/* Sanity check */ /* Sanity check */
@ -1973,13 +1989,14 @@ ExReleaseResourceLite(PERESOURCE Resource)
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExReleaseResourceForThreadLite(PERESOURCE Resource, ExReleaseResourceForThreadLite(PERESOURCE resource,
ERESOURCE_THREAD Thread) ERESOURCE_THREAD Thread)
{ {
ULONG i; ULONG i;
ULONG Count; ULONG Count;
KIRQL OldIrql; KIRQL OldIrql;
POWNER_ENTRY Owner; POWNER_ENTRY Owner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
ASSERT(Thread != 0); ASSERT(Thread != 0);
DPRINT("ExReleaseResourceForThreadLite: %p\n", Resource); DPRINT("ExReleaseResourceForThreadLite: %p\n", Resource);
@ -2164,12 +2181,13 @@ ExReleaseResourceForThreadLite(PERESOURCE Resource,
*--*/ *--*/
VOID VOID
NTAPI NTAPI
ExSetResourceOwnerPointer(IN PERESOURCE Resource, ExSetResourceOwnerPointer(IN PERESOURCE resource,
IN PVOID OwnerPointer) IN PVOID OwnerPointer)
{ {
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
KIRQL OldIrql; KIRQL OldIrql;
POWNER_ENTRY Owner, ThisOwner; POWNER_ENTRY Owner, ThisOwner;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
/* Sanity check */ /* Sanity check */
ASSERT((OwnerPointer != 0) && (((ULONG_PTR)OwnerPointer & 3) == 3)); ASSERT((OwnerPointer != 0) && (((ULONG_PTR)OwnerPointer & 3) == 3));
@ -2242,11 +2260,12 @@ ExSetResourceOwnerPointer(IN PERESOURCE Resource,
*--*/ *--*/
BOOLEAN BOOLEAN
NTAPI NTAPI
ExTryToAcquireResourceExclusiveLite(PERESOURCE Resource) ExTryToAcquireResourceExclusiveLite(PERESOURCE resource)
{ {
ERESOURCE_THREAD Thread; ERESOURCE_THREAD Thread;
KIRQL OldIrql; KIRQL OldIrql;
BOOLEAN Acquired = FALSE; BOOLEAN Acquired = FALSE;
PERESOURCE_XP Resource = (PERESOURCE_XP)resource;
DPRINT("ExTryToAcquireResourceExclusiveLite: %p\n", Resource); DPRINT("ExTryToAcquireResourceExclusiveLite: %p\n", Resource);
/* Sanity check */ /* Sanity check */

View file

@ -190,7 +190,7 @@ FsRtlpCheckLockForReadOrWriteAccess(
//No write conflict if exclusive lock AND our lock //No write conflict if exclusive lock AND our lock
if ((Read && !Granted->Lock.ExclusiveLock) || if ((Read && !Granted->Lock.ExclusiveLock) ||
(Granted->Lock.ExclusiveLock && (Granted->Lock.ExclusiveLock &&
Granted->Lock.Process == Process && Granted->Lock.ProcessId == Process &&
Granted->Lock.FileObject == FileObject && Granted->Lock.FileObject == FileObject &&
Granted->Lock.Key == Key ) ) Granted->Lock.Key == Key ) )
{ {
@ -382,7 +382,7 @@ FsRtlpFastUnlockAllByKey(
LIST_FOR_EACH_SAFE(Granted, tmp, &LockToc->GrantedListHead, FILE_LOCK_GRANTED, ListEntry) LIST_FOR_EACH_SAFE(Granted, tmp, &LockToc->GrantedListHead, FILE_LOCK_GRANTED, ListEntry)
{ {
if (Granted->Lock.Process == Process && if (Granted->Lock.ProcessId == Process &&
Granted->Lock.FileObject == FileObject && Granted->Lock.FileObject == FileObject &&
(!UseKey || (UseKey && Granted->Lock.Key == Key)) ) (!UseKey || (UseKey && Granted->Lock.Key == Key)) )
{ {
@ -548,7 +548,7 @@ FsRtlpAddLock(
Granted->Lock.ExclusiveLock = ExclusiveLock; Granted->Lock.ExclusiveLock = ExclusiveLock;
Granted->Lock.Key = Key; Granted->Lock.Key = Key;
Granted->Lock.FileObject = FileObject; Granted->Lock.FileObject = FileObject;
Granted->Lock.Process = Process; Granted->Lock.ProcessId = Process;
//ending offset //ending offset
Granted->Lock.EndingByte = EndOffset; Granted->Lock.EndingByte = EndOffset;
Granted->UnlockContext = Context; Granted->UnlockContext = Context;
@ -693,7 +693,7 @@ FsRtlpUnlockSingle(
//must be exact match //must be exact match
if (FileOffset->QuadPart == Granted->Lock.StartingByte.QuadPart && if (FileOffset->QuadPart == Granted->Lock.StartingByte.QuadPart &&
Length->QuadPart == Granted->Lock.Length.QuadPart && Length->QuadPart == Granted->Lock.Length.QuadPart &&
Granted->Lock.Process == Process && Granted->Lock.ProcessId == Process &&
Granted->Lock.FileObject == FileObject && Granted->Lock.FileObject == FileObject &&
Granted->Lock.Key == Key) Granted->Lock.Key == Key)
{ {
@ -799,7 +799,7 @@ FsRtlpDumpFileLocks(
Granted->Lock.Length.QuadPart, Granted->Lock.Length.QuadPart,
Granted->Lock.EndingByte.QuadPart, Granted->Lock.EndingByte.QuadPart,
Granted->Lock.Key, Granted->Lock.Key,
Granted->Lock.Process, Granted->Lock.ProcessId,
Granted->Lock.FileObject Granted->Lock.FileObject
); );

View file

@ -117,7 +117,7 @@ FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb,
IN POOL_TYPE PoolType) IN POOL_TYPE PoolType)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
Mcb->PoolType = PoolType; Mcb->BaseMcb.PoolType = PoolType;
} }
/* /*
@ -179,11 +179,11 @@ FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
/* /*
* @unimplemented * @unimplemented
*/ */
PVOID /* PFSRTL_PER_FILE_OBJECT_CONTEXT*/ PFSRTL_PER_FILEOBJECT_CONTEXT
NTAPI NTAPI
FsRtlLookupPerFileObjectContext(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject,
IN PVOID OwnerId OPTIONAL, IN PVOID OwnerId OPTIONAL,
IN PVOID InstanceId OPTIONAL) IN PVOID InstanceId OPTIONAL)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return FALSE; return FALSE;
@ -269,9 +269,9 @@ FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
{ {
ULONG NumberOfRuns; ULONG NumberOfRuns;
ExAcquireFastMutex(Mcb->FastMutex); KeAcquireGuardedMutex(Mcb->GuardedMutex);
NumberOfRuns = Mcb->PairCount; NumberOfRuns = Mcb->BaseMcb.PairCount;
ExReleaseFastMutex(Mcb->FastMutex); KeReleaseGuardedMutex(Mcb->GuardedMutex);
return NumberOfRuns; return NumberOfRuns;
} }

View file

@ -224,8 +224,8 @@ static inline void Ki386Cpuid(ULONG Op, PULONG Eax, PULONG Ebx, PULONG Ecx, PULO
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define Ke386DisableInterrupts() __asm cli #define Ke386DisableInterrupts() _cli()
#define Ke386EnableInterrupts() __asm sti #define Ke386EnableInterrupts() _sti()
#define Ke386HaltProcessor() __asm hlt #define Ke386HaltProcessor() __asm hlt
#define Ke386GetPageTableDirectory(X) \ #define Ke386GetPageTableDirectory(X) \
__asm mov eax, cr3; \ __asm mov eax, cr3; \

View file

@ -43,9 +43,6 @@ LdrProcessModule(
#if defined (ALLOC_PRAGMA) #if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, IopInitDriverImplementation) #pragma alloc_text(INIT, IopInitDriverImplementation)
#pragma alloc_text(INIT, IopDisplayLoadingMessage)
#pragma alloc_text(INIT, MiFreeBootDriverMemory)
#pragma alloc_text(INIT, IopInitializeBuiltinDriver)
#endif #endif

View file

@ -208,18 +208,6 @@ KeSetTimeIncrement(
KeMinimumIncrement = MinIncrement; KeMinimumIncrement = MinIncrement;
} }
/*
* @unimplemented
*/
VOID
FASTCALL
KeSetTimeUpdateNotifyRoutine(
IN PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine
)
{
UNIMPLEMENTED;
}
/* /*
* @implemented * @implemented
*/ */

View file

@ -654,7 +654,14 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
if (!FpState) return STATUS_INSUFFICIENT_RESOURCES; if (!FpState) return STATUS_INSUFFICIENT_RESOURCES;
*((PVOID *) Save) = FpState; *((PVOID *) Save) = FpState;
#ifdef __GNUC__
asm volatile("fnsave %0\n\t" : "=m" (*FpState)); asm volatile("fnsave %0\n\t" : "=m" (*FpState));
#else
__asm
{
fnsave [FpState]
};
#endif
KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql(); KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql();
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -668,8 +675,16 @@ KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
ASSERT(KeGetCurrentThread()->DispatcherHeader.NpxIrql == KeGetCurrentIrql()); ASSERT(KeGetCurrentThread()->DispatcherHeader.NpxIrql == KeGetCurrentIrql());
#ifdef __GNUC__
asm volatile("fnclex\n\t"); asm volatile("fnclex\n\t");
asm volatile("frstor %0\n\t" : "=m" (*FpState)); asm volatile("frstor %0\n\t" : "=m" (*FpState));
#else
__asm
{
fnclex
frstor [FpState]
};
#endif
ExFreePool(FpState); ExFreePool(FpState);
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -688,8 +703,7 @@ Ki386SetProcessorFeatures(VOID)
struct struct
{ {
KEY_VALUE_PARTIAL_INFORMATION Info; KEY_VALUE_PARTIAL_INFORMATION Info;
UCHAR Buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, UCHAR Buffer[20];
Data[0]) + sizeof(ULONG)];
} ValueData; } ValueData;
NTSTATUS Status; NTSTATUS Status;
ULONG FastSystemCallDisable = 0; ULONG FastSystemCallDisable = 0;

View file

@ -639,7 +639,10 @@ LdrLookupPageProtection (
for (Idx = 0; Idx < PEFileHeader->NumberOfSections && (!Write || !Execute); Idx++) for (Idx = 0; Idx < PEFileHeader->NumberOfSections && (!Write || !Execute); Idx++)
{ {
Characteristics = PESectionHeaders[Idx].Characteristics; Characteristics = PESectionHeaders[Idx].Characteristics;
if (!(Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
Length = max(PESectionHeaders[Idx].Misc.VirtualSize, PESectionHeaders[Idx].SizeOfRawData); Length = max(PESectionHeaders[Idx].Misc.VirtualSize, PESectionHeaders[Idx].SizeOfRawData);
BaseAddress = PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase; BaseAddress = PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase;
@ -736,7 +739,10 @@ LdrPEProcessModule(
DriverSize = 0; DriverSize = 0;
for (Idx = 0; Idx < PENtHeaders->FileHeader.NumberOfSections; Idx++) for (Idx = 0; Idx < PENtHeaders->FileHeader.NumberOfSections; Idx++)
{ {
if (!(PESectionHeaders[Idx].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(PESectionHeaders[Idx].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
CurrentSize = PESectionHeaders[Idx].VirtualAddress + PESectionHeaders[Idx].Misc.VirtualSize; CurrentSize = PESectionHeaders[Idx].VirtualAddress + PESectionHeaders[Idx].Misc.VirtualSize;
DriverSize = max(DriverSize, CurrentSize); DriverSize = max(DriverSize, CurrentSize);

View file

@ -947,9 +947,9 @@ MmCreateMemoryArea(PMADDRESS_SPACE AddressSpace,
PMEMORY_AREA MemoryArea; PMEMORY_AREA MemoryArea;
DPRINT("MmCreateMemoryArea(Type %d, BaseAddress %p, " DPRINT("MmCreateMemoryArea(Type %d, BaseAddress %p, "
"*BaseAddress %p, Length %p, Attributes %x, TopDown: %x, " "*BaseAddress %p, Length %p, AllocationFlags %x, "
"FixedAddress %x, Result %p)\n", "FixedAddress %x, Result %p)\n",
Type, BaseAddress, *BaseAddress, Length, Attributes, TopDown, Type, BaseAddress, *BaseAddress, Length, AllocationFlags,
FixedAddress, Result); FixedAddress, Result);
MmVerifyMemoryAreas(AddressSpace); MmVerifyMemoryAreas(AddressSpace);

View file

@ -29,7 +29,7 @@ extern unsigned int _bss_end__;
static BOOLEAN IsThisAnNtAsSystem = FALSE; static BOOLEAN IsThisAnNtAsSystem = FALSE;
MM_SYSTEM_SIZE MmSystemSize = MmSmallSystem; MM_SYSTEMSIZE MmSystemSize = MmSmallSystem;
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress; PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
@ -58,7 +58,7 @@ BOOLEAN STDCALL MmIsThisAnNtAsSystem(VOID)
/* /*
* @implemented * @implemented
*/ */
MM_SYSTEM_SIZE STDCALL MmQuerySystemSize(VOID) MM_SYSTEMSIZE STDCALL MmQuerySystemSize(VOID)
{ {
return(MmSystemSize); return(MmSystemSize);
} }

View file

@ -213,6 +213,7 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
/* /*
* @implemented * @implemented
*/ */
#undef ExFreePool
VOID STDCALL VOID STDCALL
ExFreePool(IN PVOID Block) ExFreePool(IN PVOID Block)
{ {

View file

@ -17,7 +17,7 @@ extern ULONG NtMajorVersion;
extern ULONG NtMinorVersion; extern ULONG NtMinorVersion;
extern ULONG NtOSCSDVersion; extern ULONG NtOSCSDVersion;
extern ULONG NtGlobalFlag; extern ULONG NtGlobalFlag;
extern MM_SYSTEM_SIZE MmSystemSize; extern MM_SYSTEMSIZE MmSystemSize;
#define MM_HIGHEST_VAD_ADDRESS \ #define MM_HIGHEST_VAD_ADDRESS \
(PVOID)((ULONG_PTR)MM_HIGHEST_USER_ADDRESS - (16 * PAGE_SIZE)) (PVOID)((ULONG_PTR)MM_HIGHEST_USER_ADDRESS - (16 * PAGE_SIZE))

View file

@ -3994,7 +3994,10 @@ MmUnmapViewOfSection(PEPROCESS Process,
* and calculate the image base address */ * and calculate the image base address */
for (i = 0; i < NrSegments; i++) for (i = 0; i < NrSegments; i++)
{ {
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
if (Segment == &SectionSegments[i]) if (Segment == &SectionSegments[i])
{ {
@ -4010,7 +4013,10 @@ MmUnmapViewOfSection(PEPROCESS Process,
for (i = 0; i < NrSegments; i++) for (i = 0; i < NrSegments; i++)
{ {
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
PVOID SBaseAddress = (PVOID) PVOID SBaseAddress = (PVOID)
((char*)ImageBaseAddress + (ULONG_PTR)SectionSegments[i].VirtualAddress); ((char*)ImageBaseAddress + (ULONG_PTR)SectionSegments[i].VirtualAddress);
@ -4476,7 +4482,10 @@ MmMapViewOfSection(IN PVOID SectionObject,
ImageSize = 0; ImageSize = 0;
for (i = 0; i < NrSegments; i++) for (i = 0; i < NrSegments; i++)
{ {
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
ULONG_PTR MaxExtent; ULONG_PTR MaxExtent;
MaxExtent = (ULONG_PTR)SectionSegments[i].VirtualAddress + MaxExtent = (ULONG_PTR)SectionSegments[i].VirtualAddress +
@ -4506,7 +4515,10 @@ MmMapViewOfSection(IN PVOID SectionObject,
for (i = 0; i < NrSegments; i++) for (i = 0; i < NrSegments; i++)
{ {
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD)) //
// This field is RESERVED and not respected by Windows
//
//if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
{ {
PVOID SBaseAddress = (PVOID) PVOID SBaseAddress = (PVOID)
((char*)ImageBase + (ULONG_PTR)SectionSegments[i].VirtualAddress); ((char*)ImageBase + (ULONG_PTR)SectionSegments[i].VirtualAddress);

View file

@ -638,7 +638,6 @@ KeSetTargetProcessorDpc@8
KeSetTimeIncrement@8 KeSetTimeIncrement@8
KeSetTimer@16 KeSetTimer@16
KeSetTimerEx@20 KeSetTimerEx@20
@KeSetTimeUpdateNotifyRoutine@4
KeStackAttachProcess@8 KeStackAttachProcess@8
KeSynchronizeExecution@12 KeSynchronizeExecution@12
KeTerminateThread@4 KeTerminateThread@4