Disk serial numbers

I am writing this for my boss. He wants to know the following
information. I hope someone could give some advice to him.

START QUOTE

I want to acquire serial numbers of a disk.

  1. Using ZwCreateFile(), I acquired a file handle first.

  2. Using IoAllocateIrp(), I created IRP_MJ_QUERY_VOLUME_INFORMATION,
    specifying FileInformationClass as FileFsVolumeInformation.

  3. I received 0xC0000010(STATUS_INVALID_DEVICE_REQUEST)
    implementing above to my driver. I also used
    IoGetDeviceObjectPointer() in stead of ZwCreateFile(),
    but the result was the same.

My questions were,

  1. I am using “\??\H:” and “\DosDevices\H:” in my trials
    to acquire the H disk’s FileFsVolumeInformationwo. Is this
    naming scheme is correct?

  2. Is is the right way to acquire serial numbers to use ZwCreateFile(),
    IoGetDeviceObjectPointer()? Or should I use IRP_MJ_CREATE to
    open the disk.

END QUOTE

Thanks in advance!

Yosuke

Register for notification using IoRegisterPlugPlayNotification. You can use
the symbolic name in the DEVICE_INTERFACE_CHANGE_NOTIFICATION structure you
get in your callback to acquire the device object pointer. Use that to then
send the properly formated IoCtl request to the drive using pass through.


The personal opinion of
Gary G. Little

“yamamoto yosuke” wrote in message news:xxxxx@ntfsd…
>I am writing this for my boss. He wants to know the following
> information. I hope someone could give some advice to him.
>
> START QUOTE
>
> I want to acquire serial numbers of a disk.
>
> 1. Using ZwCreateFile(), I acquired a file handle first.
>
> 2. Using IoAllocateIrp(), I created IRP_MJ_QUERY_VOLUME_INFORMATION,
> specifying FileInformationClass as FileFsVolumeInformation.
>
> 3. I received 0xC0000010(STATUS_INVALID_DEVICE_REQUEST)
> implementing above to my driver. I also used
> IoGetDeviceObjectPointer() in stead of ZwCreateFile(),
> but the result was the same.
>
> My questions were,
>
> 1. I am using “\??\H:” and “\DosDevices\H:” in my trials
> to acquire the H disk’s FileFsVolumeInformationwo. Is this
> naming scheme is correct?
>
> 2. Is is the right way to acquire serial numbers to use ZwCreateFile(),
> IoGetDeviceObjectPointer()? Or should I use IRP_MJ_CREATE to
> open the disk.
>
> END QUOTE
>
> Thanks in advance!
>
> Yosuke
>
>
>

If I were you and wanted to know how to get
the volume serial number, I would ewrite a small
testprogram which utilizes the GetVolumeInformation API
and watched the operations with FileSpy to see whar happens.
If you implement the same process in the driver, it must work.

L.