Hi all,
I got strange & funny things when developping a pseudo disk driver.
My idea is as simple as this: create some pseudo disk devices and and
redirect all Irps to the real volume object. To foo system that there
are several different volumes.
During debugging, I got the funny thing:
1, IoGetDeviceObjectPointer could only work in DriverEntry. It always
fails if I call it in IRP_MJ_DEVICE_CONTROL handler routine.
2, The pseudo disk deviceobjects:
I must create these deviceobjects in DriverEntry too 
No any irps could be received if I create these DeviceObjects in
my IRP_MJ_DEVICE_CONTROL routine. The mount point could be built
via DefineDosDevice in user mode ap or IoCreateSymbolicLink in kernel
driver. But the mounted point does not function as expected. And my
driver gets no irps from system. 
If I do all the work in DriverEntry, everything works as expected.
Anyone has a clue ?
Matt
Sounds like you didn’t clear DO_DEVICE_INITIALIZING flag in the device object
that you created. If the device object was created in the DriverEntry the
flag is cleared for you by the OS, otherwise you need to do it your self.
Alexei.
2, The pseudo disk deviceobjects:
I must create these deviceobjects in DriverEntry too 
No any irps could be received if I create these DeviceObjects in
my IRP_MJ_DEVICE_CONTROL routine. The mount point could be built
via DefineDosDevice in user mode ap or IoCreateSymbolicLink in kernel
driver. But the mounted point does not function as expected. And my
driver gets no irps from system. 
If I do all the work in DriverEntry, everything works as expected.
Great! That’s just the reason of problem 2 !
Thanks Alexei: It seems that you are just prepared for my questions. 
Matt
Sounds like you didn’t clear DO_DEVICE_INITIALIZING flag in the device object
that you created. If the device object was created in the DriverEntry the
flag is cleared for you by the OS, otherwise you need to do it your self.
Alexei.
2, The pseudo disk deviceobjects:
I must create these deviceobjects in DriverEntry too 
No any irps could be received if I create these DeviceObjects in
my IRP_MJ_DEVICE_CONTROL routine. The mount point could be built
via DefineDosDevice in user mode ap or IoCreateSymbolicLink in kernel
driver. But the mounted point does not function as expected. And my
driver gets no irps from system. 
If I do all the work in DriverEntry, everything works as expected.