Changes to support the COFF driver loader

svn path=/trunk/; revision=144
This commit is contained in:
Rex Jolliff 1999-01-01 22:33:38 +00:00
parent 02e3d7b08e
commit 2d14c3e110
10 changed files with 511 additions and 454 deletions

View file

@ -1,66 +1,67 @@
//
// IDE.C - IDE Disk driver
// written by Rex Jolliff
// with help from various documentation sources and a few peeks at
// linux and freebsd sources.
//
// This driver supports up to 4 controllers with up to 2 drives each.
// The device names are assigned as follows:
// \Devices\HarddiskX\Partition0
// for the raw device, and
// \Devices\HarddiskX\PartitionY
// for partitions
// where:
// X is computed by counting the available drives from the following
// sequence: the controller number (0=0x1f0, 1=0x170, 2=0x1e8,
// 3=0x168) * 2 plus the drive number (0,1)
// Y is the partition number
//
// The driver exports the following function:
//
// DriverEntry() - NT device driver initialization routine
//
// And the following functions are exported implicitly:
//
// IDEStartIo() - called to start an I/O request packet
// IDEDispatchOpenClose() - Called to open/close the device. a NOOP
// IDEDispatchReadWrite() - Called to read/write the device.
// IDEDispatchQueryInformation() - Called to get device information
// IDEDispatchSetInformation() - Called to set device information
// IDEDispatchDeviceControl() - Called to execute device control requests
//
// Modification History:
// 05/25/98 RJJ Created.
// 05/30/98 RJJ Removed IRQ handler and inserted busy waits
// just to get something working...
// 07/18/98 RJJ Made drastic changes so that the driver
// resembles a WinNT driver.
// 08/05/98 RJJ Changed to .C extension
// 09/19/98 RJJ First release (run for cover!)
//
// Test List:
// 09/17/98 RJJ Pri/MST: 14.12X19 WDC AC31000H Test Passed
// Pri/SLV: None.
//
//
// To Do:
// FIXME: a timer should be used to watch for device timeouts and errors
// FIXME: errors should be retried
// FIXME: a drive reset/recalibrate should be attempted if errors occur
// FIXME: Use DMA for transfers if drives support it
// FIXME: should we support unloading of this driver???
// FIXME: the device information should come from AUTODETECT (via registry)
// FIXME: really big devices need to be handled correctly
// FIXME: should get device info from the registry
// FIXME: should report hardware usage to iomgr
// FIXME: finish implementation of QueryInformation
// FIXME: finish implementation of SetInformation
// FIXME: finish implementation of DeviceControl
// FIXME: bring up to ATA-3 spec
// FIXME: add general support for ATAPI devices
// FIXME: add support for ATAPI CDROMs
// FIXME: add support for ATAPI ZIP drives/RHDs
// FIXME: add support for ATAPI tape drives
/*
* IDE.C - IDE Disk driver
* written by Rex Jolliff
* with help from various documentation sources and a few peeks at
* linux and freebsd sources.
*
* This driver supports up to 4 controllers with up to 2 drives each.
* The device names are assigned as follows:
* \Devices\HarddiskX\Partition0
* for the raw device, and
* \Devices\HarddiskX\PartitionY
* for partitions
* where:
* X is computed by counting the available drives from the following
* sequence: the controller number (0=0x1f0, 1=0x170, 2=0x1e8,
* 3=0x168) * 2 plus the drive number (0,1)
* Y is the partition number
*
* The driver exports the following function:
*
* DriverEntry() - NT device driver initialization routine
*
* And the following functions are exported implicitly:
*
* IDEStartIo() - called to start an I/O request packet
* IDEDispatchOpenClose() - Called to open/close the device. a NOOP
* IDEDispatchReadWrite() - Called to read/write the device.
* IDEDispatchQueryInformation() - Called to get device information
* IDEDispatchSetInformation() - Called to set device information
* IDEDispatchDeviceControl() - Called to execute device control requests
*
* Modification History:
* 05/25/98 RJJ Created.
* 05/30/98 RJJ Removed IRQ handler and inserted busy waits
* just to get something working...
* 07/18/98 RJJ Made drastic changes so that the driver
* resembles a WinNT driver.
* 08/05/98 RJJ Changed to .C extension
* 09/19/98 RJJ First release (run for cover!)
*
* Test List:
* 09/17/98 RJJ Pri/MST: 14.12X19 WDC AC31000H Test Passed
* Pri/SLV: None.
*
*
* To Do:
* FIXME: a timer should be used to watch for device timeouts and errors
* FIXME: errors should be retried
* FIXME: a drive reset/recalibrate should be attempted if errors occur
* FIXME: Use DMA for transfers if drives support it
* FIXME: should we support unloading of this driver???
* FIXME: the device information should come from AUTODETECT (via registry)
* FIXME: really big devices need to be handled correctly
* FIXME: should get device info from the registry
* FIXME: should report hardware usage to iomgr
* FIXME: finish implementation of QueryInformation
* FIXME: finish implementation of SetInformation
* FIXME: finish implementation of DeviceControl
* FIXME: bring up to ATA-3 spec
* FIXME: add general support for ATAPI devices
* FIXME: add support for ATAPI CDROMs
* FIXME: add support for ATAPI ZIP drives/RHDs
* FIXME: add support for ATAPI tape drives
*/
#include <ddk/ntddk.h>

