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

View file

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

View file

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

View file

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