disk type

hi!
could anyone tell me how to distinguish the usb harddisk type on filter driver from normal harddisk?

thank u in advance!

IoGetDeviceProperty for bus type GUID.

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

----- Original Message -----
From: “george”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, September 30, 2003 7:16 AM
Subject: [ntdev] disk type

> hi!
> could anyone tell me how to distinguish the usb harddisk type on filter
driver from normal harddisk?
>
>
> thank u in advance!
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

Does it work for file filter driver too?
Can I put it in mountcompletion routine? And use the mountvolume
deviceobject as the deviceobject?
Does it work for win2k?

I tried it, and it give me a blue screen during boot for win2k.
But it work fine for win xp.

Thank You!

cheers,
vincent

From: “Maxim S. Shatskih”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Re: disk type
>Date: Fri, 3 Oct 2003 01:06:34 +0400
>
>IoGetDeviceProperty for bus type GUID.
>
>Maxim Shatskih, Windows DDK MVP
>StorageCraft Corporation
>xxxxx@storagecraft.com
>http://www.storagecraft.com
>
>
>----- Original Message -----
>From: “george”
>To: “Windows System Software Devs Interest List”
>Sent: Tuesday, September 30, 2003 7:16 AM
>Subject: [ntdev] disk type
>
>
> > hi!
> > could anyone tell me how to distinguish the usb harddisk type on
>filter
>driver from normal harddisk?
> >
> >
> > thank u in advance!
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Find it on the web with MSN Search. http://search.msn.com.sg/

vincent gambit,???ã?

I also got the DevicePropertyEnumeratorName is STORGE not a USBSTOR! why?
It’s a usb mass storage. I used wrong device object ?
should i use vpb->RealObject or not ?
help!

======= 2003-10-09 17:24:00 ???д???=======

Hi,

Thanks for your reply.
I have tried it.
I not sure whether I got the Physical DeviceObject successfully because the
IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
However it was successful for DevicePropertyDeviceDescription and
DevicePropertyEnumeratorName
First one return me Generic Volume
2nd one Storage
So I guess I did it wronly?
I issue the IRP and call IoGetDeviceObject in MountCompletion routine in
sfilter driver
Hope you can help

thank you very much.

Below is a cut of my code:

BOOLEAN
sfQueryRelations(
PDEVICE_OBJECT pDeviceObject,
PFILE_OBJECT pFileObject,
PVOID *pPhysicalDeviceObject
)
{
PIRP pIrp;
KEVENT event;
IO_STATUS_BLOCK IoStatusBlock;
PIO_STACK_LOCATION pIoStackLocation;
PDEVICE_RELATIONS pDevice_Relations;
PDEVICE_OBJECT pDevObj;

// Initialize the event
KeInitializeEvent (&event, SynchronizationEvent, FALSE);

// Allocate an irp for this request. This could also come from a
// private pool, for instance.
pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
if(!pIrp)
{
// Failure!
KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
return FALSE;
}

// Build the IRP’s main body
pIrp->UserEvent = &event;
pIrp->UserIosb = &IoStatusBlock;
pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
pIrp->RequestorMode = KernelMode;
pIrp->Flags = 0;

// Set up the I/O stack location.
pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
pIoStackLocation->MajorFunction = IRP_MJ_PNP;
pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
pIoStackLocation->DeviceObject = pDeviceObject;
pIoStackLocation->FileObject = pFileObject;
pIoStackLocation->Parameters.QueryDeviceRelations.Type =
TargetDeviceRelation;
IoStatusBlock.Status = STATUS_NOT_SUPPORTED;

// Set the completion routine.
IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0, TRUE, TRUE,
TRUE);

// Send it to the FSD
(void) IoCallDriver (pDeviceObject, pIrp);

// Wait for the I/O
KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);

pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
KdPrint ((“count d\n”, pDevice_Relations->Count));
pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
pDevObj->Flags));
(PDEVICE_OBJECT) *pPhysicalDeviceObject =
(PDEVICE_OBJECT)pDevice_Relations->Objects[0];

// Done! Note that since our completion routine frees the IRP we cannot
// touch the IRP now.
return NT_SUCCESS (IoStatusBlock.Status);
}

NTSTATUS
sfQueryRelationsComplete(
PDEVICE_OBJECT pDeviceObject,
PIRP pIrp,
PVOID pContext)
{
// Copy the status information back into the “user” IOSB.
*pIrp->UserIosb = pIrp->IoStatus;
if( !NT_SUCCESS(pIrp->IoStatus.Status) )
KdPrint((“ERROR ON IRP!!!: x\n”, pIrp->IoStatus.Status ));

// Set the user event - wakes up the mainline code doing this.
KeSetEvent(pIrp->UserEvent, 0, FALSE);

// Free the IRP now that we are done with it.
IoFreeIrp(pIrp);

// We return STATUS_MORE_PROCESSING_REQUIRED because this “magic” return
value
// tells the I/O Manager that additional processing will be done by this
driver
// to the IRP - in fact, it might (as it is in this case) already BE
done - and
// the IRP cannot be completed.
return STATUS_MORE_PROCESSING_REQUIRED;
}

In sfMountCompletion routine

if (NT_SUCCESS (sfQueryRelations (RealDeviceObject, pIrpSp->FileObject,
&PhyDevObj)))
{
KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
PhyDevObj->Flags));
}

regprop = DevicePropertyBusTypeGuid;
ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid), &guid,
&ulSize);

if (NT_SUCCESS (ntstatus))
{
KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4, guid.Data1));
}
else
{
KdPrint ((“IoGetDeviceProperty failed\n”));
if (ntstatus == STATUS_BUFFER_TOO_SMALL)
KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
else if (ntstatus == STATUS_INVALID_PARAMETER_2)
KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
}

>From: “Maxim S. Shatskih”
>>Reply-To: “Windows System Software Devs Interest List”
>>
>>To: “Windows System Software Devs Interest List”
>>Subject: [ntdev] Re: disk type (Unsigned Mail)
>>Date: Thu, 9 Oct 2003 06:41:59 +0400
>>
>> > What deviceobject should i use to query?
>> > vpb->realdevice?
>>
>>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice and then
>>IoGetDeviceProperty to this returned PDO.
>>
>> > and does iogetdeviceproperty works in win 2k?
>>
>>Surely.
>>
>>Maxim Shatskih, Windows DDK MVP
>>StorageCraft Corporation
>>xxxxx@storagecraft.com
>>http://www.storagecraft.com
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>>
>>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> _________________________________________________________________
>Find love on MSN Personals http://personals.msn.com.sg/
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>.

= = = = = = = = = = = = = = = = = = = =

???
???

???george
???xxxxx@hotmail.com
???2003-10-10

i have tried vpd->realdeviceobject
it give me the same result
8(

From: “george”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Re: disk type
>Date: Fri, 10 Oct 2003 17:36:59 +0800
>
>vincent gambit,ÄúºÃ£¡
>
> I also got the DevicePropertyEnumeratorName is STORGE not a USBSTOR!
>why?
> It’s a usb mass storage. I used wrong device object ?
> should i use vpb->RealObject or not ?
> help!
>
>======= 2003-10-09 17:24:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
>
> >Hi,
> >
> >Thanks for your reply.
> >I have tried it.
> >I not sure whether I got the Physical DeviceObject successfully because
>the
> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
> >However it was successful for DevicePropertyDeviceDescription and
> >DevicePropertyEnumeratorName
> >First one return me Generic Volume
> >2nd one Storage
> >So I guess I did it wronly?
> >I issue the IRP and call IoGetDeviceObject in MountCompletion routine in
> >sfilter driver
> >Hope you can help
> >
> >thank you very much.
> >
> >Below is a cut of my code:
> >
> >BOOLEAN
> >sfQueryRelations(
> > PDEVICE_OBJECT pDeviceObject,
> > PFILE_OBJECT pFileObject,
> > PVOID *pPhysicalDeviceObject
> > )
> >{
> > PIRP pIrp;
> > KEVENT event;
> > IO_STATUS_BLOCK IoStatusBlock;
> > PIO_STACK_LOCATION pIoStackLocation;
> > PDEVICE_RELATIONS pDevice_Relations;
> > PDEVICE_OBJECT pDevObj;
> >
> > // Initialize the event
> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
> >
> > // Allocate an irp for this request. This could also come from a
> > // private pool, for instance.
> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
> > if(!pIrp)
> > {
> > // Failure!
> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
> > return FALSE;
> > }
> >
> > // Build the IRP’s main body
> > pIrp->UserEvent = &event;
> > pIrp->UserIosb = &IoStatusBlock;
> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
> > pIrp->RequestorMode = KernelMode;
> > pIrp->Flags = 0;
> >
> > // Set up the I/O stack location.
> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
> > pIoStackLocation->DeviceObject = pDeviceObject;
> > pIoStackLocation->FileObject = pFileObject;
> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
> >TargetDeviceRelation;
> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
> >
> > // Set the completion routine.
> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0, TRUE,
>TRUE,
> >TRUE);
> >
> > // Send it to the FSD
> > (void) IoCallDriver (pDeviceObject, pIrp);
> >
> > // Wait for the I/O
> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
> >
> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
> > KdPrint ((“count d\n”, pDevice_Relations->Count));
> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
> >pDevObj->Flags));
> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> >
> > // Done! Note that since our completion routine frees the IRP we
>cannot
> > // touch the IRP now.
> > return NT_SUCCESS (IoStatusBlock.Status);
> >}
> >
> >NTSTATUS
> >sfQueryRelationsComplete(
> > PDEVICE_OBJECT pDeviceObject,
> > PIRP pIrp,
> > PVOID pContext)
> >{
> > // Copy the status information back into the “user” IOSB.
> > *pIrp->UserIosb = pIrp->IoStatus;
> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
> > KdPrint((“ERROR ON IRP!!!: x\n”, pIrp->IoStatus.Status
>));
> >
> > // Set the user event - wakes up the mainline code doing this.
> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
> >
> > // Free the IRP now that we are done with it.
> > IoFreeIrp(pIrp);
> >
> > // We return STATUS_MORE_PROCESSING_REQUIRED because this “magic”
>return
> >value
> > // tells the I/O Manager that additional processing will be done by
>this
> >driver
> > // to the IRP - in fact, it might (as it is in this case) already BE
> >done - and
> > // the IRP cannot be completed.
> > return STATUS_MORE_PROCESSING_REQUIRED;
> >}
> >
> >In sfMountCompletion routine
> >===========================
> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject, pIrpSp->FileObject,
> >&PhyDevObj)))
> >{
> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
> >PhyDevObj->Flags));
> >}
> >
> >regprop = DevicePropertyBusTypeGuid;
> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid), &guid,
> >&ulSize);
> >
> >if (NT_SUCCESS (ntstatus))
> >{
> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4, guid.Data1));
> >}
> >else
> >{
> > KdPrint ((“IoGetDeviceProperty failed\n”));
> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
> >}
> >
> >
> >
> >>From: “Maxim S. Shatskih”
> >>Reply-To: “Windows System Software Devs Interest List”
> >>
> >>To: “Windows System Software Devs Interest List”
> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
> >>
> >> > What deviceobject should i use to query?
> >> > vpb->realdevice?
> >>
> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice and then
> >>IoGetDeviceProperty to this returned PDO.
> >>
> >> > and does iogetdeviceproperty works in win 2k?
> >>
> >>Surely.
> >>
> >>Maxim Shatskih, Windows DDK MVP
> >>StorageCraft Corporation
> >>xxxxx@storagecraft.com
> >>http://www.storagecraft.com
> >>
> >>
> >>—
> >>Questions? First check the Kernel Driver FAQ at
> >>http://www.osronline.com/article.cfm?id=256
> >>
> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >Find love on MSN Personals http://personals.msn.com.sg/
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >.
>
>= = = = = = = = = = = = = = = = = = = =
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
>Àñ£¡
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Take a break! Find destinations on MSN Travel. http://www.msn.com.sg/travel/

vincent gambit,???ã?

the result is ?
I trid vpb->RealObject and I got the DevicePropertyEnumeratorName is STORGE
Is it right?

======= 2003-10-10 18:26:00 ???д???=======

i have tried vpd->realdeviceobject
it give me the same result
8(

>From: “george”
>>Reply-To: “Windows System Software Devs Interest List”
>>
>>To: “Windows System Software Devs Interest List”
>>Subject: [ntdev] Re: disk type
>>Date: Fri, 10 Oct 2003 17:36:59 +0800
>>
>>vincent gambit,???ã?
>>
>> I also got the DevicePropertyEnumeratorName is STORGE not a USBSTOR!
>>why?
>> It’s a usb mass storage. I used wrong device object ?
>> should i use vpb->RealObject or not ?
>> help!
>>
>>======= 2003-10-09 17:24:00 ???д???=======
>>
>> >Hi,
>> >
>> >Thanks for your reply.
>> >I have tried it.
>> >I not sure whether I got the Physical DeviceObject successfully because
>>the
>> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
>> >However it was successful for DevicePropertyDeviceDescription and
>> >DevicePropertyEnumeratorName
>> >First one return me Generic Volume
>> >2nd one Storage
>> >So I guess I did it wronly?
>> >I issue the IRP and call IoGetDeviceObject in MountCompletion routine in
>> >sfilter driver
>> >Hope you can help
>> >
>> >thank you very much.
>> >
>> >Below is a cut of my code:
>> >
>> >BOOLEAN
>> >sfQueryRelations(
>> > PDEVICE_OBJECT pDeviceObject,
>> > PFILE_OBJECT pFileObject,
>> > PVOID *pPhysicalDeviceObject
>> > )
>> >{
>> > PIRP pIrp;
>> > KEVENT event;
>> > IO_STATUS_BLOCK IoStatusBlock;
>> > PIO_STACK_LOCATION pIoStackLocation;
>> > PDEVICE_RELATIONS pDevice_Relations;
>> > PDEVICE_OBJECT pDevObj;
>> >
>> > // Initialize the event
>> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
>> >
>> > // Allocate an irp for this request. This could also come from a
>> > // private pool, for instance.
>> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
>> > if(!pIrp)
>> > {
>> > // Failure!
>> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
>> > return FALSE;
>> > }
>> >
>> > // Build the IRP’s main body
>> > pIrp->UserEvent = &event;
>> > pIrp->UserIosb = &IoStatusBlock;
>> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
>> > pIrp->RequestorMode = KernelMode;
>> > pIrp->Flags = 0;
>> >
>> > // Set up the I/O stack location.
>> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
>> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
>> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
>> > pIoStackLocation->DeviceObject = pDeviceObject;
>> > pIoStackLocation->FileObject = pFileObject;
>> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
>> >TargetDeviceRelation;
>> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
>> >
>> > // Set the completion routine.
>> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0, TRUE,
>>TRUE,
>> >TRUE);
>> >
>> > // Send it to the FSD
>> > (void) IoCallDriver (pDeviceObject, pIrp);
>> >
>> > // Wait for the I/O
>> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
>> >
>> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
>> > KdPrint ((“count d\n”, pDevice_Relations->Count));
>> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
>> >pDevObj->Flags));
>> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
>> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> >
>> > // Done! Note that since our completion routine frees the IRP we
>>cannot
>> > // touch the IRP now.
>> > return NT_SUCCESS (IoStatusBlock.Status);
>> >}
>> >
>> >NTSTATUS
>> >sfQueryRelationsComplete(
>> > PDEVICE_OBJECT pDeviceObject,
>> > PIRP pIrp,
>> > PVOID pContext)
>> >{
>> > // Copy the status information back into the “user” IOSB.
>> > *pIrp->UserIosb = pIrp->IoStatus;
>> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
>> > KdPrint((“ERROR ON IRP!!!: x\n”, pIrp->IoStatus.Status
>>));
>> >
>> > // Set the user event - wakes up the mainline code doing this.
>> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
>> >
>> > // Free the IRP now that we are done with it.
>> > IoFreeIrp(pIrp);
>> >
>> > // We return STATUS_MORE_PROCESSING_REQUIRED because this “magic”
>>return
>> >value
>> > // tells the I/O Manager that additional processing will be done by
>>this
>> >driver
>> > // to the IRP - in fact, it might (as it is in this case) already BE
>> >done - and
>> > // the IRP cannot be completed.
>> > return STATUS_MORE_PROCESSING_REQUIRED;
>> >}
>> >
>> >In sfMountCompletion routine
>> >===========================
>> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject, pIrpSp->FileObject,
>> >&PhyDevObj)))
>> >{
>> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
>> >PhyDevObj->Flags));
>> >}
>> >
>> >regprop = DevicePropertyBusTypeGuid;
>> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid), &guid,
>> >&ulSize);
>> >
>> >if (NT_SUCCESS (ntstatus))
>> >{
>> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4, guid.Data1));
>> >}
>> >else
>> >{
>> > KdPrint ((“IoGetDeviceProperty failed\n”));
>> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
>> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
>> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
>> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
>> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
>> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
>> >}
>> >
>> >
>> >
>> >>From: “Maxim S. Shatskih”
>> >>Reply-To: “Windows System Software Devs Interest List”
>> >>
>> >>To: “Windows System Software Devs Interest List”
>> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
>> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
>> >>
>> >> > What deviceobject should i use to query?
>> >> > vpb->realdevice?
>> >>
>> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice and then
>> >>IoGetDeviceProperty to this returned PDO.
>> >>
>> >> > and does iogetdeviceproperty works in win 2k?
>> >>
>> >>Surely.
>> >>
>> >>Maxim Shatskih, Windows DDK MVP
>> >>StorageCraft Corporation
>> >>xxxxx@storagecraft.com
>> >>http://www.storagecraft.com
>> >>
>> >>
>> >>—
>> >>Questions? First check the Kernel Driver FAQ at
>> >>http://www.osronline.com/article.cfm?id=256
>> >>
>> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >
>> >
>> >Find love on MSN Personals http://personals.msn.com.sg/
>> >
>> >
>> >—
>> >Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>> >
>> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >.
>>
>>= = = = = = = = = = = = = = = = = = = =
>>
>>
>>???
>>???
>>
>>
>>???george
>>???xxxxx@hotmail.com
>>???2003-10-10
>>
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>>
>>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

>Take a break! Find destinations on MSN Travel. http://www.msn.com.sg/travel/
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>.

= = = = = = = = = = = = = = = = = = = =

???
???

???george
???xxxxx@hotmail.com
???2003-10-10

