mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
cancel changes from david welch : write operations dangerous
remove allocations, use directly buffers svn path=/trunk/; revision=159
This commit is contained in:
parent
b0cbc91ce1
commit
523aba9a89
1 changed files with 153 additions and 171 deletions
|
@ -37,8 +37,6 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
sectorSize = BLOCKSIZE * SectorCount;
|
sectorSize = BLOCKSIZE * SectorCount;
|
||||||
|
|
||||||
/* FIXME: this routine does not need to alloc mem and copy */
|
|
||||||
|
|
||||||
|
|
||||||
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,
|
pDeviceObject,
|
||||||
|
@ -89,8 +87,6 @@ BOOLEAN VFATReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
GET_LARGE_INTEGER_LOW_PART(sectorNumber));
|
GET_LARGE_INTEGER_LOW_PART(sectorNumber));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Copying memory...\n");
|
|
||||||
DPRINT("Block request succeeded\n");
|
DPRINT("Block request succeeded\n");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +102,6 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
KEVENT event;
|
KEVENT event;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG sectorSize;
|
ULONG sectorSize;
|
||||||
PULONG mbr;
|
|
||||||
|
|
||||||
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||||
pDeviceObject,DiskSector,Buffer);
|
pDeviceObject,DiskSector,Buffer);
|
||||||
|
@ -118,17 +113,10 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
|
|
||||||
sectorSize = BLOCKSIZE*SectorCount;
|
sectorSize = BLOCKSIZE*SectorCount;
|
||||||
|
|
||||||
mbr = ExAllocatePool(NonPagedPool, sectorSize);
|
|
||||||
|
|
||||||
if (!mbr) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DPRINT("Building synchronous FSD Request...\n");
|
DPRINT("Building synchronous FSD Request...\n");
|
||||||
irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
||||||
pDeviceObject,
|
pDeviceObject,
|
||||||
mbr,
|
Buffer,
|
||||||
sectorSize,
|
sectorSize,
|
||||||
§orNumber,
|
§orNumber,
|
||||||
&event,
|
&event,
|
||||||
|
@ -136,7 +124,6 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
|
|
||||||
if (!irp) {
|
if (!irp) {
|
||||||
DbgPrint("WRITE failed!!!\n");
|
DbgPrint("WRITE failed!!!\n");
|
||||||
ExFreePool(mbr);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,14 +144,9 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
||||||
|
|
||||||
if (!NT_SUCCESS(status)) {
|
if (!NT_SUCCESS(status)) {
|
||||||
DbgPrint("IO failed!!! VFATWriteSectors : Error code: %x\n", status);
|
DbgPrint("IO failed!!! VFATWriteSectors : Error code: %x\n", status);
|
||||||
ExFreePool(mbr);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Copying memory...\n");
|
|
||||||
RtlCopyMemory(Buffer,mbr,sectorSize);
|
|
||||||
|
|
||||||
ExFreePool(mbr);
|
|
||||||
DPRINT("Block request succeeded\n");
|
DPRINT("Block request succeeded\n");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue