[DDK/XDK]

- Fix some prototypes in wdm.h (PMDLX -> PMDL)
- Fix annotations for ExFreePool(WithTag)

svn path=/trunk/; revision=66636
This commit is contained in:
Timo Kreuzer 2015-03-10 00:09:20 +00:00
parent 7aa570c1fd
commit 4beaf120e7
4 changed files with 39 additions and 31 deletions

View file

@ -11593,7 +11593,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmBuildMdlForNonPagedPool( MmBuildMdlForNonPagedPool(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
//DECLSPEC_DEPRECATED_DDK //DECLSPEC_DEPRECATED_DDK
NTKERNELAPI NTKERNELAPI
@ -11626,7 +11626,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmFreePagesFromMdl( MmFreePagesFromMdl(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_(PASSIVE_LEVEL) _IRQL_requires_max_(PASSIVE_LEVEL)
NTKERNELAPI NTKERNELAPI
@ -11681,7 +11681,7 @@ NTKERNELAPI
PVOID PVOID
NTAPI NTAPI
MmMapLockedPagesSpecifyCache( MmMapLockedPagesSpecifyCache(
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst)
KPROCESSOR_MODE AccessMode, KPROCESSOR_MODE AccessMode,
_In_ __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType, _In_ __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType,
@ -11703,7 +11703,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmProbeAndLockPages( MmProbeAndLockPages(
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ KPROCESSOR_MODE AccessMode, _In_ KPROCESSOR_MODE AccessMode,
_In_ LOCK_OPERATION Operation); _In_ LOCK_OPERATION Operation);
@ -11738,7 +11738,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmUnlockPages( MmUnlockPages(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
NTKERNELAPI NTKERNELAPI
@ -11789,7 +11789,7 @@ NTKERNELAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
MmAdvanceMdl( MmAdvanceMdl(
_Inout_ PMDLX Mdl, _Inout_ PMDL Mdl,
_In_ ULONG NumberOfBytes); _In_ ULONG NumberOfBytes);
_Must_inspect_result_ _Must_inspect_result_
@ -11829,7 +11829,7 @@ NTAPI
MmMapLockedPagesWithReservedMapping( MmMapLockedPagesWithReservedMapping(
_In_ PVOID MappingAddress, _In_ PVOID MappingAddress,
_In_ ULONG PoolTag, _In_ ULONG PoolTag,
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ __drv_strictTypeMatch(__drv_typeCond) _In_ __drv_strictTypeMatch(__drv_typeCond)
MEMORY_CACHING_TYPE CacheType); MEMORY_CACHING_TYPE CacheType);
@ -11839,7 +11839,7 @@ NTKERNELAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
MmProtectMdlSystemAddress( MmProtectMdlSystemAddress(
_In_ PMDLX MemoryDescriptorList, _In_ PMDL MemoryDescriptorList,
_In_ ULONG NewProtect); _In_ ULONG NewProtect);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
@ -11849,7 +11849,7 @@ NTAPI
MmUnmapReservedMapping( MmUnmapReservedMapping(
_In_ PVOID BaseAddress, _In_ PVOID BaseAddress,
_In_ ULONG PoolTag, _In_ ULONG PoolTag,
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_ (APC_LEVEL) _IRQL_requires_max_ (APC_LEVEL)
NTKERNELAPI NTKERNELAPI
@ -14799,14 +14799,14 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
ExFreePool( ExFreePool(
_In_ __drv_freesMem(Mem) PVOID P); _Pre_notnull_ __drv_freesMem(Mem) PVOID P);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
NTKERNELAPI NTKERNELAPI
VOID VOID
NTAPI NTAPI
ExFreePoolWithTag( ExFreePoolWithTag(
_In_ __drv_freesMem(Mem) PVOID P, _Pre_notnull_ __drv_freesMem(Mem) PVOID P,
_In_ ULONG Tag); _In_ ULONG Tag);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)

View file

@ -606,14 +606,14 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
ExFreePool( ExFreePool(
_In_ __drv_freesMem(Mem) PVOID P); _Pre_not __drv_freesMem(Mem) PVOID P);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
NTKERNELAPI NTKERNELAPI
VOID VOID
NTAPI NTAPI
ExFreePoolWithTag( ExFreePoolWithTag(
_In_ __drv_freesMem(Mem) PVOID P, _Pre_not __drv_freesMem(Mem) PVOID P,
_In_ ULONG Tag); _In_ ULONG Tag);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)

View file

@ -232,7 +232,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmBuildMdlForNonPagedPool( MmBuildMdlForNonPagedPool(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
//DECLSPEC_DEPRECATED_DDK //DECLSPEC_DEPRECATED_DDK
NTKERNELAPI NTKERNELAPI
@ -265,7 +265,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmFreePagesFromMdl( MmFreePagesFromMdl(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_(PASSIVE_LEVEL) _IRQL_requires_max_(PASSIVE_LEVEL)
NTKERNELAPI NTKERNELAPI
@ -320,7 +320,7 @@ NTKERNELAPI
PVOID PVOID
NTAPI NTAPI
MmMapLockedPagesSpecifyCache( MmMapLockedPagesSpecifyCache(
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst)
KPROCESSOR_MODE AccessMode, KPROCESSOR_MODE AccessMode,
_In_ __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType, _In_ __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType,
@ -342,7 +342,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmProbeAndLockPages( MmProbeAndLockPages(
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ KPROCESSOR_MODE AccessMode, _In_ KPROCESSOR_MODE AccessMode,
_In_ LOCK_OPERATION Operation); _In_ LOCK_OPERATION Operation);
@ -377,7 +377,7 @@ NTKERNELAPI
VOID VOID
NTAPI NTAPI
MmUnlockPages( MmUnlockPages(
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
NTKERNELAPI NTKERNELAPI
@ -629,7 +629,7 @@ NTKERNELAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
MmAdvanceMdl( MmAdvanceMdl(
_Inout_ PMDLX Mdl, _Inout_ PMDL Mdl,
_In_ ULONG NumberOfBytes); _In_ ULONG NumberOfBytes);
_Must_inspect_result_ _Must_inspect_result_
@ -669,7 +669,7 @@ NTAPI
MmMapLockedPagesWithReservedMapping( MmMapLockedPagesWithReservedMapping(
_In_ PVOID MappingAddress, _In_ PVOID MappingAddress,
_In_ ULONG PoolTag, _In_ ULONG PoolTag,
_Inout_ PMDLX MemoryDescriptorList, _Inout_ PMDL MemoryDescriptorList,
_In_ __drv_strictTypeMatch(__drv_typeCond) _In_ __drv_strictTypeMatch(__drv_typeCond)
MEMORY_CACHING_TYPE CacheType); MEMORY_CACHING_TYPE CacheType);
@ -679,7 +679,7 @@ NTKERNELAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
MmProtectMdlSystemAddress( MmProtectMdlSystemAddress(
_In_ PMDLX MemoryDescriptorList, _In_ PMDL MemoryDescriptorList,
_In_ ULONG NewProtect); _In_ ULONG NewProtect);
_IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_requires_max_(DISPATCH_LEVEL)
@ -689,7 +689,7 @@ NTAPI
MmUnmapReservedMapping( MmUnmapReservedMapping(
_In_ PVOID BaseAddress, _In_ PVOID BaseAddress,
_In_ ULONG PoolTag, _In_ ULONG PoolTag,
_Inout_ PMDLX MemoryDescriptorList); _Inout_ PMDL MemoryDescriptorList);
_IRQL_requires_max_ (APC_LEVEL) _IRQL_requires_max_ (APC_LEVEL)
NTKERNELAPI NTKERNELAPI

View file

@ -14,16 +14,20 @@
/* /*
* @implemented * @implemented
*/ */
_Must_inspect_result_
_When_(fl & FL_ZERO_MEMORY, _Ret_opt_bytecount_(cjMemSize))
_When_(!(fl & FL_ZERO_MEMORY), _Ret_opt_bytecap_(cjMemSize))
ENGAPI
PVOID PVOID
APIENTRY APIENTRY
EngAllocMem( EngAllocMem(
ULONG Flags, _In_ ULONG fl,
ULONG cjMemSize, _In_ ULONG cjMemSize,
ULONG ulTag) _In_ ULONG ulTag)
{ {
PVOID pvBaseAddress; PVOID pvBaseAddress;
pvBaseAddress = ExAllocatePoolWithTag((Flags & FL_NONPAGED_MEMORY) ? pvBaseAddress = ExAllocatePoolWithTag((fl & FL_NONPAGED_MEMORY) ?
NonPagedPool : PagedPool, NonPagedPool : PagedPool,
cjMemSize, cjMemSize,
ulTag); ulTag);
@ -31,7 +35,7 @@ EngAllocMem(
if (pvBaseAddress == NULL) if (pvBaseAddress == NULL)
return NULL; return NULL;
if (Flags & FL_ZERO_MEMORY) if (fl & FL_ZERO_MEMORY)
RtlZeroMemory(pvBaseAddress, cjMemSize); RtlZeroMemory(pvBaseAddress, cjMemSize);
return pvBaseAddress; return pvBaseAddress;
@ -55,9 +59,14 @@ EngFreeMem(PVOID pvBaseAddress)
/* /*
* @implemented * @implemented
*/ */
_Must_inspect_result_
_Ret_opt_bytecount_(cjMemSize)
ENGAPI
PVOID PVOID
APIENTRY APIENTRY
EngAllocUserMem(SIZE_T cjSize, ULONG ulTag) EngAllocUserMem(
_In_ SIZE_T cjMemSize,
_In_ ULONG ulTag)
{ {
PVOID pvBaseAddress = NULL; PVOID pvBaseAddress = NULL;
NTSTATUS Status; NTSTATUS Status;
@ -65,7 +74,7 @@ EngAllocUserMem(SIZE_T cjSize, ULONG ulTag)
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
&pvBaseAddress, &pvBaseAddress,
0, 0,
&cjSize, &cjMemSize,
MEM_COMMIT | MEM_RESERVE, MEM_COMMIT | MEM_RESERVE,
PAGE_READWRITE); PAGE_READWRITE);
@ -77,7 +86,7 @@ EngAllocUserMem(SIZE_T cjSize, ULONG ulTag)
/* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */ /* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */
//hSecure = EngSecureMem(pvBaseAddress, cj); //hSecure = EngSecureMem(pvBaseAddress, cj);
return pvBaseAddress; return pvBaseAddress;
} }
/* /*
@ -97,7 +106,6 @@ EngFreeUserMem(PVOID pvBaseAddress)
/* TODO: Remove allocation info from AVL tree */ /* TODO: Remove allocation info from AVL tree */
} }
PVOID PVOID
APIENTRY APIENTRY
HackSecureVirtualMemory( HackSecureVirtualMemory(