yes
8(

From: “george”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Re: disk type
>Date: Fri, 10 Oct 2003 18:31:28 +0800
>
>vincent gambit,ÄúºÃ£¡
>
> the result is ?
> I trid vpb->RealObject and I got the DevicePropertyEnumeratorName is
>STORGE
> Is it right?
>
>======= 2003-10-10 18:26:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
>
> >i have tried vpd->realdeviceobject
> >it give me the same result
> >8(
> >
> >
> >>From: “george”
> >>Reply-To: “Windows System Software Devs Interest List”
> >>
> >>To: “Windows System Software Devs Interest List”
> >>Subject: [ntdev] Re: disk type
> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
> >>
> >>vincent gambit,ÄúºÃ£¡
> >>
> >> I also got the DevicePropertyEnumeratorName is STORGE not a
>USBSTOR!
> >>why?
> >> It’s a usb mass storage. I used wrong device object ?
> >> should i use vpb->RealObject or not ?
> >> help!
> >>
> >>======= 2003-10-09 17:24:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> >>
> >> >Hi,
> >> >
> >> >Thanks for your reply.
> >> >I have tried it.
> >> >I not sure whether I got the Physical DeviceObject successfully
>because
> >>the
> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
> >> >However it was successful for DevicePropertyDeviceDescription and
> >> >DevicePropertyEnumeratorName
> >> >First one return me Generic Volume
> >> >2nd one Storage
> >> >So I guess I did it wronly?
> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion routine
>in
> >> >sfilter driver
> >> >Hope you can help
> >> >
> >> >thank you very much.
> >> >
> >> >Below is a cut of my code:
> >> >
> >> >BOOLEAN
> >> >sfQueryRelations(
> >> > PDEVICE_OBJECT pDeviceObject,
> >> > PFILE_OBJECT pFileObject,
> >> > PVOID *pPhysicalDeviceObject
> >> > )
> >> >{
> >> > PIRP pIrp;
> >> > KEVENT event;
> >> > IO_STATUS_BLOCK IoStatusBlock;
> >> > PIO_STACK_LOCATION pIoStackLocation;
> >> > PDEVICE_RELATIONS pDevice_Relations;
> >> > PDEVICE_OBJECT pDevObj;
> >> >
> >> > // Initialize the event
> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
> >> >
> >> > // Allocate an irp for this request. This could also come from a
> >> > // private pool, for instance.
> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
> >> > if(!pIrp)
> >> > {
> >> > // Failure!
> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
> >> > return FALSE;
> >> > }
> >> >
> >> > // Build the IRP’s main body
> >> > pIrp->UserEvent = &event;
> >> > pIrp->UserIosb = &IoStatusBlock;
> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
> >> > pIrp->RequestorMode = KernelMode;
> >> > pIrp->Flags = 0;
> >> >
> >> > // Set up the I/O stack location.
> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
> >> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
> >> > pIoStackLocation->DeviceObject = pDeviceObject;
> >> > pIoStackLocation->FileObject = pFileObject;
> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
> >> >TargetDeviceRelation;
> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
> >> >
> >> > // Set the completion routine.
> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0, TRUE,
> >>TRUE,
> >> >TRUE);
> >> >
> >> > // Send it to the FSD
> >> > (void) IoCallDriver (pDeviceObject, pIrp);
> >> >
> >> > // Wait for the I/O
> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
> >> >
> >> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> >> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
> >> >pDevObj->Flags));
> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> >> >
> >> > // Done! Note that since our completion routine frees the IRP we
> >>cannot
> >> > // touch the IRP now.
> >> > return NT_SUCCESS (IoStatusBlock.Status);
> >> >}
> >> >
> >> >NTSTATUS
> >> >sfQueryRelationsComplete(
> >> > PDEVICE_OBJECT pDeviceObject,
> >> > PIRP pIrp,
> >> > PVOID pContext)
> >> >{
> >> > // Copy the status information back into the “user” IOSB.
> >> > *pIrp->UserIosb = pIrp->IoStatus;
> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
> >> > KdPrint((“ERROR ON IRP!!!: x\n”, pIrp->IoStatus.Status
> >>));
> >> >
> >> > // Set the user event - wakes up the mainline code doing this.
> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
> >> >
> >> > // Free the IRP now that we are done with it.
> >> > IoFreeIrp(pIrp);
> >> >
> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this “magic”
> >>return
> >> >value
> >> > // tells the I/O Manager that additional processing will be done
>by
> >>this
> >> >driver
> >> > // to the IRP - in fact, it might (as it is in this case) already
>BE
> >> >done - and
> >> > // the IRP cannot be completed.
> >> > return STATUS_MORE_PROCESSING_REQUIRED;
> >> >}
> >> >
> >> >In sfMountCompletion routine
> >> >===========================
> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
>pIrpSp->FileObject,
> >> >&PhyDevObj)))
> >> >{
> >> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
> >> >PhyDevObj->Flags));
> >> >}
> >> >
> >> >regprop = DevicePropertyBusTypeGuid;
> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid),
>&guid,
> >> >&ulSize);
> >> >
> >> >if (NT_SUCCESS (ntstatus))
> >> >{
> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4, guid.Data1));
> >> >}
> >> >else
> >> >{
> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
> >> >}
> >> >
> >> >
> >> >
> >> >>From: “Maxim S. Shatskih”
> >> >>Reply-To: “Windows System Software Devs Interest List”
> >> >>
> >> >>To: “Windows System Software Devs Interest List”
>
> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
> >> >>
> >> >> > What deviceobject should i use to query?
> >> >> > vpb->realdevice?
> >> >>
> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice and
>then
> >> >>IoGetDeviceProperty to this returned PDO.
> >> >>
> >> >> > and does iogetdeviceproperty works in win 2k?
> >> >>
> >> >>Surely.
> >> >>
> >> >>Maxim Shatskih, Windows DDK MVP
> >> >>StorageCraft Corporation
> >> >>xxxxx@storagecraft.com
> >> >>http://www.storagecraft.com
> >> >>
> >> >>
> >> >>—
> >> >>Questions? First check the Kernel Driver FAQ at
> >> >>http://www.osronline.com/article.cfm?id=256
> >> >>
> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >> >
> >> >
> >> >Find love on MSN Personals http://personals.msn.com.sg/
> >> >
> >> >
> >> >—
> >> >Questions? First check the Kernel Driver FAQ at
> >>http://www.osronline.com/article.cfm?id=256
> >> >
> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >> >.
> >>
> >>= = = = = = = = = = = = = = = = = = = =
> >>
> >>
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> >>Àñ£¡
> >>
> >>
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
> >>
> >>
> >>
> >>—
> >>Questions? First check the Kernel Driver FAQ at
> >>http://www.osronline.com/article.cfm?id=256
> >>
> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >

> >Take a break! Find destinations on MSN Travel.
>http://www.msn.com.sg/travel/
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >.
>
>= = = = = = = = = = = = = = = = = = = =
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
>Àñ£¡
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Download games, logos, wallpapers and lots more at MSN Mobile!
http://www.msn.com.sg/mobile/

vincent gambit,???ã?

but what I want is that the DevicePropertyEnumeratorName is “USBSTOR” not “STORAGE”.
In that case I cannot distinguish it from a harddisk.

======= 2003-10-10 19:41:00 ???д???=======

yes
8(
>From: “george”
>>Reply-To: “Windows System Software Devs Interest List”
>>
>>To: “Windows System Software Devs Interest List”
>>Subject: [ntdev] Re: disk type
>>Date: Fri, 10 Oct 2003 18:31:28 +0800
>>
>>vincent gambit,???ã?
>>
>> the result is ?
>> I trid vpb->RealObject and I got the DevicePropertyEnumeratorName is
>>STORGE
>> Is it right?
>>
>>======= 2003-10-10 18:26:00 ???д???=======
>>
>> >i have tried vpd->realdeviceobject
>> >it give me the same result
>> >8(
>> >
>> >
>> >>From: “george”
>> >>Reply-To: “Windows System Software Devs Interest List”
>> >>
>> >>To: “Windows System Software Devs Interest List”
>> >>Subject: [ntdev] Re: disk type
>> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
>> >>
>> >>vincent gambit,???ã?
>> >>
>> >> I also got the DevicePropertyEnumeratorName is STORGE not a
>>USBSTOR!
>> >>why?
>> >> It’s a usb mass storage. I used wrong device object ?
>> >> should i use vpb->RealObject or not ?
>> >> help!
>> >>
>> >>======= 2003-10-09 17:24:00 ???д???=======
>> >>
>> >> >Hi,
>> >> >
>> >> >Thanks for your reply.
>> >> >I have tried it.
>> >> >I not sure whether I got the Physical DeviceObject successfully
>>because
>> >>the
>> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
>> >> >However it was successful for DevicePropertyDeviceDescription and
>> >> >DevicePropertyEnumeratorName
>> >> >First one return me Generic Volume
>> >> >2nd one Storage
>> >> >So I guess I did it wronly?
>> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion routine
>>in
>> >> >sfilter driver
>> >> >Hope you can help
>> >> >
>> >> >thank you very much.
>> >> >
>> >> >Below is a cut of my code:
>> >> >
>> >> >BOOLEAN
>> >> >sfQueryRelations(
>> >> > PDEVICE_OBJECT pDeviceObject,
>> >> > PFILE_OBJECT pFileObject,
>> >> > PVOID *pPhysicalDeviceObject
>> >> > )
>> >> >{
>> >> > PIRP pIrp;
>> >> > KEVENT event;
>> >> > IO_STATUS_BLOCK IoStatusBlock;
>> >> > PIO_STACK_LOCATION pIoStackLocation;
>> >> > PDEVICE_RELATIONS pDevice_Relations;
>> >> > PDEVICE_OBJECT pDevObj;
>> >> >
>> >> > // Initialize the event
>> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
>> >> >
>> >> > // Allocate an irp for this request. This could also come from a
>> >> > // private pool, for instance.
>> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
>> >> > if(!pIrp)
>> >> > {
>> >> > // Failure!
>> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
>> >> > return FALSE;
>> >> > }
>> >> >
>> >> > // Build the IRP’s main body
>> >> > pIrp->UserEvent = &event;
>> >> > pIrp->UserIosb = &IoStatusBlock;
>> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
>> >> > pIrp->RequestorMode = KernelMode;
>> >> > pIrp->Flags = 0;
>> >> >
>> >> > // Set up the I/O stack location.
>> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
>> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
>> >> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
>> >> > pIoStackLocation->DeviceObject = pDeviceObject;
>> >> > pIoStackLocation->FileObject = pFileObject;
>> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
>> >> >TargetDeviceRelation;
>> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
>> >> >
>> >> > // Set the completion routine.
>> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0, TRUE,
>> >>TRUE,
>> >> >TRUE);
>> >> >
>> >> > // Send it to the FSD
>> >> > (void) IoCallDriver (pDeviceObject, pIrp);
>> >> >
>> >> > // Wait for the I/O
>> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
>> >> >
>> >> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
>> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
>> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> >> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
>> >> >pDevObj->Flags));
>> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
>> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> >> >
>> >> > // Done! Note that since our completion routine frees the IRP we
>> >>cannot
>> >> > // touch the IRP now.
>> >> > return NT_SUCCESS (IoStatusBlock.Status);
>> >> >}
>> >> >
>> >> >NTSTATUS
>> >> >sfQueryRelationsComplete(
>> >> > PDEVICE_OBJECT pDeviceObject,
>> >> > PIRP pIrp,
>> >> > PVOID pContext)
>> >> >{
>> >> > // Copy the status information back into the “user” IOSB.
>> >> > *pIrp->UserIosb = pIrp->IoStatus;
>> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
>> >> > KdPrint((“ERROR ON IRP!!!: x\n”, pIrp->IoStatus.Status
>> >>));
>> >> >
>> >> > // Set the user event - wakes up the mainline code doing this.
>> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
>> >> >
>> >> > // Free the IRP now that we are done with it.
>> >> > IoFreeIrp(pIrp);
>> >> >
>> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this “magic”
>> >>return
>> >> >value
>> >> > // tells the I/O Manager that additional processing will be done
>>by
>> >>this
>> >> >driver
>> >> > // to the IRP - in fact, it might (as it is in this case) already
>>BE
>> >> >done - and
>> >> > // the IRP cannot be completed.
>> >> > return STATUS_MORE_PROCESSING_REQUIRED;
>> >> >}
>> >> >
>> >> >In sfMountCompletion routine
>> >> >===========================
>> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
>>pIrpSp->FileObject,
>> >> >&PhyDevObj)))
>> >> >{
>> >> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
>> >> >PhyDevObj->Flags));
>> >> >}
>> >> >
>> >> >regprop = DevicePropertyBusTypeGuid;
>> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid),
>>&guid,
>> >> >&ulSize);
>> >> >
>> >> >if (NT_SUCCESS (ntstatus))
>> >> >{
>> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4, guid.Data1));
>> >> >}
>> >> >else
>> >> >{
>> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
>> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
>> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
>> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
>> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
>> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
>> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
>> >> >}
>> >> >
>> >> >
>> >> >
>> >> >>From: “Maxim S. Shatskih”
>> >> >>Reply-To: “Windows System Software Devs Interest List”
>> >> >>
>> >> >>To: “Windows System Software Devs Interest List”
>>
>> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
>> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
>> >> >>
>> >> >> > What deviceobject should i use to query?
>> >> >> > vpb->realdevice?
>> >> >>
>> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice and
>>then
>> >> >>IoGetDeviceProperty to this returned PDO.
>> >> >>
>> >> >> > and does iogetdeviceproperty works in win 2k?
>> >> >>
>> >> >>Surely.
>> >> >>
>> >> >>Maxim Shatskih, Windows DDK MVP
>> >> >>StorageCraft Corporation
>> >> >>xxxxx@storagecraft.com
>> >> >>http://www.storagecraft.com
>> >> >>
>> >> >>
>> >> >>—
>> >> >>Questions? First check the Kernel Driver FAQ at
>> >> >>http://www.osronline.com/article.cfm?id=256
>> >> >>
>> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >> >
>> >> >
>> >> >Find love on MSN Personals http://personals.msn.com.sg/
>> >> >
>> >> >
>> >> >—
>> >> >Questions? First check the Kernel Driver FAQ at
>> >>http://www.osronline.com/article.cfm?id=256
>> >> >
>> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >> >.
>> >>
>> >>= = = = = = = = = = = = = = = = = = = =
>> >>
>> >>
>> >>???
>> >>???
>> >>
>> >>
>> >>???george
>> >>???xxxxx@hotmail.com
>> >>???2003-10-10
>> >>
>> >>
>> >>
>> >>—
>> >>Questions? First check the Kernel Driver FAQ at
>> >>http://www.osronline.com/article.cfm?id=256
>> >>
>> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >
>> >

