* Sync with recent trunk (r52669).
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 13 Jul 2011 11:58:32 +0000 (11:58 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 13 Jul 2011 11:58:32 +0000 (11:58 +0000)
svn path=/branches/GSoC_2011/ThemesSupport/; revision=52670

13 files changed:
base/setup/usetup/bootsup.c
dll/ntdll/ldr/ldrpe.c
drivers/filesystems/npfs/create.c
drivers/network/tcpip/tcpip/main.c
lib/drivers/ip/network/receive.c
lib/drivers/ip/transport/tcp/accept.c
lib/drivers/ip/transport/tcp/tcp.c
ntoskrnl/include/internal/mm.h
ntoskrnl/io/iomgr/driver.c
ntoskrnl/kdbg/kdb_symbols.cmake.c
ntoskrnl/ke/i386/trap.s
ntoskrnl/mm/anonmem.c
subsystems/win32/win32k/include/napi.h

index 3f6c8a7..a079cc3 100644 (file)
@@ -494,11 +494,13 @@ CreateFreeLoaderIniForReactos(PWCHAR IniPath,
         L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS");
 
 #if DBG
         L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS");
 
 #if DBG
+#ifndef _WINKD_
     /* ReactOS_KdSerial */
     CreateFreeLoaderEntry(IniCache, IniSection,
         L"ReactOS_KdSerial", L"\"ReactOS (RosDbg)\"",
         L"Windows2003", ArcPath,
         L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL");
     /* ReactOS_KdSerial */
     CreateFreeLoaderEntry(IniCache, IniSection,
         L"ReactOS_KdSerial", L"\"ReactOS (RosDbg)\"",
         L"Windows2003", ArcPath,
         L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL");
+#endif
 
     /* ReactOS_LogFile */
     CreateFreeLoaderEntry(IniCache, IniSection,
 
     /* ReactOS_LogFile */
     CreateFreeLoaderEntry(IniCache, IniSection,
index a223a16..40fda59 100644 (file)
@@ -681,9 +681,9 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
     DPRINT("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry);
 
     /* Set up the Act Ctx */
     DPRINT("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry);
 
     /* Set up the Act Ctx */
+    RtlZeroMemory(&ActCtx, sizeof(ActCtx));
     ActCtx.Size = sizeof(ActCtx);
     ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER;
     ActCtx.Size = sizeof(ActCtx);
     ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER;
-    RtlZeroMemory(&ActCtx.Frame, sizeof(ActCtx));
 
     /* Check if we have a manifest prober routine */
     if (LdrpManifestProberRoutine)
 
     /* Check if we have a manifest prober routine */
     if (LdrpManifestProberRoutine)
index 42bcacc..a05c569 100644 (file)
@@ -984,7 +984,8 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
     /* Disconnect the pipes */
     if (Ccb->OtherSide)
     {
     /* Disconnect the pipes */
     if (Ccb->OtherSide)
     {
-        ASSERT(Ccb->OtherSide->OtherSide == Ccb);
+        /* FIXME: Timo wants it rewritten */
+        /*ASSERT(Ccb->OtherSide->OtherSide == Ccb);*/
         NpfsCcbSetOtherSide(Ccb->OtherSide, NULL);
         NpfsCcbSetOtherSide(Ccb, NULL);
     }
         NpfsCcbSetOtherSide(Ccb->OtherSide, NULL);
         NpfsCcbSetOtherSide(Ccb, NULL);
     }
index ced3628..53f60bf 100644 (file)
@@ -662,14 +662,14 @@ DriverEntry(
   EntityMax   = MAX_TDI_ENTITIES;
 
   /* Allocate NDIS packet descriptors */
   EntityMax   = MAX_TDI_ENTITIES;
 
   /* Allocate NDIS packet descriptors */
-  NdisAllocatePacketPool(&NdisStatus, &GlobalPacketPool, 100, sizeof(PACKET_CONTEXT));
+  NdisAllocatePacketPoolEx(&NdisStatus, &GlobalPacketPool, 500, 1500, sizeof(PACKET_CONTEXT));
   if (NdisStatus != NDIS_STATUS_SUCCESS) {
     TiUnload(DriverObject);
     return STATUS_INSUFFICIENT_RESOURCES;
   }
 
   /* Allocate NDIS buffer descriptors */
   if (NdisStatus != NDIS_STATUS_SUCCESS) {
     TiUnload(DriverObject);
     return STATUS_INSUFFICIENT_RESOURCES;
   }
 
   /* Allocate NDIS buffer descriptors */
-  NdisAllocateBufferPool(&NdisStatus, &GlobalBufferPool, 100);
+  NdisAllocateBufferPool(&NdisStatus, &GlobalBufferPool, 2000);
   if (NdisStatus != NDIS_STATUS_SUCCESS) {
     TiUnload(DriverObject);
     return STATUS_INSUFFICIENT_RESOURCES;
   if (NdisStatus != NDIS_STATUS_SUCCESS) {
     TiUnload(DriverObject);
     return STATUS_INSUFFICIENT_RESOURCES;
index a7908ef..4752068 100644 (file)
@@ -293,6 +293,9 @@ VOID ProcessFragment(
     TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n"));
     /* We have a reassembly structure */
     TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql);
     TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n"));
     /* We have a reassembly structure */
     TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql);
+      
+    /* Reset the timeout since we received a fragment */
+    IPDR->TimeoutCount = 0;
   } else {
     TI_DbgPrint(DEBUG_IP, ("Starting new assembly.\n"));
 
   } else {
     TI_DbgPrint(DEBUG_IP, ("Starting new assembly.\n"));
 
index 2454657..fde2711 100644 (file)
@@ -78,25 +78,36 @@ NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog ) {
     TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n",
     Connection->SocketContext));
 
     TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n",
     Connection->SocketContext));
 
-    AddressToBind.sin_family = AF_INET;
-    memcpy( &AddressToBind.sin_addr,
-        &Connection->AddressFile->Address.Address.IPv4Address,
-        sizeof(AddressToBind.sin_addr) );
-    AddressToBind.sin_port = Connection->AddressFile->Port;
-
-    TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port));
+    if (Connection->AddressFile->Port)
+    {
+        AddressToBind.sin_family = AF_INET;
+        memcpy( &AddressToBind.sin_addr,
+               &Connection->AddressFile->Address.Address.IPv4Address,
+               sizeof(AddressToBind.sin_addr) );
+        AddressToBind.sin_port = Connection->AddressFile->Port;
+        TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port));
+
+        /* Perform an explicit bind */
+        Status = TCPTranslateError(OskitTCPBind(Connection->SocketContext,
+                                                &AddressToBind,
+                                                sizeof(AddressToBind)));
+    }
+    else
+    {
+        /* An implicit bind will be performed */
+        Status = STATUS_SUCCESS;
+    }
 
 
-    Status = TCPTranslateError( OskitTCPBind( Connection->SocketContext,
-                        &AddressToBind,
-                        sizeof(AddressToBind) ) );
+    if (NT_SUCCESS(Status))
+        Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) );
+    
     if (NT_SUCCESS(Status))
     {
         /* Check if we had an unspecified port */
         if (!Connection->AddressFile->Port)
         {
             /* We did, so we need to copy back the port */
     if (NT_SUCCESS(Status))
     {
         /* Check if we had an unspecified port */
         if (!Connection->AddressFile->Port)
         {
             /* We did, so we need to copy back the port */
-            Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
-            if (NT_SUCCESS(Status))
+            if (NT_SUCCESS(TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE)))
             {
                 /* Allocate the port in the port bitmap */
                 Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
             {
                 /* Allocate the port in the port bitmap */
                 Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
@@ -107,9 +118,6 @@ NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog ) {
         }
     }
 
         }
     }
 
-    if (NT_SUCCESS(Status))
-        Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) );
-
     UnlockObject(Connection, OldIrql);
 
     TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status));
     UnlockObject(Connection, OldIrql);
 
     TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status));
index 7fac625..7b25adb 100644 (file)
@@ -723,7 +723,7 @@ NTSTATUS TCPConnect
     USHORT RemotePort;
     TA_IP_ADDRESS LocalAddress;
     PTDI_BUCKET Bucket;
     USHORT RemotePort;
     TA_IP_ADDRESS LocalAddress;
     PTDI_BUCKET Bucket;
-    PNEIGHBOR_CACHE_ENTRY NCE;
+    PNEIGHBOR_CACHE_ENTRY NCE = NULL;
     KIRQL OldIrql;
 
     TI_DbgPrint(DEBUG_TCP,("TCPConnect: Called\n"));
     KIRQL OldIrql;
 
     TI_DbgPrint(DEBUG_TCP,("TCPConnect: Called\n"));
@@ -762,37 +762,36 @@ NTSTATUS TCPConnect
             UnlockObject(Connection, OldIrql);
             return STATUS_NETWORK_UNREACHABLE;
         }
             UnlockObject(Connection, OldIrql);
             return STATUS_NETWORK_UNREACHABLE;
         }
+    }
 
 
-        AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
+    if (Connection->AddressFile->Port)
+    {
+        /* See if we had an unspecified bind address */
+        if (NCE)
+        {
+            /* We did, so use the interface unicast address associated with the route */
+            AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
+        }
+        else
+        {
+            /* Bind address was explicit so use it */
+            AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address;
+        }
+        
+        AddressToBind.sin_port = Connection->AddressFile->Port;
+        
+        /* Perform an explicit bind */
+        Status = TCPTranslateError(OskitTCPBind(Connection->SocketContext,
+                                                &AddressToBind,
+                                                sizeof(AddressToBind)));
     }
     else
     {
     }
     else
     {
-        AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address;
+        /* An implicit bind will be performed */
+        Status = STATUS_SUCCESS;
     }
     }