View file

@ -33,22 +33,28 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
ULONG sectorSize;
PULONG mbr;
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
pDeviceObject,DiskSector,Buffer);
SET_LARGE_INTEGER_LOW_PART(sectorNumber, DiskSector << 9);
SET_LARGE_INTEGER_HIGH_PART(sectorNumber, DiskSector >> 23);
KeInitializeEvent(&event, NotificationEvent, FALSE);
sectorSize = BLOCKSIZE * SectorCount;
/* FIXME: this routine does not need to alloc mem and copy */
mbr = ExAllocatePool(NonPagedPool, sectorSize);
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
pDeviceObject,
DiskSector,
Buffer);
DPRINT("sectorNumber %08lx:%08lx sectorSize %ld\n",
(unsigned long int)GET_LARGE_INTEGER_HIGH_PART(sectorNumber),
(unsigned long int)GET_LARGE_INTEGER_LOW_PART(sectorNumber),
sectorSize);
if (!mbr) {
return FALSE;
}
DPRINT("Building synchronous FSD Request...\n");
irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
pDeviceObject,

View file

@ -26,7 +26,7 @@
#include <wstring.h>
#include <ddk/cctypes.h>
//#define NDEBUG
#define NDEBUG
#include <internal/debug.h>
#include "vfat.h"
@ -668,18 +668,12 @@ NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
FileObject,
FileName);
CHECKPOINT;
string = FileName;
CHECKPOINT;
ParentFcb = NULL;
CHECKPOINT;
Fcb = ExAllocatePool(NonPagedPool, sizeof(FCB));
CHECKPOINT;
next = &string[0];
CHECKPOINT;
current = next+1;
CHECKPOINT;
while (next!=NULL)
{
DPRINT("current %w next %x\n",current,next);
@ -692,7 +686,6 @@ CHECKPOINT;
*next=0;
}
CHECKPOINT;
Status = FindFile(DeviceExt,Fcb,ParentFcb,current,NULL,NULL);
if (Status != STATUS_SUCCESS)
{
@ -709,7 +702,6 @@ CHECKPOINT;
Fcb = ParentFcb;
}
ParentFcb = Temp;
CHECKPOINT;
}
FileObject->FsContext = ParentFcb;
DPRINT("file opn, fcb=%x\n",ParentFcb);
@ -738,7 +730,8 @@ BOOLEAN FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
return(TRUE);
}
ExFreePool(Boot);
return(FALSE);
return FALSE;
}
NTSTATUS FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
@ -844,19 +837,37 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Temp;
ULONG TempLength;
/* PRECONDITION */
assert(DeviceExt != NULL);
assert(DeviceExt->BytesPerCluster != 0);
assert(FileObject != NULL);
assert(FileObject->FsContext != NULL);
DPRINT("FsdReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
"Length %d, ReadOffset %d)\n",DeviceExt,FileObject,Buffer,
Length,ReadOffset);
"Length %d, ReadOffset %d)\n",
DeviceExt,
FileObject,
Buffer,
Length,
ReadOffset);
DPRINT("DeviceExt->BytesPerCluster %d\n", DeviceExt->BytesPerCluster);
FirstCluster = ReadOffset / DeviceExt->BytesPerCluster;
Fcb = FileObject->FsContext;
if (DeviceExt->FatType == FAT32)
CurrentCluster = Fcb->entry.FirstCluster+Fcb->entry.FirstClusterHigh*65536;
{
CurrentCluster = Fcb->entry.FirstCluster +
Fcb->entry.FirstClusterHigh * 65536;
}
else
{
CurrentCluster = Fcb->entry.FirstCluster;
}
if (CurrentCluster < 2)
return STATUS_UNSUCCESSFUL;// FIXME : root of FAT16 ?
DPRINT("DeviceExt->BytesPerCluster %x\n",DeviceExt->BytesPerCluster);
{
/* FIXME : root of FAT16 ? */
return STATUS_UNSUCCESSFUL;
}
if (ReadOffset >= Fcb->entry.FileSize)
{
@ -868,11 +879,11 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
}
*LengthRead = 0;
Temp = ExAllocatePool(NonPagedPool,DeviceExt->BytesPerCluster);
/* FIXME: optimize by remembering the last cluster read and using if possible */
for (FileOffset=0; FileOffset < FirstCluster; FileOffset++)
{
CurrentCluster = GetNextCluster(DeviceExt,CurrentCluster);
}
CHECKPOINT;
if ((ReadOffset % DeviceExt->BytesPerCluster)!=0)
{
VFATLoadCluster(DeviceExt,Temp,CurrentCluster);
@ -888,7 +899,6 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
Length = Length - TempLength;
Buffer = Buffer + TempLength;
}
CHECKPOINT;
while (Length > DeviceExt->BytesPerCluster)
{
VFATLoadCluster(DeviceExt, Buffer, CurrentCluster);
@ -904,7 +914,6 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
Buffer = Buffer + DeviceExt->BytesPerCluster;
Length = Length - DeviceExt->BytesPerCluster;
}
CHECKPOINT;
if (Length > 0)
{
(*LengthRead) = (*LengthRead) + Length;
@ -1041,21 +1050,14 @@ NTSTATUS FsdCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Irp);
Stack = IoGetCurrentIrpStackLocation(Irp);
CHECKPOINT;
FileObject = Stack->FileObject;
CHECKPOINT;
DeviceExt = DeviceObject->DeviceExtension;
CHECKPOINT;
Status = FsdOpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer);
CHECKPOINT;
Irp->IoStatus.Status = Status;
CHECKPOINT;
Irp->IoStatus.Information = 0;
CHECKPOINT;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
CHECKPOINT;
return Status;
}
@ -1097,14 +1099,23 @@ NTSTATUS FsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
ULONG Length;
PVOID Buffer;
ULONG Offset;
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
PFILE_OBJECT FileObject = Stack->FileObject;
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
PIO_STACK_LOCATION Stack;
PFILE_OBJECT FileObject;
PDEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
ULONG LengthRead;
DPRINT("FsdRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
/* Precondition / Initialization */
assert(Irp != NULL);
Stack = IoGetCurrentIrpStackLocation(Irp);
assert(Stack != NULL);
FileObject = Stack->FileObject;
assert(FileObject != NULL);
DeviceExt = DeviceObject->DeviceExtension;
assert(DeviceExt != NULL);
Length = Stack->Parameters.Read.Length;
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
Offset = GET_LARGE_INTEGER_LOW_PART(Stack->Parameters.Read.ByteOffset);
@ -1143,7 +1154,8 @@ NTSTATUS FsdMount(PDEVICE_OBJECT DeviceToMount)
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject,
DeviceToMount);
return(STATUS_SUCCESS);
return STATUS_SUCCESS;
}
NTSTATUS FsdFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
@ -1156,7 +1168,9 @@ NTSTATUS FsdFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject;
NTSTATUS Status;
DPRINT("VFAT FSC\n");
DPRINT("FsdFileSystemControl(DevObj %08lx, Irp %08lx)\n", DeviceObject, Irp);
/* FIXME: should make sure that this is actually a mount request! */
if (FsdHasFileSystem(DeviceToMount))
{
@ -1182,9 +1196,17 @@ NTSTATUS FsdGetStandardInformation(PFCB FCB, PDEVICE_OBJECT DeviceObject,
* FUNCTION: Retrieve the standard file information
*/
{
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
PDEVICE_EXTENSION DeviceExtension;
unsigned long AllocSize;
DeviceExtension = DeviceObject->DeviceExtension;
/* PRECONDITION */
assert(DeviceExtension != NULL);
assert(DeviceExtension->BytesPerCluster != 0);
assert(StandardInfo != NULL);
assert(FCB != NULL);
RtlZeroMemory(StandardInfo, sizeof(FILE_STANDARD_INFORMATION));
/* Make allocsize a rounded up multiple of BytesPerCluster */
@ -1210,27 +1232,42 @@ NTSTATUS FsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
* FUNCTION: Retrieve the specified file information
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
FILE_INFORMATION_CLASS FileInformationClass =
Stack->Parameters.QueryFile.FileInformationClass;
PFILE_OBJECT FileObject = NULL;
PFCB FCB = NULL;
// PCCB CCB = NULL;
NTSTATUS RC = STATUS_SUCCESS;
NTSTATUS RC;
PIO_STACK_LOCATION Stack;
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
PFCB FCB;
// PCCB CCB;
void *SystemBuffer;
/* PRECONDITION */
assert(DeviceObject != NULL);
assert(Irp != NULL);
/* INITIALIZATION */
Stack = IoGetCurrentIrpStackLocation(Irp);
FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
FileObject = NULL;
FCB = NULL;
// PCCB CCB = NULL;
RC = STATUS_SUCCESS;
FileObject = Stack->FileObject;
// CCB = (PCCB)(FileObject->FsContext2);
// FCB = CCB->Buffer; // Should be CCB->FCB???
FCB = (PFCB)(FileObject->FsContext);
SystemBuffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
// SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
DPRINT("FsdQueryInformation(DevObj %08lx, Irp %08lx)\n", DeviceObject, Irp);
switch(FileInformationClass) {
case FileStandardInformation:
RC = FsdGetStandardInformation(FCB, DeviceObject, SystemBuffer);
break;
default:
RC = STATUS_INVALID_PARAMETER;
break;
}
return RC;
@ -1264,7 +1301,7 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT _DriverObject,
return(ret);
}
DeviceObject->Flags=0;
DeviceObject->Flags = DO_DIRECT_IO;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = FsdClose;
DriverObject->MajorFunction[IRP_MJ_CREATE] = FsdCreate;
DriverObject->MajorFunction[IRP_MJ_READ] = FsdRead;

View file

@ -83,6 +83,7 @@ PIRP IoBuildFilesystemControlRequest(ULONG MinorFunction,
StackPtr->Control = 0;
StackPtr->DeviceObject = DeviceObject;
StackPtr->FileObject = NULL;
StackPtr->CompletionRoutine = NULL;
switch(MinorFunction)
{
@ -144,6 +145,7 @@ PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
StackPtr->Control = 0;
StackPtr->DeviceObject = DeviceObject;
StackPtr->FileObject = NULL;
StackPtr->CompletionRoutine = NULL;
StackPtr->Parameters.Write.Length = Length;
if (MajorFunction == IRP_MJ_READ || MajorFunction == IRP_MJ_WRITE)
@ -247,6 +249,7 @@ PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction,
IoFreeIrp(Irp);
return(NULL);
}
/* FIXME: should copy buffer in on other ops */
if (MajorFunction == IRP_MJ_WRITE)
{
RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, Buffer, Length);
@ -276,6 +279,7 @@ PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction,
StackPtr->Control = 0;
StackPtr->DeviceObject = DeviceObject;
StackPtr->FileObject = NULL;
StackPtr->CompletionRoutine = NULL;
StackPtr->Parameters.Write.Length = Length;
if (MajorFunction == IRP_MJ_READ)
{

View file

@ -17,7 +17,7 @@
#include <internal/string.h>
#include <wstring.h>
//#define NDEBUG
#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *************************************************************/

View file

@ -12,6 +12,7 @@
#include <ddk/ntddk.h>
#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/

View file

@ -155,7 +155,9 @@ NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject)
current_entry = current_entry->Flink;
}
}
CHECKPOINT;
KeReleaseSpinLock(&FileSystemListLock,oldlvl);
CHECKPOINT;
return(STATUS_UNRECOGNIZED_VOLUME);
}

View file

@ -33,7 +33,7 @@
#include <internal/io.h>
#include <ddk/ntddk.h>
//#define NDEBUG
#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS ****************************************************************/
@ -110,6 +110,7 @@ VOID IoInitializeIrp(PIRP Irp, USHORT PacketSize, CCHAR StackSize)
*/
{
assert(Irp != NULL);
memset(Irp,0,PacketSize);
Irp->StackCount=StackSize;
Irp->CurrentLocation=StackSize;
@ -193,7 +194,8 @@ PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota)
{
PIRP Irp;
DPRINT("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",StackSize,
DPRINT("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",
StackSize,
ChargeQuota);
if (ChargeQuota)
{
@ -209,11 +211,11 @@ PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota)
return(NULL);
}
Irp->StackCount=StackSize;
Irp->CurrentLocation=StackSize;
IoInitializeIrp(Irp, IoSizeOfIrp(StackSize), StackSize);
DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation);
return(Irp);
return Irp;
}
VOID IoSetCompletionRoutine(PIRP Irp,
@ -269,7 +271,9 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
for (i=0;i<Irp->StackCount;i++)
{
DPRINT("&Irp->Stack[i] %x\n",&Irp->Stack[i]);
DPRINT("&Irp->Stack[%d].CompletionRoutine %08lx\n",
i,
Irp->Stack[i].CompletionRoutine);
if (Irp->Stack[i].CompletionRoutine != NULL)
{
Status = Irp->Stack[i].CompletionRoutine(
@ -281,7 +285,7 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
return;
}
}
DPRINT("Irp->Stack[i].Control %x\n",Irp->Stack[i].Control);
DPRINT("Irp->Stack[%d].Control %08lx\n", i, Irp->Stack[i].Control);
if (Irp->Stack[i].Control & SL_PENDING_RETURNED)
{
DPRINT("Setting PendingReturned flag\n");
@ -306,4 +310,4 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
IoSecondStageCompletion(Irp,PriorityBoost);
}
}
>>>>>>> 1.7

View file

@ -72,6 +72,7 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
{
return(Status);
}
assert(FileObject != NULL);
if (ByteOffset==NULL)
{

View file

@ -25,7 +25,7 @@
#include <ddk/ntddk.h>
//#define NDEBUG
#define NDEBUG
#include <internal/debug.h>
/* MACROS ********************************************************************/
@ -196,7 +196,7 @@ LdrPEProcessDriver(PVOID ModuleLoadBase)
PIMAGE_FILE_HEADER PEFileHeader;
PIMAGE_OPTIONAL_HEADER PEOptionalHeader;
DbgPrint("Processing PE Driver at module base:%08lx\n", ModuleLoadBase);
DPRINT("Processing PE Driver at module base:%08lx\n", ModuleLoadBase);
/* Get header pointers */
PEDosHeader = (PIMAGE_DOS_HEADER) ModuleLoadBase;
@ -223,18 +223,18 @@ LdrPEProcessDriver(PVOID ModuleLoadBase)
/* FIXME: check/verify OS version number */
DbgPrint("OptionalHdrMagic:%04x LinkVersion:%d.%d\n",
DPRINT("OptionalHdrMagic:%04x LinkVersion:%d.%d\n",
PEOptionalHeader->Magic,
PEOptionalHeader->MajorLinkerVersion,
PEOptionalHeader->MinorLinkerVersion);
DbgPrint("Size: CODE:%08lx(%d) DATA:%08lx(%d) BSS:%08lx(%d)\n",
DPRINT("Size: CODE:%08lx(%d) DATA:%08lx(%d) BSS:%08lx(%d)\n",
PEOptionalHeader->SizeOfCode,
PEOptionalHeader->SizeOfCode,
PEOptionalHeader->SizeOfInitializedData,
PEOptionalHeader->SizeOfInitializedData,
PEOptionalHeader->SizeOfUninitializedData,
PEOptionalHeader->SizeOfUninitializedData);
DbgPrint("Entry Point:%08lx\n", PEOptionalHeader->AddressOfEntryPoint);
DPRINT("Entry Point:%08lx\n", PEOptionalHeader->AddressOfEntryPoint);
CHECKPOINT;
/* Determine the size of the module */
@ -450,8 +450,9 @@ LdrCOFFDoRelocations(module *Module, unsigned int SectionIndex)
for (j = 0; j < Section->s_nreloc; j++)
{
DbgPrint("vaddr %x ", Relocation->r_vaddr);
DbgPrint("symndex %x ", Relocation->r_symndx);
DPRINT("vaddr %x symndex %x",
Relocation->r_vaddr,
Relocation->r_symndx);
switch (Relocation->r_type)
{
@ -470,7 +471,7 @@ LdrCOFFDoRelocations(module *Module, unsigned int SectionIndex)
break;
default:
DbgPrint("%.8s: Unknown relocation type %x at %d in module\n",
DPRINT("%.8s: Unknown relocation type %x at %d in module\n",
Module->scn_list[SectionIndex].s_name,
Relocation->r_type,
j);
@ -502,7 +503,7 @@ LdrCOFFDoAddr32Reloc(module *Module, SCNHDR *Section, RELOC *Relocation)
Value = LdrCOFFGetSymbolValue(Module, Relocation->r_symndx);
Location = (unsigned int *)(Module->base + Relocation->r_vaddr);
DbgPrint("ADDR32 loc %x value %x *loc %x ", Location, Value, *Location);
DPRINT("ADDR32 loc %x value %x *loc %x\n", Location, Value, *Location);
*Location = (*Location) + Module->base;
return TRUE;
@ -596,7 +597,7 @@ LdrCOFFGetSymbolValue(module *Module, unsigned int Idx)
char Name[255];
LdrCOFFGetSymbolName(Module, Idx, Name);
DbgPrint("name %s ", Name);
DPRINT("name %s ", Name);
/* Check if the symbol is a section we have relocated */
if (strcmp(Name, ".text") == 0)
@ -714,7 +715,7 @@ NTSTATUS LdrLoadLibrary(HANDLE ProcessHandle,
}
else
{
DbgPrint("Library already loaded\n");
DPRINT("Library already loaded\n");
*Module = Library
}
RtlFreeUnicodeString(&umodName);