>> >Take a break! Find destinations on MSN Travel.
>>http://www.msn.com.sg/travel/
>> >
>> >
>> >—
>> >Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>> >
>> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>> >.
>>
>>= = = = = = = = = = = = = = = = = = = =
>>
>>
>>???
>>???
>>
>>
>>???george
>>???xxxxx@hotmail.com
>>???2003-10-10
>>
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>>
>>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> _________________________________________________________________
>Download games, logos, wallpapers and lots more at MSN Mobile!
>http://www.msn.com.sg/mobile/
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>.

= = = = = = = = = = = = = = = = = = = =

???
???

???george
???xxxxx@hotmail.com
???2003-10-13

i got the same requirements too

From: “george”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Re: disk type
>Date: Mon, 13 Oct 2003 9:59:13 +0800
>
>vincent gambit,ÄúºÃ£¡
>
> but what I want is that the DevicePropertyEnumeratorName is “USBSTOR” not
>“STORAGE”.
> In that case I cannot distinguish it from a harddisk.
>
>======= 2003-10-10 19:41:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
>
> >yes
> >8(
> >>From: “george”
> >>Reply-To: “Windows System Software Devs Interest List”
> >>
> >>To: “Windows System Software Devs Interest List”
> >>Subject: [ntdev] Re: disk type
> >>Date: Fri, 10 Oct 2003 18:31:28 +0800
> >>
> >>vincent gambit,ÄúºÃ£¡
> >>
> >> the result is ?
> >> I trid vpb->RealObject and I got the DevicePropertyEnumeratorName
>is
> >>STORGE
> >> Is it right?
> >>
> >>======= 2003-10-10 18:26:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> >>
> >> >i have tried vpd->realdeviceobject
> >> >it give me the same result
> >> >8(
> >> >
> >> >
> >> >>From: “george”
> >> >>Reply-To: “Windows System Software Devs Interest List”
> >> >>
> >> >>To: “Windows System Software Devs Interest List”
>
> >> >>Subject: [ntdev] Re: disk type
> >> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
> >> >>
> >> >>vincent gambit,ÄúºÃ£¡
> >> >>
> >> >> I also got the DevicePropertyEnumeratorName is STORGE not a
> >>USBSTOR!
> >> >>why?
> >> >> It’s a usb mass storage. I used wrong device object ?
> >> >> should i use vpb->RealObject or not ?
> >> >> help!
> >> >>
> >> >>======= 2003-10-09 17:24:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> >> >>
> >> >> >Hi,
> >> >> >
> >> >> >Thanks for your reply.
> >> >> >I have tried it.
> >> >> >I not sure whether I got the Physical DeviceObject successfully
> >>because
> >> >>the
> >> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
> >> >> >However it was successful for DevicePropertyDeviceDescription and
> >> >> >DevicePropertyEnumeratorName
> >> >> >First one return me Generic Volume
> >> >> >2nd one Storage
> >> >> >So I guess I did it wronly?
> >> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion
>routine
> >>in
> >> >> >sfilter driver
> >> >> >Hope you can help
> >> >> >
> >> >> >thank you very much.
> >> >> >
> >> >> >Below is a cut of my code:
> >> >> >
> >> >> >BOOLEAN
> >> >> >sfQueryRelations(
> >> >> > PDEVICE_OBJECT pDeviceObject,
> >> >> > PFILE_OBJECT pFileObject,
> >> >> > PVOID *pPhysicalDeviceObject
> >> >> > )
> >> >> >{
> >> >> > PIRP pIrp;
> >> >> > KEVENT event;
> >> >> > IO_STATUS_BLOCK IoStatusBlock;
> >> >> > PIO_STACK_LOCATION pIoStackLocation;
> >> >> > PDEVICE_RELATIONS pDevice_Relations;
> >> >> > PDEVICE_OBJECT pDevObj;
> >> >> >
> >> >> > // Initialize the event
> >> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
> >> >> >
> >> >> > // Allocate an irp for this request. This could also come from
>a
> >> >> > // private pool, for instance.
> >> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
> >> >> > if(!pIrp)
> >> >> > {
> >> >> > // Failure!
> >> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
> >> >> > return FALSE;
> >> >> > }
> >> >> >
> >> >> > // Build the IRP’s main body
> >> >> > pIrp->UserEvent = &event;
> >> >> > pIrp->UserIosb = &IoStatusBlock;
> >> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
> >> >> > pIrp->RequestorMode = KernelMode;
> >> >> > pIrp->Flags = 0;
> >> >> >
> >> >> > // Set up the I/O stack location.
> >> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
> >> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
> >> >> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
> >> >> > pIoStackLocation->DeviceObject = pDeviceObject;
> >> >> > pIoStackLocation->FileObject = pFileObject;
> >> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
> >> >> >TargetDeviceRelation;
> >> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
> >> >> >
> >> >> > // Set the completion routine.
> >> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0,
>TRUE,
> >> >>TRUE,
> >> >> >TRUE);
> >> >> >
> >> >> > // Send it to the FSD
> >> >> > (void) IoCallDriver (pDeviceObject, pIrp);
> >> >> >
> >> >> > // Wait for the I/O
> >> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
> >> >> >
> >> >> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
> >> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
> >> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> >> >> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
> >> >> >pDevObj->Flags));
> >> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
> >> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> >> >> >
> >> >> > // Done! Note that since our completion routine frees the IRP
>we
> >> >>cannot
> >> >> > // touch the IRP now.
> >> >> > return NT_SUCCESS (IoStatusBlock.Status);
> >> >> >}
> >> >> >
> >> >> >NTSTATUS
> >> >> >sfQueryRelationsComplete(
> >> >> > PDEVICE_OBJECT pDeviceObject,
> >> >> > PIRP pIrp,
> >> >> > PVOID pContext)
> >> >> >{
> >> >> > // Copy the status information back into the “user” IOSB.
> >> >> > *pIrp->UserIosb = pIrp->IoStatus;
> >> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
> >> >> > KdPrint((“ERROR ON IRP!!!: x\n”,
>pIrp->IoStatus.Status
> >> >>));
> >> >> >
> >> >> > // Set the user event - wakes up the mainline code doing this.
> >> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
> >> >> >
> >> >> > // Free the IRP now that we are done with it.
> >> >> > IoFreeIrp(pIrp);
> >> >> >
> >> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this
>“magic”
> >> >>return
> >> >> >value
> >> >> > // tells the I/O Manager that additional processing will be
>done
> >>by
> >> >>this
> >> >> >driver
> >> >> > // to the IRP - in fact, it might (as it is in this case)
>already
> >>BE
> >> >> >done - and
> >> >> > // the IRP cannot be completed.
> >> >> > return STATUS_MORE_PROCESSING_REQUIRED;
> >> >> >}
> >> >> >
> >> >> >In sfMountCompletion routine
> >> >> >===========================
> >> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
> >>pIrpSp->FileObject,
> >> >> >&PhyDevObj)))
> >> >> >{
> >> >> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
> >> >> >PhyDevObj->Flags));
> >> >> >}
> >> >> >
> >> >> >regprop = DevicePropertyBusTypeGuid;
> >> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid),
> >>&guid,
> >> >> >&ulSize);
> >> >> >
> >> >> >if (NT_SUCCESS (ntstatus))
> >> >> >{
> >> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4,
>guid.Data1));
> >> >> >}
> >> >> >else
> >> >> >{
> >> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
> >> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
> >> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
> >> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
> >> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
> >> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
> >> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
> >> >> >}
> >> >> >
> >> >> >
> >> >> >
> >> >> >>From: “Maxim S. Shatskih”
> >> >> >>Reply-To: “Windows System Software Devs Interest List”
> >> >> >>
> >> >> >>To: “Windows System Software Devs Interest List”
> >>
> >> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
> >> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
> >> >> >>
> >> >> >> > What deviceobject should i use to query?
> >> >> >> > vpb->realdevice?
> >> >> >>
> >> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice
>and
> >>then
> >> >> >>IoGetDeviceProperty to this returned PDO.
> >> >> >>
> >> >> >> > and does iogetdeviceproperty works in win 2k?
> >> >> >>
> >> >> >>Surely.
> >> >> >>
> >> >> >>Maxim Shatskih, Windows DDK MVP
> >> >> >>StorageCraft Corporation
> >> >> >>xxxxx@storagecraft.com
> >> >> >>http://www.storagecraft.com
> >> >> >>
> >> >> >>
> >> >> >>—
> >> >> >>Questions? First check the Kernel Driver FAQ at
> >> >> >>http://www.osronline.com/article.cfm?id=256
> >> >> >>
> >> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >> >>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> >> >> >
> >> >> >
> >> >> >Find love on MSN Personals http://personals.msn.com.sg/
> >> >> >
> >> >> >
> >> >> >—
> >> >> >Questions? First check the Kernel Driver FAQ at
> >> >>http://www.osronline.com/article.cfm?id=256
> >> >> >
> >> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >> >To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> >> >> >.
> >> >>
> >> >>= = = = = = = = = = = = = = = = = = = =
> >> >>
> >> >>
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> >> >>Àñ£¡
> >> >>
> >> >>
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
> >> >>
> >> >>
> >> >>
> >> >>—
> >> >>Questions? First check the Kernel Driver FAQ at
> >> >>http://www.osronline.com/article.cfm?id=256
> >> >>
> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >> >
> >> >

> >> >Take a break! Find destinations on MSN Travel.
> >>http://www.msn.com.sg/travel/
> >> >
> >> >
> >> >—
> >> >Questions? First check the Kernel Driver FAQ at
> >>http://www.osronline.com/article.cfm?id=256
> >> >
> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >> >.
> >>
> >>= = = = = = = = = = = = = = = = = = = =
> >>
> >>
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> >>Àñ£¡
> >>
> >>
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
> >>
> >>
> >>
> >>—
> >>Questions? First check the Kernel Driver FAQ at
> >>http://www.osronline.com/article.cfm?id=256
> >>
> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >Download games, logos, wallpapers and lots more at MSN Mobile!
> >http://www.msn.com.sg/mobile/
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >.
>
>= = = = = = = = = = = = = = = = = = = =
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
>Àñ£¡
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-13
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Find love on MSN Personals http://personals.msn.com.sg/

“STORAGE” is the enumerator name for partitions, and not for the whole disk.

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

----- Original Message -----
From: “vincent gambit”
To: “Windows System Software Devs Interest List”
Sent: Monday, October 13, 2003 6:13 AM
Subject: [ntdev] Re: disk type

>
> i got the same requirements too
>
> >From: “george”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
> >Subject: [ntdev] Re: disk type
> >Date: Mon, 13 Oct 2003 9:59:13 +0800
> >
> >vincent gambit,???ã?
> >
> > but what I want is that the DevicePropertyEnumeratorName is “USBSTOR” not
> >“STORAGE”.
> > In that case I cannot distinguish it from a harddisk.
> >
> >======= 2003-10-10 19:41:00 ???д???=======
> >
> > >yes
> > >8(
> > >>From: “george”
> > >>Reply-To: “Windows System Software Devs Interest List”
> > >>
> > >>To: “Windows System Software Devs Interest List”
> > >>Subject: [ntdev] Re: disk type
> > >>Date: Fri, 10 Oct 2003 18:31:28 +0800
> > >>
> > >>vincent gambit,???ã?
> > >>
> > >> the result is ?
> > >> I trid vpb->RealObject and I got the DevicePropertyEnumeratorName
> >is
> > >>STORGE
> > >> Is it right?
> > >>
> > >>======= 2003-10-10 18:26:00 ???д???=======
> > >>
> > >> >i have tried vpd->realdeviceobject
> > >> >it give me the same result
> > >> >8(
> > >> >
> > >> >
> > >> >>From: “george”
> > >> >>Reply-To: “Windows System Software Devs Interest List”
> > >> >>
> > >> >>To: “Windows System Software Devs Interest List”
> >
> > >> >>Subject: [ntdev] Re: disk type
> > >> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
> > >> >>
> > >> >>vincent gambit,???ã?
> > >> >>
> > >> >> I also got the DevicePropertyEnumeratorName is STORGE not a
> > >>USBSTOR!
> > >> >>why?
> > >> >> It’s a usb mass storage. I used wrong device object ?
> > >> >> should i use vpb->RealObject or not ?
> > >> >> help!
> > >> >>
> > >> >>======= 2003-10-09 17:24:00 ???д???=======
> > >> >>
> > >> >> >Hi,
> > >> >> >
> > >> >> >Thanks for your reply.
> > >> >> >I have tried it.
> > >> >> >I not sure whether I got the Physical DeviceObject successfully
> > >>because
> > >> >>the
> > >> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
> > >> >> >However it was successful for DevicePropertyDeviceDescription and
> > >> >> >DevicePropertyEnumeratorName
> > >> >> >First one return me Generic Volume
> > >> >> >2nd one Storage
> > >> >> >So I guess I did it wronly?
> > >> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion
> >routine
> > >>in
> > >> >> >sfilter driver
> > >> >> >Hope you can help
> > >> >> >
> > >> >> >thank you very much.
> > >> >> >
> > >> >> >Below is a cut of my code:
> > >> >> >
> > >> >> >BOOLEAN
> > >> >> >sfQueryRelations(
> > >> >> > PDEVICE_OBJECT pDeviceObject,
> > >> >> > PFILE_OBJECT pFileObject,
> > >> >> > PVOID *pPhysicalDeviceObject
> > >> >> > )
> > >> >> >{
> > >> >> > PIRP pIrp;
> > >> >> > KEVENT event;
> > >> >> > IO_STATUS_BLOCK IoStatusBlock;
> > >> >> > PIO_STACK_LOCATION pIoStackLocation;
> > >> >> > PDEVICE_RELATIONS pDevice_Relations;
> > >> >> > PDEVICE_OBJECT pDevObj;
> > >> >> >
> > >> >> > // Initialize the event
> > >> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
> > >> >> >
> > >> >> > // Allocate an irp for this request. This could also come from
> >a
> > >> >> > // private pool, for instance.
> > >> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
> > >> >> > if(!pIrp)
> > >> >> > {
> > >> >> > // Failure!
> > >> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
> > >> >> > return FALSE;
> > >> >> > }
> > >> >> >
> > >> >> > // Build the IRP’s main body
> > >> >> > pIrp->UserEvent = &event;
> > >> >> > pIrp->UserIosb = &IoStatusBlock;
> > >> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
> > >> >> > pIrp->RequestorMode = KernelMode;
> > >> >> > pIrp->Flags = 0;
> > >> >> >
> > >> >> > // Set up the I/O stack location.
> > >> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
> > >> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
> > >> >> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
> > >> >> > pIoStackLocation->DeviceObject = pDeviceObject;
> > >> >> > pIoStackLocation->FileObject = pFileObject;
> > >> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
> > >> >> >TargetDeviceRelation;
> > >> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
> > >> >> >
> > >> >> > // Set the completion routine.
> > >> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0,
> >TRUE,
> > >> >>TRUE,
> > >> >> >TRUE);
> > >> >> >
> > >> >> > // Send it to the FSD
> > >> >> > (void) IoCallDriver (pDeviceObject, pIrp);
> > >> >> >
> > >> >> > // Wait for the I/O
> > >> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
> > >> >> >
> > >> >> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
> > >> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
> > >> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> > >> >> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
> > >> >> >pDevObj->Flags));
> > >> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
> > >> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> > >> >> >
> > >> >> > // Done! Note that since our completion routine frees the IRP
> >we
> > >> >>cannot
> > >> >> > // touch the IRP now.
> > >> >> > return NT_SUCCESS (IoStatusBlock.Status);
> > >> >> >}
> > >> >> >
> > >> >> >NTSTATUS
> > >> >> >sfQueryRelationsComplete(
> > >> >> > PDEVICE_OBJECT pDeviceObject,
> > >> >> > PIRP pIrp,
> > >> >> > PVOID pContext)
> > >> >> >{
> > >> >> > // Copy the status information back into the “user” IOSB.
> > >> >> > *pIrp->UserIosb = pIrp->IoStatus;
> > >> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
> > >> >> > KdPrint((“ERROR ON IRP!!!: x\n”,
> >pIrp->IoStatus.Status
> > >> >>));
> > >> >> >
> > >> >> > // Set the user event - wakes up the mainline code doing this.
> > >> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
> > >> >> >
> > >> >> > // Free the IRP now that we are done with it.
> > >> >> > IoFreeIrp(pIrp);
> > >> >> >
> > >> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this
> >“magic”
> > >> >>return
> > >> >> >value
> > >> >> > // tells the I/O Manager that additional processing will be
> >done
> > >>by
> > >> >>this
> > >> >> >driver
> > >> >> > // to the IRP - in fact, it might (as it is in this case)
> >already
> > >>BE
> > >> >> >done - and
> > >> >> > // the IRP cannot be completed.
> > >> >> > return STATUS_MORE_PROCESSING_REQUIRED;
> > >> >> >}
> > >> >> >
> > >> >> >In sfMountCompletion routine
> > >> >> >===========================
> > >> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
> > >>pIrpSp->FileObject,
> > >> >> >&PhyDevObj)))
> > >> >> >{
> > >> >> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
> > >> >> >PhyDevObj->Flags));
> > >> >> >}
> > >> >> >
> > >> >> >regprop = DevicePropertyBusTypeGuid;
> > >> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid),
> > >>&guid,
> > >> >> >&ulSize);
> > >> >> >
> > >> >> >if (NT_SUCCESS (ntstatus))
> > >> >> >{
> > >> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4,
> >guid.Data1));
> > >> >> >}
> > >> >> >else
> > >> >> >{
> > >> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
> > >> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
> > >> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
> > >> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
> > >> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
> > >> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
> > >> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
> > >> >> >}
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >> >>From: “Maxim S. Shatskih”
> > >> >> >>Reply-To: “Windows System Software Devs Interest List”
> > >> >> >>
> > >> >> >>To: “Windows System Software Devs Interest List”
> > >>
> > >> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
> > >> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
> > >> >> >>
> > >> >> >> > What deviceobject should i use to query?
> > >> >> >> > vpb->realdevice?
> > >> >> >>
> > >> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice
> >and
> > >>then
> > >> >> >>IoGetDeviceProperty to this returned PDO.
> > >> >> >>
> > >> >> >> > and does iogetdeviceproperty works in win 2k?
> > >> >> >>
> > >> >> >>Surely.
> > >> >> >>
> > >> >> >>Maxim Shatskih, Windows DDK MVP
> > >> >> >>StorageCraft Corporation
> > >> >> >>xxxxx@storagecraft.com
> > >> >> >>http://www.storagecraft.com
> > >> >> >>
> > >> >> >>
> > >> >> >>—
> > >> >> >>Questions? First check the Kernel Driver FAQ at
> > >> >> >>http://www.osronline.com/article.cfm?id=256
> > >> >> >>
> > >> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >> >> >>To unsubscribe send a blank email to
> >xxxxx@lists.osr.com
> > >> >> >
> > >> >> >
> > >> >> >Find love on MSN Personals http://personals.msn.com.sg/
> > >> >> >
> > >> >> >
> > >> >> >—
> > >> >> >Questions? First check the Kernel Driver FAQ at
> > >> >>http://www.osronline.com/article.cfm?id=256
> > >> >> >
> > >> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >> >> >To unsubscribe send a blank email to
> >xxxxx@lists.osr.com
> > >> >> >.
> > >> >>
> > >> >>= = = = = = = = = = = = = = = = = = = =
> > >> >>
> > >> >>
> > >> >>???
> > >> >>???
> > >> >>
> > >> >>
> > >> >>???george
> > >> >>???xxxxx@hotmail.com
> > >> >>???2003-10-10
> > >> >>
> > >> >>
> > >> >>
> > >> >>—
> > >> >>Questions? First check the Kernel Driver FAQ at
> > >> >>http://www.osronline.com/article.cfm?id=256
> > >> >>
> > >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >> >
> > >> >

> > >> >Take a break! Find destinations on MSN Travel.
> > >>http://www.msn.com.sg/travel/
> > >> >
> > >> >
> > >> >—
> > >> >Questions? First check the Kernel Driver FAQ at
> > >>http://www.osronline.com/article.cfm?id=256
> > >> >
> > >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >> >.
> > >>
> > >>= = = = = = = = = = = = = = = = = = = =
> > >>
> > >>
> > >>???
> > >>???
> > >>
> > >>
> > >>???george
> > >>???xxxxx@hotmail.com
> > >>???2003-10-10
> > >>
> > >>
> > >>
> > >>—
> > >>Questions? First check the Kernel Driver FAQ at
> > >>http://www.osronline.com/article.cfm?id=256
> > >>
> > >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >Download games, logos, wallpapers and lots more at MSN Mobile!
> > >http://www.msn.com.sg/mobile/
> > >
> > >
> > >—
> > >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> > >
> > >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >.
> >
> >= = = = = = = = = = = = = = = = = = = =
> >
> >
> >???
> >???
> >
> >
> >???george
> >???xxxxx@hotmail.com
> >???2003-10-13
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

> Find love on MSN Personals http://personals.msn.com.sg/
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

so is it possible to get the enumerator name for the disk which the
partition is at?

thank you!

cheers,
vincent

From: “Maxim S. Shatskih”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Re: disk type
>Date: Mon, 13 Oct 2003 10:55:28 +0400
>
>“STORAGE” is the enumerator name for partitions, and not for the whole
>disk.
>
>Maxim Shatskih, Windows DDK MVP
>StorageCraft Corporation
>xxxxx@storagecraft.com
>http://www.storagecraft.com
>
>
>----- Original Message -----
>From: “vincent gambit”
>To: “Windows System Software Devs Interest List”
>Sent: Monday, October 13, 2003 6:13 AM
>Subject: [ntdev] Re: disk type
>
>
> >
> > i got the same requirements too
> >
> > >From: “george”
> > >Reply-To: “Windows System Software Devs Interest List”
> > >
> > >To: “Windows System Software Devs Interest List”
> > >Subject: [ntdev] Re: disk type
> > >Date: Mon, 13 Oct 2003 9:59:13 +0800
> > >
> > >vincent gambit,ÄúºÃ£¡
> > >
> > > but what I want is that the DevicePropertyEnumeratorName is “USBSTOR”
>not
> > >“STORAGE”.
> > > In that case I cannot distinguish it from a harddisk.
> > >
> > >======= 2003-10-10 19:41:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> > >
> > > >yes
> > > >8(
> > > >>From: “george”
> > > >>Reply-To: “Windows System Software Devs Interest List”
> > > >>
> > > >>To: “Windows System Software Devs Interest List”
>
> > > >>Subject: [ntdev] Re: disk type
> > > >>Date: Fri, 10 Oct 2003 18:31:28 +0800
> > > >>
> > > >>vincent gambit,ÄúºÃ£¡
> > > >>
> > > >> the result is ?
> > > >> I trid vpb->RealObject and I got the
>DevicePropertyEnumeratorName
> > >is
> > > >>STORGE
> > > >> Is it right?
> > > >>
> > > >>======= 2003-10-10 18:26:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> > > >>
> > > >> >i have tried vpd->realdeviceobject
> > > >> >it give me the same result
> > > >> >8(
> > > >> >
> > > >> >
> > > >> >>From: “george”
> > > >> >>Reply-To: “Windows System Software Devs Interest List”
> > > >> >>
> > > >> >>To: “Windows System Software Devs Interest List”
> > >
> > > >> >>Subject: [ntdev] Re: disk type
> > > >> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
> > > >> >>
> > > >> >>vincent gambit,ÄúºÃ£¡
> > > >> >>
> > > >> >> I also got the DevicePropertyEnumeratorName is STORGE not
>a
> > > >>USBSTOR!
> > > >> >>why?
> > > >> >> It’s a usb mass storage. I used wrong device object ?
> > > >> >> should i use vpb->RealObject or not ?
> > > >> >> help!
> > > >> >>
> > > >> >>======= 2003-10-09 17:24:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=======
> > > >> >>
> > > >> >> >Hi,
> > > >> >> >
> > > >> >> >Thanks for your reply.
> > > >> >> >I have tried it.
> > > >> >> >I not sure whether I got the Physical DeviceObject successfully
> > > >>because
> > > >> >>the
> > > >> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
> > > >> >> >However it was successful for DevicePropertyDeviceDescription
>and
> > > >> >> >DevicePropertyEnumeratorName
> > > >> >> >First one return me Generic Volume
> > > >> >> >2nd one Storage
> > > >> >> >So I guess I did it wronly?
> > > >> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion
> > >routine
> > > >>in
> > > >> >> >sfilter driver
> > > >> >> >Hope you can help
> > > >> >> >
> > > >> >> >thank you very much.
> > > >> >> >
> > > >> >> >Below is a cut of my code:
> > > >> >> >
> > > >> >> >BOOLEAN
> > > >> >> >sfQueryRelations(
> > > >> >> > PDEVICE_OBJECT pDeviceObject,
> > > >> >> > PFILE_OBJECT pFileObject,
> > > >> >> > PVOID *pPhysicalDeviceObject
> > > >> >> > )
> > > >> >> >{
> > > >> >> > PIRP pIrp;
> > > >> >> > KEVENT event;
> > > >> >> > IO_STATUS_BLOCK IoStatusBlock;
> > > >> >> > PIO_STACK_LOCATION pIoStackLocation;
> > > >> >> > PDEVICE_RELATIONS pDevice_Relations;
> > > >> >> > PDEVICE_OBJECT pDevObj;
> > > >> >> >
> > > >> >> > // Initialize the event
> > > >> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
> > > >> >> >
> > > >> >> > // Allocate an irp for this request. This could also come
>from
> > >a
> > > >> >> > // private pool, for instance.
> > > >> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
> > > >> >> > if(!pIrp)
> > > >> >> > {
> > > >> >> > // Failure!
> > > >> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp
>Failed…\n”));
> > > >> >> > return FALSE;
> > > >> >> > }
> > > >> >> >
> > > >> >> > // Build the IRP’s main body
> > > >> >> > pIrp->UserEvent = &event;
> > > >> >> > pIrp->UserIosb = &IoStatusBlock;
> > > >> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
> > > >> >> > pIrp->RequestorMode = KernelMode;
> > > >> >> > pIrp->Flags = 0;
> > > >> >> >
> > > >> >> > // Set up the I/O stack location.
> > > >> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
> > > >> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
> > > >> >> > pIoStackLocation->MinorFunction =
>IRP_MN_QUERY_DEVICE_RELATIONS;
> > > >> >> > pIoStackLocation->DeviceObject = pDeviceObject;
> > > >> >> > pIoStackLocation->FileObject = pFileObject;
> > > >> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
> > > >> >> >TargetDeviceRelation;
> > > >> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
> > > >> >> >
> > > >> >> > // Set the completion routine.
> > > >> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0,
> > >TRUE,
> > > >> >>TRUE,
> > > >> >> >TRUE);
> > > >> >> >
> > > >> >> > // Send it to the FSD
> > > >> >> > (void) IoCallDriver (pDeviceObject, pIrp);
> > > >> >> >
> > > >> >> > // Wait for the I/O
> > > >> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE,
>0);
> > > >> >> >
> > > >> >> > pDevice_Relations = (PDEVICE_RELATIONS
>)IoStatusBlock.Information;
> > > >> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
> > > >> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> > > >> >> > KdPrint ((“pDevjObj devtype: x flags x\n”,
>pDevObj->DeviceType,
> > > >> >> >pDevObj->Flags));
> > > >> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
> > > >> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
> > > >> >> >
> > > >> >> > // Done! Note that since our completion routine frees the
>IRP
> > >we
> > > >> >>cannot
> > > >> >> > // touch the IRP now.
> > > >> >> > return NT_SUCCESS (IoStatusBlock.Status);
> > > >> >> >}
> > > >> >> >
> > > >> >> >NTSTATUS
> > > >> >> >sfQueryRelationsComplete(
> > > >> >> > PDEVICE_OBJECT pDeviceObject,
> > > >> >> > PIRP pIrp,
> > > >> >> > PVOID pContext)
> > > >> >> >{
> > > >> >> > // Copy the status information back into the “user” IOSB.
> > > >> >> > *pIrp->UserIosb = pIrp->IoStatus;
> > > >> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
> > > >> >> > KdPrint((“ERROR ON IRP!!!: x\n”,
> > >pIrp->IoStatus.Status
> > > >> >>));
> > > >> >> >
> > > >> >> > // Set the user event - wakes up the mainline code doing this.
> > > >> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
> > > >> >> >
> > > >> >> > // Free the IRP now that we are done with it.
> > > >> >> > IoFreeIrp(pIrp);
> > > >> >> >
> > > >> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this
> > >“magic”
> > > >> >>return
> > > >> >> >value
> > > >> >> > // tells the I/O Manager that additional processing will be
> > >done
> > > >>by
> > > >> >>this
> > > >> >> >driver
> > > >> >> > // to the IRP - in fact, it might (as it is in this case)
> > >already
> > > >>BE
> > > >> >> >done - and
> > > >> >> > // the IRP cannot be completed.
> > > >> >> > return STATUS_MORE_PROCESSING_REQUIRED;
> > > >> >> >}
> > > >> >> >
> > > >> >> >In sfMountCompletion routine
> > > >> >> >===========================
> > > >> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
> > > >>pIrpSp->FileObject,
> > > >> >> >&PhyDevObj)))
> > > >> >> >{
> > > >> >> > KdPrint ((“Success! DevType x Flags x\n”,
>PhyDevObj->DeviceType,
> > > >> >> >PhyDevObj->Flags));
> > > >> >> >}
> > > >> >> >
> > > >> >> >regprop = DevicePropertyBusTypeGuid;
> > > >> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop,
>sizeof(guid),
> > > >>&guid,
> > > >> >> >&ulSize);
> > > >> >> >
> > > >> >> >if (NT_SUCCESS (ntstatus))
> > > >> >> >{
> > > >> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4,
> > >guid.Data1));
> > > >> >> >}
> > > >> >> >else
> > > >> >> >{
> > > >> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
> > > >> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
> > > >> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
> > > >> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
> > > >> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
> > > >> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
> > > >> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
> > > >> >> >}
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> >>From: “Maxim S. Shatskih”
> > > >> >> >>Reply-To: “Windows System Software Devs Interest List”
> > > >> >> >>
> > > >> >> >>To: “Windows System Software Devs Interest List”
> > > >>
> > > >> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
> > > >> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
> > > >> >> >>
> > > >> >> >> > What deviceobject should i use to query?
> > > >> >> >> > vpb->realdevice?
> > > >> >> >>
> > > >> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to
>Vpb->RealDevice
> > >and
> > > >>then
> > > >> >> >>IoGetDeviceProperty to this returned PDO.
> > > >> >> >>
> > > >> >> >> > and does iogetdeviceproperty works in win 2k?
> > > >> >> >>
> > > >> >> >>Surely.
> > > >> >> >>
> > > >> >> >>Maxim Shatskih, Windows DDK MVP
> > > >> >> >>StorageCraft Corporation
> > > >> >> >>xxxxx@storagecraft.com
> > > >> >> >>http://www.storagecraft.com
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>—
> > > >> >> >>Questions? First check the Kernel Driver FAQ at
> > > >> >> >>http://www.osronline.com/article.cfm?id=256
> > > >> >> >>
> > > >> >> >>You are currently subscribed to ntdev as:
>xxxxx@hotmail.com
> > > >> >> >>To unsubscribe send a blank email to
> > >xxxxx@lists.osr.com
> > > >> >> >
> > > >> >>
> >
> > > >> >> >Find love on MSN Personals http://personals.msn.com.sg/
> > > >> >> >
> > > >> >> >
> > > >> >> >—
> > > >> >> >Questions? First check the Kernel Driver FAQ at
> > > >> >>http://www.osronline.com/article.cfm?id=256
> > > >> >> >
> > > >> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > > >> >> >To unsubscribe send a blank email to
> > >xxxxx@lists.osr.com
> > > >> >> >.
> > > >> >>
> > > >> >>= = = = = = = = = = = = = = = = = = = =
> > > >> >>
> > > >> >>
> > > >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> > > >> >>Àñ£¡
> > > >> >>
> > > >> >>
> > > >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> > > >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> > > >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
> > > >> >>
> > > >> >>
> > > >> >>
> > > >> >>—
> > > >> >>Questions? First check the Kernel Driver FAQ at
> > > >> >>http://www.osronline.com/article.cfm?id=256
> > > >> >>
> > > >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > > >> >>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> > > >> >
> > > >> >

> > > >> >Take a break! Find destinations on MSN Travel.
> > > >>http://www.msn.com.sg/travel/
> > > >> >
> > > >> >
> > > >> >—
> > > >> >Questions? First check the Kernel Driver FAQ at
> > > >>http://www.osronline.com/article.cfm?id=256
> > > >> >
> > > >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > > >> >To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> > > >> >.
> > > >>
> > > >>= = = = = = = = = = = = = = = = = = = =
> > > >>
> > > >>
> > > >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> > > >>Àñ£¡
> > > >>
> > > >>
> > > >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> > > >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> > > >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-10
> > > >>
> > > >>
> > > >>
> > > >>—
> > > >>Questions? First check the Kernel Driver FAQ at
> > > >>http://www.osronline.com/article.cfm?id=256
> > > >>
> > > >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > > >>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> > > >
> > > >
> > > >Download games, logos, wallpapers and lots more at MSN Mobile!
> > > >http://www.msn.com.sg/mobile/
> > > >
> > > >
> > > >—
> > > >Questions? First check the Kernel Driver FAQ at
> > >http://www.osronline.com/article.cfm?id=256
> > > >
> > > >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > > >.
> > >
> > >= = = = = = = = = = = = = = = = = = = =
> > >
> > >
> > >¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> > >Àñ£¡
> > >
> > >
> > >¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡george
> > >¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡xxxxx@hotmail.com
> > >¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-10-13
> > >
> > >
> > >
> > >—
> > >Questions? First check the Kernel Driver FAQ at
> > >http://www.osronline.com/article.cfm?id=256
> > >
> > >You are currently subscribed to ntdev as: xxxxx@hotmail.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >

> > Find love on MSN Personals http://personals.msn.com.sg/
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Get MSN Hotmail alerts on your mobile. http://en-asiasms.mobile.msn.com/

Maxim S. Shatskih,???ã?

But I want the whole disk. and how to get the whole disk info.
Thank u!

======= 2003-10-13 10:55:00 ???д???=======

“STORAGE” is the enumerator name for partitions, and not for the whole disk.

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

