mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:53:05 +00:00
Changed data structure which represents driver objects from MODULE_OBJECT to DRIVER_OBJECT.
Now a DriverEntry's RegistryPath string is usable automagically. svn path=/trunk/; revision=3044
This commit is contained in:
parent
0ddc3e2715
commit
6ac81e7954
5 changed files with 114 additions and 131 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: io.h,v 1.20 2002/06/10 08:46:06 ekohl Exp $
|
/* $Id: io.h,v 1.21 2002/06/10 23:02:44 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -250,9 +250,10 @@ IopInterrogateBusExtender(PDEVICE_NODE DeviceNode,
|
||||||
BOOLEAN BootDriversOnly);
|
BOOLEAN BootDriversOnly);
|
||||||
VOID
|
VOID
|
||||||
IopLoadBootStartDrivers(VOID);
|
IopLoadBootStartDrivers(VOID);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject);
|
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
|
||||||
|
PUNICODE_STRING ServiceName,
|
||||||
|
BOOLEAN FileSystem);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
|
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: device.c,v 1.42 2002/06/10 08:47:20 ekohl Exp $
|
/* $Id: device.c,v 1.43 2002/06/10 23:03:33 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -228,30 +228,67 @@ IopDefaultDispatchFunction(PDEVICE_OBJECT DeviceObject,
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject)
|
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
|
||||||
|
PUNICODE_STRING ServiceName,
|
||||||
|
BOOLEAN FileSystem)
|
||||||
{
|
{
|
||||||
PDRIVER_OBJECT Object;
|
PDRIVER_OBJECT Object;
|
||||||
|
HANDLE DriverHandle = 0;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
WCHAR NameBuffer[MAX_PATH];
|
||||||
|
UNICODE_STRING DriverName;
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
Object = ExAllocatePoolWithTag(NonPagedPool,
|
DPRINT1("IopCreateDriverObject(%p '%wZ' %x)\n", DriverObject, ServiceName, FileSystem);
|
||||||
sizeof(DRIVER_OBJECT),
|
|
||||||
TAG_DRIVER);
|
*DriverObject = NULL;
|
||||||
if (Object == NULL)
|
|
||||||
|
/* Create ModuleName string */
|
||||||
|
if (ServiceName != NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
if (FileSystem)
|
||||||
|
wcscpy(NameBuffer, FILESYSTEM_ROOT_NAME);
|
||||||
|
else
|
||||||
|
wcscpy(NameBuffer, DRIVER_ROOT_NAME);
|
||||||
|
wcscat(NameBuffer, ServiceName->Buffer);
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&DriverName,
|
||||||
|
NameBuffer);
|
||||||
|
DPRINT1("Driver name: '%wZ'\n", &DriverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Object, sizeof(DRIVER_OBJECT));
|
/* Initialize ObjectAttributes for ModuleObject */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
(ServiceName != NULL)? &DriverName : NULL,
|
||||||
|
OBJ_PERMANENT,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Create module object */
|
||||||
|
Status = ObCreateObject(&DriverHandle,
|
||||||
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
|
&ObjectAttributes,
|
||||||
|
IoDriverObjectType,
|
||||||
|
(PVOID*)&Object);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
NtClose(DriverHandle);
|
||||||
|
|
||||||
|
/* Create driver extension */
|
||||||
Object->DriverExtension = (PDRIVER_EXTENSION)
|
Object->DriverExtension = (PDRIVER_EXTENSION)
|
||||||
ExAllocatePoolWithTag(NonPagedPool,
|
ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(DRIVER_EXTENSION),
|
sizeof(DRIVER_EXTENSION),
|
||||||
TAG_DRIVER_EXTENSION);
|
TAG_DRIVER_EXTENSION);
|
||||||
if (Object->DriverExtension == NULL)
|
if (Object->DriverExtension == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool(Object);
|
ExFreePool(Object);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
|
RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
|
||||||
|
@ -260,7 +297,7 @@ IopCreateDriverObject(PDRIVER_OBJECT *DriverObject)
|
||||||
|
|
||||||
for (i=0; i<=IRP_MJ_MAXIMUM_FUNCTION; i++)
|
for (i=0; i<=IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||||
{
|
{
|
||||||
Object->MajorFunction[i] = (PDRIVER_DISPATCH) IopDefaultDispatchFunction;
|
Object->MajorFunction[i] = (PDRIVER_DISPATCH) IopDefaultDispatchFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
*DriverObject = Object;
|
*DriverObject = Object;
|
||||||
|
@ -465,7 +502,7 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
DPRINT("IopInitializeDriver(DriverEntry %08lx, DeviceNode %08lx)\n",
|
DPRINT("IopInitializeDriver(DriverEntry %08lx, DeviceNode %08lx)\n",
|
||||||
DriverEntry, DeviceNode);
|
DriverEntry, DeviceNode);
|
||||||
|
|
||||||
Status = IopCreateDriverObject(&DriverObject);
|
Status = IopCreateDriverObject(&DriverObject, &DeviceNode->ServiceName, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: driver.c,v 1.1 2002/06/10 08:47:21 ekohl Exp $
|
/* $Id: driver.c,v 1.2 2002/06/10 23:03:33 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -61,13 +61,13 @@ IopInitDriverImplementation(VOID)
|
||||||
{
|
{
|
||||||
/* Register the process object type */
|
/* Register the process object type */
|
||||||
IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
||||||
IoDriverObjectType->Tag = TAG('D', 'R', 'V', 'T');
|
IoDriverObjectType->Tag = TAG('D', 'R', 'V', 'R');
|
||||||
IoDriverObjectType->TotalObjects = 0;
|
IoDriverObjectType->TotalObjects = 0;
|
||||||
IoDriverObjectType->TotalHandles = 0;
|
IoDriverObjectType->TotalHandles = 0;
|
||||||
IoDriverObjectType->MaxObjects = ULONG_MAX;
|
IoDriverObjectType->MaxObjects = ULONG_MAX;
|
||||||
IoDriverObjectType->MaxHandles = ULONG_MAX;
|
IoDriverObjectType->MaxHandles = ULONG_MAX;
|
||||||
IoDriverObjectType->PagedPoolCharge = 0;
|
IoDriverObjectType->PagedPoolCharge = 0;
|
||||||
IoDriverObjectType->NonpagedPoolCharge = sizeof(MODULE);
|
IoDriverObjectType->NonpagedPoolCharge = sizeof(DRIVER_OBJECT);
|
||||||
IoDriverObjectType->Dump = NULL;
|
IoDriverObjectType->Dump = NULL;
|
||||||
IoDriverObjectType->Open = NULL;
|
IoDriverObjectType->Open = NULL;
|
||||||
IoDriverObjectType->Close = NULL;
|
IoDriverObjectType->Close = NULL;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pnpmgr.c,v 1.4 2001/09/16 13:19:32 chorns Exp $
|
/* $Id: pnpmgr.c,v 1.5 2002/06/10 23:03:33 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1160,7 +1160,7 @@ VOID PnpInit(VOID)
|
||||||
|
|
||||||
KeInitializeSpinLock(&IopDeviceTreeLock);
|
KeInitializeSpinLock(&IopDeviceTreeLock);
|
||||||
|
|
||||||
Status = IopCreateDriverObject(&IopRootDriverObject);
|
Status = IopCreateDriverObject(&IopRootDriverObject, NULL, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
CPRINT("IoCreateDriverObject() failed\n");
|
CPRINT("IoCreateDriverObject() failed\n");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: loader.c,v 1.106 2002/06/10 08:50:29 ekohl Exp $
|
/* $Id: loader.c,v 1.107 2002/06/10 23:04:48 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -176,47 +176,17 @@ LdrInitModuleManagement(VOID)
|
||||||
{
|
{
|
||||||
PIMAGE_DOS_HEADER DosHeader;
|
PIMAGE_DOS_HEADER DosHeader;
|
||||||
PMODULE_OBJECT ModuleObject;
|
PMODULE_OBJECT ModuleObject;
|
||||||
#if 0
|
|
||||||
HANDLE ModuleHandle;
|
|
||||||
NTSTATUS Status;
|
|
||||||
WCHAR NameBuffer[60];
|
|
||||||
UNICODE_STRING ModuleName;
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize the module list and spinlock */
|
/* Initialize the module list and spinlock */
|
||||||
InitializeListHead(&ModuleListHead);
|
InitializeListHead(&ModuleListHead);
|
||||||
KeInitializeSpinLock(&ModuleListLock);
|
KeInitializeSpinLock(&ModuleListLock);
|
||||||
|
|
||||||
/* Create module object for NTOSKRNL */
|
/* Create module object for NTOSKRNL */
|
||||||
#if 0
|
|
||||||
wcscpy(NameBuffer, DRIVER_ROOT_NAME);
|
|
||||||
wcscat(NameBuffer, KERNEL_MODULE_NAME);
|
|
||||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
|
||||||
DPRINT("Kernel's Module name is: %wZ\n", &ModuleName);
|
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for ModuleObject */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&ModuleName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Create module object */
|
|
||||||
ModuleHandle = 0;
|
|
||||||
Status = ObCreateObject(&ModuleHandle,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
&ObjectAttributes,
|
|
||||||
IoDriverObjectType,
|
|
||||||
(PVOID*)&ModuleObject);
|
|
||||||
assert(NT_SUCCESS(Status));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ModuleObject = ExAllocatePool(NonPagedPool, sizeof(MODULE_OBJECT));
|
ModuleObject = ExAllocatePool(NonPagedPool, sizeof(MODULE_OBJECT));
|
||||||
assert(ModuleObject != NULL);
|
assert(ModuleObject != NULL);
|
||||||
RtlZeroMemory(ModuleObject, sizeof(MODULE_OBJECT));
|
RtlZeroMemory(ModuleObject, sizeof(MODULE_OBJECT));
|
||||||
|
|
||||||
/* Initialize ModuleObject data */
|
/* Initialize ModuleObject data */
|
||||||
ModuleObject->Base = (PVOID) KERNEL_BASE;
|
ModuleObject->Base = (PVOID) KERNEL_BASE;
|
||||||
ModuleObject->Flags = MODULE_FLAG_PE;
|
ModuleObject->Flags = MODULE_FLAG_PE;
|
||||||
RtlCreateUnicodeString(&ModuleObject->FullName,
|
RtlCreateUnicodeString(&ModuleObject->FullName,
|
||||||
|
@ -242,34 +212,11 @@ LdrInitModuleManagement(VOID)
|
||||||
&ModuleObject->ListEntry);
|
&ModuleObject->ListEntry);
|
||||||
|
|
||||||
/* Create module object for HAL */
|
/* Create module object for HAL */
|
||||||
#if 0
|
|
||||||
wcscpy(NameBuffer, DRIVER_ROOT_NAME);
|
|
||||||
wcscat(NameBuffer, HAL_MODULE_NAME);
|
|
||||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
|
||||||
DPRINT("HAL's Module name is: %wZ\n", &ModuleName);
|
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for ModuleObject */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&ModuleName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Create module object */
|
|
||||||
ModuleHandle = 0;
|
|
||||||
Status = ObCreateObject(&ModuleHandle,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
&ObjectAttributes,
|
|
||||||
IoDriverObjectType,
|
|
||||||
(PVOID*)&ModuleObject);
|
|
||||||
assert(NT_SUCCESS(Status));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ModuleObject = ExAllocatePool(NonPagedPool, sizeof(MODULE_OBJECT));
|
ModuleObject = ExAllocatePool(NonPagedPool, sizeof(MODULE_OBJECT));
|
||||||
assert(ModuleObject != NULL);
|
assert(ModuleObject != NULL);
|
||||||
RtlZeroMemory(ModuleObject, sizeof(MODULE_OBJECT));
|
RtlZeroMemory(ModuleObject, sizeof(MODULE_OBJECT));
|
||||||
|
|
||||||
/* Initialize ModuleObject data */
|
/* Initialize ModuleObject data */
|
||||||
ModuleObject->Base = (PVOID) LdrHalBase;
|
ModuleObject->Base = (PVOID) LdrHalBase;
|
||||||
ModuleObject->Flags = MODULE_FLAG_PE;
|
ModuleObject->Flags = MODULE_FLAG_PE;
|
||||||
|
|
||||||
|
@ -1044,7 +991,12 @@ LdrInitializeBootStartDriver(PVOID ModuleLoadBase,
|
||||||
PDEVICE_NODE DeviceNode;
|
PDEVICE_NODE DeviceNode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
CHAR Buffer [256];
|
WCHAR Buffer[MAX_PATH];
|
||||||
|
ULONG Length;
|
||||||
|
LPWSTR Start;
|
||||||
|
LPWSTR Ext;
|
||||||
|
|
||||||
|
CHAR TextBuffer [256];
|
||||||
ULONG x, y, cx, cy;
|
ULONG x, y, cx, cy;
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef KDBG
|
||||||
|
@ -1056,14 +1008,14 @@ LdrInitializeBootStartDriver(PVOID ModuleLoadBase,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HalQueryDisplayParameters(&x, &y, &cx, &cy);
|
HalQueryDisplayParameters(&x, &y, &cx, &cy);
|
||||||
RtlFillMemory(Buffer, x, ' ');
|
RtlFillMemory(TextBuffer, x, ' ');
|
||||||
Buffer[x] = '\0';
|
TextBuffer[x] = '\0';
|
||||||
HalSetDisplayParameters(0, y-1);
|
HalSetDisplayParameters(0, y-1);
|
||||||
HalDisplayString(Buffer);
|
HalDisplayString(TextBuffer);
|
||||||
|
|
||||||
sprintf(Buffer, "Initializing %s...\n", FileName);
|
sprintf(TextBuffer, "Initializing %s...\n", FileName);
|
||||||
HalSetDisplayParameters(0, y-1);
|
HalSetDisplayParameters(0, y-1);
|
||||||
HalDisplayString(Buffer);
|
HalDisplayString(TextBuffer);
|
||||||
HalSetDisplayParameters(cx, cy);
|
HalSetDisplayParameters(cx, cy);
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef KDBG
|
||||||
|
@ -1136,6 +1088,24 @@ LdrInitializeBootStartDriver(PVOID ModuleLoadBase,
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Get the service name from the module name */
|
||||||
|
Start = wcsrchr(ModuleObject->BaseName.Buffer, L'\\');
|
||||||
|
if (Start == NULL)
|
||||||
|
Start = ModuleObject->BaseName.Buffer;
|
||||||
|
else
|
||||||
|
Start++;
|
||||||
|
|
||||||
|
Ext = wcsrchr(ModuleObject->BaseName.Buffer, L'.');
|
||||||
|
if (Ext != NULL)
|
||||||
|
Length = Ext - Start;
|
||||||
|
else
|
||||||
|
Length = wcslen(Start);
|
||||||
|
|
||||||
|
wcsncpy(Buffer, Start, Length);
|
||||||
|
RtlInitUnicodeString(&DeviceNode->ServiceName, Buffer);
|
||||||
|
|
||||||
|
|
||||||
Status = IopInitializeDriver(ModuleObject->EntryPoint, DeviceNode);
|
Status = IopInitializeDriver(ModuleObject->EntryPoint, DeviceNode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -1392,14 +1362,12 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||||
PRELOCATION_DIRECTORY RelocDir;
|
PRELOCATION_DIRECTORY RelocDir;
|
||||||
PRELOCATION_ENTRY RelocEntry;
|
PRELOCATION_ENTRY RelocEntry;
|
||||||
PMODULE_OBJECT LibraryModuleObject;
|
PMODULE_OBJECT LibraryModuleObject;
|
||||||
HANDLE ModuleHandle;
|
|
||||||
PMODULE_OBJECT CreatedModuleObject;
|
PMODULE_OBJECT CreatedModuleObject;
|
||||||
PVOID *ImportAddressList;
|
PVOID *ImportAddressList;
|
||||||
PULONG FunctionNameList;
|
PULONG FunctionNameList;
|
||||||
PCHAR pName;
|
PCHAR pName;
|
||||||
WORD Hint;
|
WORD Hint;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
UNICODE_STRING ModuleName;
|
||||||
UNICODE_STRING ModuleName;
|
|
||||||
WCHAR NameBuffer[60];
|
WCHAR NameBuffer[60];
|
||||||
MODULE_TEXT_SECTION* ModuleTextSection;
|
MODULE_TEXT_SECTION* ModuleTextSection;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -1654,37 +1622,14 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create ModuleName string */
|
/* Create the module */
|
||||||
wcscpy(NameBuffer, DRIVER_ROOT_NAME);
|
CreatedModuleObject = ExAllocatePool(NonPagedPool, sizeof(MODULE_OBJECT));
|
||||||
if (wcsrchr(FileName->Buffer, '\\') != 0)
|
if (CreatedModuleObject == NULL)
|
||||||
{
|
{
|
||||||
wcscat(NameBuffer, wcsrchr(FileName->Buffer, '\\') + 1);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
wcscat(NameBuffer, FileName->Buffer);
|
|
||||||
}
|
|
||||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
|
||||||
CPRINT("Module name is: %wZ\n", &ModuleName);
|
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for ModuleObject */
|
RtlZeroMemory(CreatedModuleObject, sizeof(MODULE_OBJECT));
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&ModuleName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Create module object */
|
|
||||||
ModuleHandle = 0;
|
|
||||||
Status = ObCreateObject(&ModuleHandle,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
&ObjectAttributes,
|
|
||||||
IoDriverObjectType,
|
|
||||||
(PVOID*)&CreatedModuleObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize ModuleObject data */
|
/* Initialize ModuleObject data */
|
||||||
CreatedModuleObject->Base = DriverBase;
|
CreatedModuleObject->Base = DriverBase;
|
||||||
|
@ -1695,7 +1640,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||||
LdrpBuildModuleBaseName(&CreatedModuleObject->BaseName,
|
LdrpBuildModuleBaseName(&CreatedModuleObject->BaseName,
|
||||||
&CreatedModuleObject->FullName);
|
&CreatedModuleObject->FullName);
|
||||||
|
|
||||||
CreatedModuleObject->EntryPoint = (PVOID) ((DWORD)DriverBase +
|
CreatedModuleObject->EntryPoint = (PVOID)((DWORD)DriverBase +
|
||||||
PEOptionalHeader->AddressOfEntryPoint);
|
PEOptionalHeader->AddressOfEntryPoint);
|
||||||
CreatedModuleObject->Length = DriverSize;
|
CreatedModuleObject->Length = DriverSize;
|
||||||
DPRINT("EntryPoint at %x\n", CreatedModuleObject->EntryPoint);
|
DPRINT("EntryPoint at %x\n", CreatedModuleObject->EntryPoint);
|
||||||
|
@ -1736,13 +1681,13 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||||
|
|
||||||
*ModuleObject = CreatedModuleObject;
|
*ModuleObject = CreatedModuleObject;
|
||||||
|
|
||||||
DPRINT("Loading Module %wZ...\n", FileName);
|
DPRINT("Loading Module %wZ...\n", FileName);
|
||||||
|
|
||||||
if ((KdDebuggerEnabled == TRUE) && (KdDebugState & KD_DEBUG_GDB))
|
if ((KdDebuggerEnabled == TRUE) && (KdDebugState & KD_DEBUG_GDB))
|
||||||
{
|
{
|
||||||
DbgPrint("Module %wZ loaded at 0x%.08x.\n",
|
DbgPrint("Module %wZ loaded at 0x%.08x.\n",
|
||||||
FileName, CreatedModuleObject->Base);
|
FileName, CreatedModuleObject->Base);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2050,15 +1995,15 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
|
||||||
FunctionList[Hint - ExportDir->Base]);
|
FunctionList[Hint - ExportDir->Base]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExportAddress == 0)
|
if (ExportAddress == 0)
|
||||||
{
|
{
|
||||||
CPRINT("Export not found for %d:%s\n",
|
CPRINT("Export not found for %d:%s\n",
|
||||||
Hint,
|
Hint,
|
||||||
Name != NULL ? Name : "(Ordinal)");
|
Name != NULL ? Name : "(Ordinal)");
|
||||||
KeBugCheck(0);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExportAddress;
|
return(ExportAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2114,10 +2059,10 @@ LdrSafePEGetExportAddress(PVOID ImportModuleBase,
|
||||||
|
|
||||||
if (ExportAddress == 0)
|
if (ExportAddress == 0)
|
||||||
{
|
{
|
||||||
ps("Export not found for %d:%s\n",
|
ps("Export not found for %d:%s\n",
|
||||||
Hint,
|
Hint,
|
||||||
Name != NULL ? Name : "(Ordinal)");
|
Name != NULL ? Name : "(Ordinal)");
|
||||||
for (;;);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
return ExportAddress;
|
return ExportAddress;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue