Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 286 of file fat32.c.
Referenced by Fat32Format().
{ IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; PUCHAR Buffer; LARGE_INTEGER FileOffset; ULONGLONG FirstDataSector; ULONGLONG FirstRootDirSector; /* Allocate buffer for the cluster */ Buffer = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(), 0, BootSector->SectorsPerCluster * BootSector->BytesPerSector); if (Buffer == NULL) return STATUS_INSUFFICIENT_RESOURCES; /* Zero the buffer */ memset(Buffer, 0, BootSector->SectorsPerCluster * BootSector->BytesPerSector); DPRINT("BootSector->ReservedSectors = %lu\n", BootSector->ReservedSectors); DPRINT("BootSector->FATSectors32 = %lu\n", BootSector->FATSectors32); DPRINT("BootSector->RootCluster = %lu\n", BootSector->RootCluster); DPRINT("BootSector->SectorsPerCluster = %lu\n", BootSector->SectorsPerCluster); /* Write cluster */ FirstDataSector = BootSector->ReservedSectors + (BootSector->FATCount * BootSector->FATSectors32) + 0 /* RootDirSectors */; DPRINT("FirstDataSector = %lu\n", FirstDataSector); FirstRootDirSector = ((BootSector->RootCluster - 2) * BootSector->SectorsPerCluster) + FirstDataSector; FileOffset.QuadPart = FirstRootDirSector * BootSector->BytesPerSector; DPRINT("FirstRootDirSector = %lu\n", FirstRootDirSector); DPRINT("FileOffset = %lu\n", FileOffset.QuadPart); Status = NtWriteFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock, Buffer, BootSector->SectorsPerCluster * BootSector->BytesPerSector, &FileOffset, NULL); if (!NT_SUCCESS(Status)) { DPRINT("NtWriteFile() failed (Status %lx)\n", Status); RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); return Status; } UpdateProgress(Context, (ULONG)BootSector->SectorsPerCluster); /* Free the buffer */ RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); return Status; }