-    
-    AddressToBind.sin_port = Connection->AddressFile->Port;
-
-    Status = TCPTranslateError
-        ( OskitTCPBind( Connection->SocketContext,
-                        &AddressToBind,
-                        sizeof(AddressToBind) ) );
 
 
-    if (NT_SUCCESS(Status)) {
-        /* Check if we had an unspecified port */
-        if (!Connection->AddressFile->Port)
-        {
-            /* We did, so we need to copy back the port */
-            Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
-            if (NT_SUCCESS(Status))
-            {
-                /* Allocate the port in the port bitmap */
-                Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
-                    
-                /* This should never fail */
-                ASSERT(Connection->AddressFile->Port != 0xFFFF);
-            }
-        }
-        
+    if (NT_SUCCESS(Status)) {        
         if (NT_SUCCESS(Status))
         {
             memcpy( &AddressToConnect.sin_addr,
         if (NT_SUCCESS(Status))
         {
             memcpy( &AddressToConnect.sin_addr,
@@ -804,7 +803,31 @@ NTSTATUS TCPConnect
             ( OskitTCPConnect( Connection->SocketContext,
                               &AddressToConnect,
                               sizeof(AddressToConnect) ) );
             ( OskitTCPConnect( Connection->SocketContext,
                               &AddressToConnect,
                               sizeof(AddressToConnect) ) );
-            
+
+            if (NT_SUCCESS(Status))
+            {
+                /* Check if we had an unspecified port */
+                if (!Connection->AddressFile->Port)
+                {
+                    /* We did, so we need to copy back the port */
+                    if (NT_SUCCESS(TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE)))
+                    {
+                        /* Allocate the port in the port bitmap */
+                        Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
+
+                        /* This should never fail */
+                        ASSERT(Connection->AddressFile->Port != 0xFFFF);
+                    }
+                }
+                
+                /* Check if the address was unspecified */
+                if (AddrIsUnspecified(&Connection->AddressFile->Address))
+                {
+                    /* It is, so store the address of the outgoing NIC */
+                    Connection->AddressFile->Address = NCE->Interface->Unicast;
+                }
+            }
+
             if (Status == STATUS_PENDING)
             {
                 Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG );
             if (Status == STATUS_PENDING)
             {
                 Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG );
index eec3361..a704e2a 100644 (file)
@@ -1119,10 +1119,6 @@ BOOLEAN
 NTAPI
 MmIsDirtyPageRmap(PFN_NUMBER Page);
 
 NTAPI
 MmIsDirtyPageRmap(PFN_NUMBER Page);
 
-NTSTATUS
-NTAPI
-MmWritePagePhysicalAddress(PFN_NUMBER Page);
-
 NTSTATUS
 NTAPI
 MmPageOutPhysicalAddress(PFN_NUMBER Page);
 NTSTATUS
 NTAPI
 MmPageOutPhysicalAddress(PFN_NUMBER Page);
index 79b4ab7..a95aee9 100644 (file)
@@ -850,7 +850,6 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
       DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status);
       return(Status);
    }
       DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status);
       return(Status);
    }
-   DeviceNode->ServiceName = ServiceName;
 
    /*
     * Initialize the driver
 
    /*
     * Initialize the driver
@@ -1834,8 +1833,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
       cur--;
    }
 
       cur--;
    }
 
-   IopDisplayLoadingMessage(&ServiceName);
-
    /*
     * Get service type.
     */
    /*
     * Get service type.
     */
@@ -1882,21 +1879,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
    DPRINT("FullImagePath: '%wZ'\n", &ImagePath);
    DPRINT("Type: %lx\n", Type);
 
    DPRINT("FullImagePath: '%wZ'\n", &ImagePath);
    DPRINT("Type: %lx\n", Type);
 
-   /*
-    * Create device node
-    */
-
-   /* Use IopRootDeviceNode for now */
-   Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode);
-
-   if (!NT_SUCCESS(Status))
-   {
-      DPRINT("IopCreateDeviceNode() failed (Status %lx)\n", Status);
-      LoadParams->Status = Status;
-      (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
-      return;
-   }
-
    /* Get existing DriverObject pointer (in case the driver has
       already been loaded and initialized) */
    Status = IopGetDriverObject(
    /* Get existing DriverObject pointer (in case the driver has
       already been loaded and initialized) */
    Status = IopGetDriverObject(
@@ -1916,23 +1898,29 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
        if (!NT_SUCCESS(Status) && Status != STATUS_IMAGE_ALREADY_LOADED)
        {
            DPRINT("MmLoadSystemImage() failed (Status %lx)\n", Status);
        if (!NT_SUCCESS(Status) && Status != STATUS_IMAGE_ALREADY_LOADED)
        {
            DPRINT("MmLoadSystemImage() failed (Status %lx)\n", Status);
-           IopFreeDeviceNode(DeviceNode);
            LoadParams->Status = Status;
            (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
            return;
        }
 
            LoadParams->Status = Status;
            (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
            return;
        }
 
-       /*
-        * Set a service name for the device node
-        */
-
-       RtlCreateUnicodeString(&DeviceNode->ServiceName, ServiceName.Buffer);
-
        /*
         * Initialize the driver module if it's loaded for the first time
         */
        if (Status != STATUS_IMAGE_ALREADY_LOADED)
        {
        /*
         * Initialize the driver module if it's loaded for the first time
         */
        if (Status != STATUS_IMAGE_ALREADY_LOADED)
        {
+           Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode);
+
+           if (!NT_SUCCESS(Status))
+           {
+               DPRINT("IopCreateDeviceNode() failed (Status %lx)\n", Status);
+               MmUnloadSystemImage(ModuleObject);
+               LoadParams->Status = Status;
+               (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
+               return;
+           }
+
+           IopDisplayLoadingMessage(&DeviceNode->ServiceName);
+
            Status = IopInitializeDriverModule(
                DeviceNode,
                ModuleObject,
            Status = IopInitializeDriverModule(
                DeviceNode,
                ModuleObject,
@@ -1950,11 +1938,11 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
                (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
                return;
            }
                (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
                return;
            }
+           
+           /* Initialize and start device */
+           IopInitializeDevice(DeviceNode, DriverObject);
+           Status = IopStartDevice(DeviceNode);
        }
        }
-
-       /* Initialize and start device */
-       IopInitializeDevice(DeviceNode, DriverObject);
-       Status = IopStartDevice(DeviceNode);
    }
    else
    {
    }
    else
    {
@@ -1962,9 +1950,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
 
       /* IopGetDriverObject references the DriverObject, so dereference it */
       ObDereferenceObject(DriverObject);
 
       /* IopGetDriverObject references the DriverObject, so dereference it */
       ObDereferenceObject(DriverObject);
-
-      /* Free device node since driver loading failed */
-      IopFreeDeviceNode(DeviceNode);
    }
 
    /* Pass status to the caller and signal the event */
    }
 
    /* Pass status to the caller and signal the event */
index 3d4778b..9889009 100644 (file)
@@ -18,8 +18,6 @@
 
 /* GLOBALS ******************************************************************/
 
 
 /* GLOBALS ******************************************************************/
 
-#define CURRENT_PROCESS ((HANDLE)~0)
-
 typedef struct _IMAGE_SYMBOL_INFO_CACHE
 {
     LIST_ENTRY ListEntry;
 typedef struct _IMAGE_SYMBOL_INFO_CACHE
 {
     LIST_ENTRY ListEntry;
@@ -637,69 +635,14 @@ KdbDebugPrint(
     /* Nothing here */
 }
 
     /* Nothing here */
 }
 
-typedef struct {
-    PMDL Mdl;
-    SIZE_T Size;
-    PVOID OriginalMapping;
-} KdbpMallocHeader;
-
-static PVOID KdbpSymAllocMem(ULONG_PTR Size)
+static PVOID KdbpSymAllocMem(ULONG_PTR size)
 {
 {
-    KdbpMallocHeader *Hdr;
-    if (Size < PAGE_SIZE)
-    {
-        PVOID Result = ExAllocatePoolWithTag(NonPagedPool, Size + sizeof(KdbpMallocHeader), 'RSYM');
-        if (!Result) return NULL;
-        Hdr = (KdbpMallocHeader*)Result;
-        Hdr->Mdl = NULL;
-        Hdr->Size = Size;
-        return &Hdr[1];
-    }
-    else
-    {
-        PVOID Base = NULL;
-        SIZE_T RegionSize = Size + sizeof(KdbpMallocHeader);
-        NTSTATUS Status = NtAllocateVirtualMemory
-            (CURRENT_PROCESS, &Base, 0, &RegionSize, MEM_COMMIT, PAGE_READWRITE);
-        if (!NT_SUCCESS(Status)) return NULL;
-        Hdr = (KdbpMallocHeader*)Base;
-        Hdr->Mdl = IoAllocateMdl(Base, RegionSize, FALSE, FALSE, NULL);
-        if (!Hdr->Mdl) {
-            NtFreeVirtualMemory(CURRENT_PROCESS, &Base, &RegionSize, MEM_RELEASE);
-            return NULL;
-        }
-        Hdr->Size = RegionSize;
-        Hdr->OriginalMapping = Base;
-        MmProbeAndLockPages(Hdr->Mdl, KernelMode, IoModifyAccess);
-        KdbpMallocHeader *MappedHdr = (KdbpMallocHeader*)MmMapLockedPages(Hdr->Mdl, KernelMode);
-        if (!MappedHdr) {
-            MmUnlockPages(Hdr->Mdl);
-            IoFreeMdl(Hdr->Mdl);
-            NtFreeVirtualMemory(CURRENT_PROCESS, &Base, &RegionSize, MEM_RELEASE);
-            return NULL;
-        }
-        return &MappedHdr[1];
-    }
+       return ExAllocatePoolWithTag(NonPagedPool, size, 'RSYM');
 }
 
 static VOID KdbpSymFreeMem(PVOID Area)
 {
 }
 
 static VOID KdbpSymFreeMem(PVOID Area)
 {
-    PCHAR HdrPtr = ((PCHAR)Area) - sizeof(KdbpMallocHeader);
-    KdbpMallocHeader *Hdr = (KdbpMallocHeader*)HdrPtr;
-    if (Hdr->Size < PAGE_SIZE)
-    {
-        ExFreePool(Hdr);
-    }
-    else
-    {
-        PMDL Mdl = Hdr->Mdl;
-        PVOID BaseAddress = Hdr->OriginalMapping;
-        SIZE_T RegionSize = Hdr->Size;
-        MmUnmapLockedPages(Hdr, Mdl);
-        MmUnlockPages(Mdl);
-        NtFreeVirtualMemory(CURRENT_PROCESS, &BaseAddress, &RegionSize, MEM_RELEASE);
-        IoFreeMdl(Mdl);
-    }
+       return ExFreePool(Area);
 }
 
 static BOOLEAN KdbpSymReadMem(PVOID FileContext, PVOID TargetDebug, PVOID SourceMem, ULONG Size)
 }
 
 static BOOLEAN KdbpSymReadMem(PVOID FileContext, PVOID TargetDebug, PVOID SourceMem, ULONG Size)
index 73d1cbc..9955e6d 100644 (file)
@@ -32,6 +32,8 @@ EXTERN _KiTrap02:PROC
 .data
 ASSUME nothing
 
 .data
 ASSUME nothing
 
+.align 16
+
 PUBLIC _KiIdt
 _KiIdt:
 /* This is the Software Interrupt Table that we handle in this file:        */
 PUBLIC _KiIdt
 _KiIdt:
 /* This is the Software Interrupt Table that we handle in this file:        */
index 766a8fc..70211e5 100644 (file)
 
 /* FUNCTIONS *****************************************************************/
 
 
 /* FUNCTIONS *****************************************************************/
 
-NTSTATUS
-NTAPI
-MmWritePageVirtualMemory(PMMSUPPORT AddressSpace,
-                         PMEMORY_AREA MemoryArea,
-                         PVOID Address,
-                         PMM_PAGEOP PageOp)
-{
-   SWAPENTRY SwapEntry;
-   PFN_NUMBER Page;
-   NTSTATUS Status;
-   PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
-
-   /*
-    * Check for paging out from a deleted virtual memory area.
-    */
-   if (MemoryArea->DeleteInProgress)
-   {
-      PageOp->Status = STATUS_UNSUCCESSFUL;
-      KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
-      MmReleasePageOp(PageOp);
-      return(STATUS_UNSUCCESSFUL);
-   }
-
-   Page = MmGetPfnForProcess(Process, Address);
-
-   /*
-    * Get that the page actually is dirty.
-    */
-   if (!MmIsDirtyPage(Process, Address))
-   {
-      PageOp->Status = STATUS_SUCCESS;
-      KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
-      MmReleasePageOp(PageOp);
-      return(STATUS_SUCCESS);
-   }
-
-   /*
-    * Speculatively set the mapping to clean.
-    */
-   MmSetCleanPage(Process, Address);
-
-   /*
-    * If necessary, allocate an entry in the paging file for this page
-    */
-   SwapEntry = MmGetSavedSwapEntryPage(Page);
-   if (SwapEntry == 0)
-   {
-      SwapEntry = MmAllocSwapPage();
-      if (SwapEntry == 0)
-      {
-         MmSetDirtyPage(Process, Address);
-         PageOp->Status = STATUS_PAGEFILE_QUOTA_EXCEEDED;
-         KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
-         MmReleasePageOp(PageOp);
-         return(STATUS_PAGEFILE_QUOTA_EXCEEDED);
-      }
-   }
-
-   /*
-    * Write the page to the pagefile
-    */
-   Status = MmWriteToSwapPage(SwapEntry, Page);
-   if (!NT_SUCCESS(Status))
-   {
-      DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n",
-              Status);
-      MmSetDirtyPage(Process, Address);
-      PageOp->Status = STATUS_UNSUCCESSFUL;
-      KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
-      MmReleasePageOp(PageOp);
-      return(STATUS_UNSUCCESSFUL);
-   }
-
-   /*
-    * Otherwise we have succeeded.
-    */
-   MmSetSavedSwapEntryPage(Page, SwapEntry);
-   PageOp->Status = STATUS_SUCCESS;
-   KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
-   MmReleasePageOp(PageOp);
-   return(STATUS_SUCCESS);
-}
-
 NTSTATUS
 NTAPI
 MmPageOutVirtualMemory(PMMSUPPORT AddressSpace,
 NTSTATUS
 NTAPI
 MmPageOutVirtualMemory(PMMSUPPORT AddressSpace,
index 9ae543b..5831932 100644 (file)
@@ -16,7 +16,7 @@ UCHAR Win32kSSPT[] = {
 #include "w32ksvc.h"
 };
 
 #include "w32ksvc.h"
 };
 
-#define MIN_SYSCALL_NUMBER    0
+#define MIN_SYSCALL_NUMBER    0x1000
 #define NUMBER_OF_SYSCALLS    (sizeof(Win32kSSPT) / sizeof(Win32kSSPT[0]))
 #define NUMBER_OF_SYSCALLS    (sizeof(Win32kSSPT) / sizeof(Win32kSSPT[0]))
-#define MAX_SYSCALL_NUMBER    (NUMBER_OF_SYSCALLS - 1)
+#define MAX_SYSCALL_NUMBER    0x1000 + (NUMBER_OF_SYSCALLS - 1)
 ULONG Win32kNumberOfSysCalls = NUMBER_OF_SYSCALLS;
 ULONG Win32kNumberOfSysCalls = NUMBER_OF_SYSCALLS;