----- Original Message -----
From: “vincent gambit”
>To: “Windows System Software Devs Interest List”
>Sent: Monday, October 13, 2003 6:13 AM
>Subject: [ntdev] Re: disk type
>
>
>>
>> i got the same requirements too
>>
>> >From: “george”
>> >Reply-To: “Windows System Software Devs Interest List”
>> >
>> >To: “Windows System Software Devs Interest List”
>> >Subject: [ntdev] Re: disk type
>> >Date: Mon, 13 Oct 2003 9:59:13 +0800
>> >
>> >vincent gambit,???ã?
>> >
>> > but what I want is that the DevicePropertyEnumeratorName is “USBSTOR” not
>> >“STORAGE”.
>> > In that case I cannot distinguish it from a harddisk.
>> >
>> >======= 2003-10-10 19:41:00 ???д???=======
>> >
>> > >yes
>> > >8(
>> > >>From: “george”
>> > >>Reply-To: “Windows System Software Devs Interest List”
>> > >>
>> > >>To: “Windows System Software Devs Interest List”
>> > >>Subject: [ntdev] Re: disk type
>> > >>Date: Fri, 10 Oct 2003 18:31:28 +0800
>> > >>
>> > >>vincent gambit,???ã?
>> > >>
>> > >> the result is ?
>> > >> I trid vpb->RealObject and I got the DevicePropertyEnumeratorName
>> >is
>> > >>STORGE
>> > >> Is it right?
>> > >>
>> > >>======= 2003-10-10 18:26:00 ???д???=======
>> > >>
>> > >> >i have tried vpd->realdeviceobject
>> > >> >it give me the same result
>> > >> >8(
>> > >> >
>> > >> >
>> > >> >>From: “george”
>> > >> >>Reply-To: “Windows System Software Devs Interest List”
>> > >> >>
>> > >> >>To: “Windows System Software Devs Interest List”
>> >
>> > >> >>Subject: [ntdev] Re: disk type
>> > >> >>Date: Fri, 10 Oct 2003 17:36:59 +0800
>> > >> >>
>> > >> >>vincent gambit,???ã?
>> > >> >>
>> > >> >> I also got the DevicePropertyEnumeratorName is STORGE not a
>> > >>USBSTOR!
>> > >> >>why?
>> > >> >> It’s a usb mass storage. I used wrong device object ?
>> > >> >> should i use vpb->RealObject or not ?
>> > >> >> help!
>> > >> >>
>> > >> >>======= 2003-10-09 17:24:00 ???д???=======
>> > >> >>
>> > >> >> >Hi,
>> > >> >> >
>> > >> >> >Thanks for your reply.
>> > >> >> >I have tried it.
>> > >> >> >I not sure whether I got the Physical DeviceObject successfully
>> > >>because
>> > >> >>the
>> > >> >> >IoGetDeviceProperty failed for DevicePropertyBusTypeGuid!!!
>> > >> >> >However it was successful for DevicePropertyDeviceDescription and
>> > >> >> >DevicePropertyEnumeratorName
>> > >> >> >First one return me Generic Volume
>> > >> >> >2nd one Storage
>> > >> >> >So I guess I did it wronly?
>> > >> >> >I issue the IRP and call IoGetDeviceObject in MountCompletion
>> >routine
>> > >>in
>> > >> >> >sfilter driver
>> > >> >> >Hope you can help
>> > >> >> >
>> > >> >> >thank you very much.
>> > >> >> >
>> > >> >> >Below is a cut of my code:
>> > >> >> >
>> > >> >> >BOOLEAN
>> > >> >> >sfQueryRelations(
>> > >> >> > PDEVICE_OBJECT pDeviceObject,
>> > >> >> > PFILE_OBJECT pFileObject,
>> > >> >> > PVOID *pPhysicalDeviceObject
>> > >> >> > )
>> > >> >> >{
>> > >> >> > PIRP pIrp;
>> > >> >> > KEVENT event;
>> > >> >> > IO_STATUS_BLOCK IoStatusBlock;
>> > >> >> > PIO_STACK_LOCATION pIoStackLocation;
>> > >> >> > PDEVICE_RELATIONS pDevice_Relations;
>> > >> >> > PDEVICE_OBJECT pDevObj;
>> > >> >> >
>> > >> >> > // Initialize the event
>> > >> >> > KeInitializeEvent (&event, SynchronizationEvent, FALSE);
>> > >> >> >
>> > >> >> > // Allocate an irp for this request. This could also come from
>> >a
>> > >> >> > // private pool, for instance.
>> > >> >> > pIrp = IoAllocateIrp (pDeviceObject->StackSize, FALSE);
>> > >> >> > if(!pIrp)
>> > >> >> > {
>> > >> >> > // Failure!
>> > >> >> > KdPrint((“[sfQueryRelations] IoAllocateIrp Failed…\n”));
>> > >> >> > return FALSE;
>> > >> >> > }
>> > >> >> >
>> > >> >> > // Build the IRP’s main body
>> > >> >> > pIrp->UserEvent = &event;
>> > >> >> > pIrp->UserIosb = &IoStatusBlock;
>> > >> >> > pIrp->Tail.Overlay.Thread = PsGetCurrentThread();
>> > >> >> > pIrp->RequestorMode = KernelMode;
>> > >> >> > pIrp->Flags = 0;
>> > >> >> >
>> > >> >> > // Set up the I/O stack location.
>> > >> >> > pIoStackLocation = IoGetNextIrpStackLocation (pIrp);
>> > >> >> > pIoStackLocation->MajorFunction = IRP_MJ_PNP;
>> > >> >> > pIoStackLocation->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
>> > >> >> > pIoStackLocation->DeviceObject = pDeviceObject;
>> > >> >> > pIoStackLocation->FileObject = pFileObject;
>> > >> >> > pIoStackLocation->Parameters.QueryDeviceRelations.Type =
>> > >> >> >TargetDeviceRelation;
>> > >> >> > IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
>> > >> >> >
>> > >> >> > // Set the completion routine.
>> > >> >> > IoSetCompletionRoutine (pIrp, sfQueryRelationsComplete, 0,
>> >TRUE,
>> > >> >>TRUE,
>> > >> >> >TRUE);
>> > >> >> >
>> > >> >> > // Send it to the FSD
>> > >> >> > (void) IoCallDriver (pDeviceObject, pIrp);
>> > >> >> >
>> > >> >> > // Wait for the I/O
>> > >> >> > KeWaitForSingleObject (&event, Executive, KernelMode, TRUE, 0);
>> > >> >> >
>> > >> >> > pDevice_Relations = (PDEVICE_RELATIONS )IoStatusBlock.Information;
>> > >> >> > KdPrint ((“count d\n”, pDevice_Relations->Count));
>> > >> >> > pDevObj = (PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> > >> >> > KdPrint ((“pDevjObj devtype: x flags x\n”, pDevObj->DeviceType,
>> > >> >> >pDevObj->Flags));
>> > >> >> > (PDEVICE_OBJECT) *pPhysicalDeviceObject =
>> > >> >> >(PDEVICE_OBJECT)pDevice_Relations->Objects[0];
>> > >> >> >
>> > >> >> > // Done! Note that since our completion routine frees the IRP
>> >we
>> > >> >>cannot
>> > >> >> > // touch the IRP now.
>> > >> >> > return NT_SUCCESS (IoStatusBlock.Status);
>> > >> >> >}
>> > >> >> >
>> > >> >> >NTSTATUS
>> > >> >> >sfQueryRelationsComplete(
>> > >> >> > PDEVICE_OBJECT pDeviceObject,
>> > >> >> > PIRP pIrp,
>> > >> >> > PVOID pContext)
>> > >> >> >{
>> > >> >> > // Copy the status information back into the “user” IOSB.
>> > >> >> > *pIrp->UserIosb = pIrp->IoStatus;
>> > >> >> > if( !NT_SUCCESS(pIrp->IoStatus.Status) )
>> > >> >> > KdPrint((“ERROR ON IRP!!!: x\n”,
>> >pIrp->IoStatus.Status
>> > >> >>));
>> > >> >> >
>> > >> >> > // Set the user event - wakes up the mainline code doing this.
>> > >> >> > KeSetEvent(pIrp->UserEvent, 0, FALSE);
>> > >> >> >
>> > >> >> > // Free the IRP now that we are done with it.
>> > >> >> > IoFreeIrp(pIrp);
>> > >> >> >
>> > >> >> > // We return STATUS_MORE_PROCESSING_REQUIRED because this
>> >“magic”
>> > >> >>return
>> > >> >> >value
>> > >> >> > // tells the I/O Manager that additional processing will be
>> >done
>> > >>by
>> > >> >>this
>> > >> >> >driver
>> > >> >> > // to the IRP - in fact, it might (as it is in this case)
>> >already
>> > >>BE
>> > >> >> >done - and
>> > >> >> > // the IRP cannot be completed.
>> > >> >> > return STATUS_MORE_PROCESSING_REQUIRED;
>> > >> >> >}
>> > >> >> >
>> > >> >> >In sfMountCompletion routine
>> > >> >> >===========================
>> > >> >> >if (NT_SUCCESS (sfQueryRelations (RealDeviceObject,
>> > >>pIrpSp->FileObject,
>> > >> >> >&PhyDevObj)))
>> > >> >> >{
>> > >> >> > KdPrint ((“Success! DevType x Flags x\n”, PhyDevObj->DeviceType,
>> > >> >> >PhyDevObj->Flags));
>> > >> >> >}
>> > >> >> >
>> > >> >> >regprop = DevicePropertyBusTypeGuid;
>> > >> >> >ntstatus = IoGetDeviceProperty (PhyDevObj, regprop, sizeof(guid),
>> > >>&guid,
>> > >> >> >&ulSize);
>> > >> >> >
>> > >> >> >if (NT_SUCCESS (ntstatus))
>> > >> >> >{
>> > >> >> > KdPrint ((“Guid : data 4: x data 1: x\n”, guid.Data4,
>> >guid.Data1));
>> > >> >> >}
>> > >> >> >else
>> > >> >> >{
>> > >> >> > KdPrint ((“IoGetDeviceProperty failed\n”));
>> > >> >> > if (ntstatus == STATUS_BUFFER_TOO_SMALL)
>> > >> >> > KdPrint ((“STATUS_BUFFER_TOO_SMALL\n”));
>> > >> >> > else if (ntstatus == STATUS_INVALID_PARAMETER_2)
>> > >> >> > KdPrint ((“STATUS_INVALID_PARAMETER_2\n”));
>> > >> >> > else if (ntstatus == STATUS_INVALID_DEVICE_REQUEST)
>> > >> >> > KdPrint ((“STATUS_INVALID_DEVICE_REQUEST\n”));
>> > >> >> >}
>> > >> >> >
>> > >> >> >
>> > >> >> >
>> > >> >> >>From: “Maxim S. Shatskih”
>> > >> >> >>Reply-To: “Windows System Software Devs Interest List”
>> > >> >> >>
>> > >> >> >>To: “Windows System Software Devs Interest List”
>> > >>
>> > >> >> >>Subject: [ntdev] Re: disk type (Unsigned Mail)
>> > >> >> >>Date: Thu, 9 Oct 2003 06:41:59 +0400
>> > >> >> >>
>> > >> >> >> > What deviceobject should i use to query?
>> > >> >> >> > vpb->realdevice?
>> > >> >> >>
>> > >> >> >>Send MN_QUERY_RELATIONS/TargetDeviceRelation to Vpb->RealDevice
>> >and
>> > >>then
>> > >> >> >>IoGetDeviceProperty to this returned PDO.
>> > >> >> >>
>> > >> >> >> > and does iogetdeviceproperty works in win 2k?
>> > >> >> >>
>> > >> >> >>Surely.
>> > >> >> >>
>> > >> >> >>Maxim Shatskih, Windows DDK MVP
>> > >> >> >>StorageCraft Corporation
>> > >> >> >>xxxxx@storagecraft.com
>> > >> >> >>http://www.storagecraft.com
>> > >> >> >>
>> > >> >> >>
>> > >> >> >>—
>> > >> >> >>Questions? First check the Kernel Driver FAQ at
>> > >> >> >>http://www.osronline.com/article.cfm?id=256
>> > >> >> >>
>> > >> >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >> >> >>To unsubscribe send a blank email to
>> >xxxxx@lists.osr.com
>> > >> >> >
>> > >> >> >
>> > >> >> >Find love on MSN Personals http://personals.msn.com.sg/
>> > >> >> >
>> > >> >> >
>> > >> >> >—
>> > >> >> >Questions? First check the Kernel Driver FAQ at
>> > >> >>http://www.osronline.com/article.cfm?id=256
>> > >> >> >
>> > >> >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >> >> >To unsubscribe send a blank email to
>> >xxxxx@lists.osr.com
>> > >> >> >.
>> > >> >>
>> > >> >>= = = = = = = = = = = = = = = = = = = =
>> > >> >>
>> > >> >>
>> > >> >>???
>> > >> >>???
>> > >> >>
>> > >> >>
>> > >> >>???george
>> > >> >>???xxxxx@hotmail.com
>> > >> >>???2003-10-10
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>—
>> > >> >>Questions? First check the Kernel Driver FAQ at
>> > >> >>http://www.osronline.com/article.cfm?id=256
>> > >> >>
>> > >> >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
>> > >> >
>> > >> >

>> > >> >Take a break! Find destinations on MSN Travel.
>> > >>http://www.msn.com.sg/travel/
>> > >> >
>> > >> >
>> > >> >—
>> > >> >Questions? First check the Kernel Driver FAQ at
>> > >>http://www.osronline.com/article.cfm?id=256
>> > >> >
>> > >> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>> > >> >.
>> > >>
>> > >>= = = = = = = = = = = = = = = = = = = =
>> > >>
>> > >>
>> > >>???
>> > >>???
>> > >>
>> > >>
>> > >>???george
>> > >>???xxxxx@hotmail.com
>> > >>???2003-10-10
>> > >>
>> > >>
>> > >>
>> > >>—
>> > >>Questions? First check the Kernel Driver FAQ at
>> > >>http://www.osronline.com/article.cfm?id=256
>> > >>
>> > >>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >>To unsubscribe send a blank email to xxxxx@lists.osr.com
>> > >
>> > >
>> > >Download games, logos, wallpapers and lots more at MSN Mobile!
>> > >http://www.msn.com.sg/mobile/
>> > >
>> > >
>> > >—
>> > >Questions? First check the Kernel Driver FAQ at
>> >http://www.osronline.com/article.cfm?id=256
>> > >
>> > >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
>> > >.
>> >
>> >= = = = = = = = = = = = = = = = = = = =
>> >
>> >
>> >???
>> >???
>> >
>> >
>> >???george
>> >???xxxxx@hotmail.com
>> >???2003-10-13
>> >
>> >
>> >
>> >—
>> >Questions? First check the Kernel Driver FAQ at
>> >http://www.osronline.com/article.cfm?id=256
>> >
>> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>

>> Find love on MSN Personals http://personals.msn.com.sg/
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

= = = = = = = = = = = = = = = = = = = =

???
???

???george
???xxxxx@hotmail.com
???2003-10-14