Alexandre Julliard : ntoskrnl.exe: Implemented a number of memory allocation functions.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 17 06:42:24 CDT 2007


Module: wine
Branch: master
Commit: 982d6ccbe4fd31ac20f91ab28c916f57a79b73f7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=982d6ccbe4fd31ac20f91ab28c916f57a79b73f7

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 16 17:39:32 2007 +0200

ntoskrnl.exe: Implemented a number of memory allocation functions.

---

 dlls/ntoskrnl.exe/ntoskrnl.c        |   78 +++++++++++++++++++++++++++++++++++
 dlls/ntoskrnl.exe/ntoskrnl.exe.spec |   16 ++++----
 include/ddk/wdm.h                   |    4 ++
 3 files changed, 90 insertions(+), 8 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 8884622..46cf820 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -214,6 +214,84 @@ void WINAPI IofCompleteRequest( IRP *irp, UCHAR priority_boost )
 }
 
 
+/***********************************************************************
+ *           ExAllocatePool   (NTOSKRNL.EXE.@)
+ */
+PVOID WINAPI ExAllocatePool( POOL_TYPE type, SIZE_T size )
+{
+    return ExAllocatePoolWithTag( type, size, 0 );
+}
+
+
+/***********************************************************************
+ *           ExAllocatePoolWithQuota   (NTOSKRNL.EXE.@)
+ */
+PVOID WINAPI ExAllocatePoolWithQuota( POOL_TYPE type, SIZE_T size )
+{
+    return ExAllocatePoolWithTag( type, size, 0 );
+}
+
+
+/***********************************************************************
+ *           ExAllocatePoolWithTag   (NTOSKRNL.EXE.@)
+ */
+PVOID WINAPI ExAllocatePoolWithTag( POOL_TYPE type, SIZE_T size, ULONG tag )
+{
+    /* FIXME: handle page alignment constraints */
+    void *ret = HeapAlloc( GetProcessHeap(), 0, size );
+    TRACE( "%lu pool %u -> %p\n", size, type, ret );
+    return ret;
+}
+
+
+/***********************************************************************
+ *           ExAllocatePoolWithQuotaTag   (NTOSKRNL.EXE.@)
+ */
+PVOID WINAPI ExAllocatePoolWithQuotaTag( POOL_TYPE type, SIZE_T size, ULONG tag )
+{
+    return ExAllocatePoolWithTag( type, size, tag );
+}
+
+
+/***********************************************************************
+ *           ExFreePool   (NTOSKRNL.EXE.@)
+ */
+void WINAPI ExFreePool( void *ptr )
+{
+    ExFreePoolWithTag( ptr, 0 );
+}
+
+
+/***********************************************************************
+ *           ExFreePoolWithTag   (NTOSKRNL.EXE.@)
+ */
+void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag )
+{
+    TRACE( "%p\n", ptr );
+    HeapFree( GetProcessHeap(), 0, ptr );
+}
+
+
+/***********************************************************************
+ *           MmAllocateNonCachedMemory   (NTOSKRNL.EXE.@)
+ */
+LPVOID WINAPI MmAllocateNonCachedMemory( SIZE_T size )
+{
+    TRACE( "%lu\n", size );
+    return VirtualAlloc( NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE|PAGE_NOCACHE );
+}
+
+
+/***********************************************************************
+ *           MmFreeNonCachedMemory   (NTOSKRNL.EXE.@)
+ */
+void WINAPI MmFreeNonCachedMemory( void *addr, SIZE_T size )
+{
+    TRACE( "%p %lu\n", addr, size );
+    VirtualFree( addr, 0, MEM_RELEASE );
+}
+
+
 /*****************************************************
  *           DllMain
  */
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 5bfd792..963a2db 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -116,10 +116,10 @@
 @ stub ExAcquireSharedStarveExclusive
 @ stub ExAcquireSharedWaitForExclusive
 @ stub ExAllocateFromPagedLookasideList
-@ stub ExAllocatePool
-@ stub ExAllocatePoolWithQuota
-@ stub ExAllocatePoolWithQuotaTag
-@ stub ExAllocatePoolWithTag
+@ stdcall ExAllocatePool(long long)
+@ stdcall ExAllocatePoolWithQuota(long long)
+@ stdcall ExAllocatePoolWithQuotaTag(long long long)
+@ stdcall ExAllocatePoolWithTag(long long long)
 @ stub ExAllocatePoolWithTagPriority
 @ stub ExConvertExclusiveToSharedLite
 @ stub ExCreateCallback
@@ -131,8 +131,8 @@
 @ stub ExEnumHandleTable
 @ stub ExEventObjectType
 @ stub ExExtendZone
-@ stub ExFreePool
-@ stub ExFreePoolWithTag
+@ stdcall ExFreePool(ptr)
+@ stdcall ExFreePoolWithTag(ptr long)
 @ stub ExFreeToPagedLookasideList
 @ stub ExGetCurrentProcessorCounts
 @ stub ExGetCurrentProcessorCpuUsage
@@ -658,7 +658,7 @@
 @ stub MmAllocateContiguousMemory
 @ stub MmAllocateContiguousMemorySpecifyCache
 @ stub MmAllocateMappingAddress
-@ stub MmAllocateNonCachedMemory
+@ stdcall MmAllocateNonCachedMemory(long)
 @ stub MmAllocatePagesForMdl
 @ stub MmBuildMdlForNonPagedPool
 @ stub MmCanFileBeTruncated
@@ -671,7 +671,7 @@
 @ stub MmFreeContiguousMemory
 @ stub MmFreeContiguousMemorySpecifyCache
 @ stub MmFreeMappingAddress
-@ stub MmFreeNonCachedMemory
+@ stdcall MmFreeNonCachedMemory(ptr long)
 @ stub MmFreePagesFromMdl
 @ stub MmGetPhysicalAddress
 @ stub MmGetPhysicalMemoryRanges
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 7d53a97..f9db943 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -865,6 +865,7 @@ PVOID     WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T);
 PVOID     WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG);
 PVOID     WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG);
 void      WINAPI ExFreePool(PVOID);
+void      WINAPI ExFreePoolWithTag(PVOID,ULONG);
 
 NTSTATUS  WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
 NTSTATUS  WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
@@ -874,6 +875,9 @@ PEPROCESS WINAPI IoGetCurrentProcess(void);
 
 PKTHREAD  WINAPI KeGetCurrentThread(void);
 
+LPVOID    WINAPI MmAllocateNonCachedMemory(SIZE_T);
+void      WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
+
 #define          PsGetCurrentProcess() IoGetCurrentProcess()
 #define          PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
 HANDLE    WINAPI PsGetCurrentProcessId(void);




More information about the wine-cvs mailing list