Physical location(s) of a volume on W2K

Hi all!

How can I retrieve physical location(s) of a volume on W2K (something like
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS)?

Thanks,

Dany

> How can I retrieve physical location(s) of a volume on W2K (something like

IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS)?
This should work because it works in production under NT4 and
above for_files so there’s hope that it’s ok for_volumes also.

Just fill in the blanks.

Hope it helps.

typedef VOID (*PIO_APC_ROUTINE)(PVOID ApcContext, PIO_STATUS_BLOCK
IoStatusBlock, ULONG Reserved);

typedef NTSTATUS (__stdcall *NtFsControlFile_t)(HANDLE FileHandle,
HANDLE Event, // optional
PIO_APC_ROUTINE ApcRoutine, // optional
PVOID ApcContext, // optional
PIO_STATUS_BLOCK IoStatusBlock,
ULONG FsControlCode,
PVOID InputBuffer, // optional
ULONG InputBufferLength,
PVOID OutputBuffer, // optional
ULONG OutputBufferLength);

. . .

void nowDoIt() {
NtFsControlFile_t NtFsControlFile;
if(!(NtFsControlFile =
(NtFsControlFile_t)GetProcAddress(GetModuleHandle(“ntdll.dll”),
“NtFsControlFile”))) {
printf((“Could not find NtFsControlFile entry point in
ntdll.dll\n”));
return;
}
hVolume = … // open the volume
// allocate RETRIEVAL_POINTERS_BUFFER bytes for starters:
PRETRIEVAL_POINTERS_BUFFER retrievalPointers = 0;
// …
do {
// …
// increase retrievalBufferSize by 2 * sizeof(LARGE_INTEGER) each
time
// as long as ERROR_MORE_DATA is returned,
// and do not forget to set your
// PRETRIEVAL_POINTERS_BUFFER retrievalPointers->ExtentCount
// accordingly
// …
IO_STATUS_BLOCK ioStatus;
brc = NtFsControlFile(hVolume, 0, 0, 0, &ioStatus,
FSCTL_GET_RETRIEVAL_POINTERS,
&startingVcnBuffer, // input buffer
sizeof(startingVcnBuffer), // size of input buffer
retrievalPointers, // output buffer
retrievalBufferSize); // size of output buffer
} while (brc != STATUS_SUCCESS && ((dwrc = GetLastError()) ==
ERROR_MORE_DATA));
// …
// done, close hVolume etc.
}

IIRC it works fine on w2k too.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Dani Polovets”
To: “Windows File Systems Devs Interest List”
Sent: Sunday, November 20, 2005 7:38 PM
Subject: [ntfsd] Physical location(s) of a volume on W2K

> Hi all!
>
> How can I retrieve physical location(s) of a volume on W2K (something like
> IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS)?
>
> Thanks,
>
> Dany
>
>
>
>
>
>
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com