Hard disk filter driver

Hi ,
i am building a filter driver over the current
harddisk driver.

I am trying to get a pointer to the existing hdd
device object using the following code

RtlInitUnicodeString( &TargetDeviceName ,
L"\Device\HarddiskVolume1" );

// \device\harddiskvolume1 corresponds to the C:
// drive in my system

if( IoGetDeviceObjectPointer( &TargetDeviceName ,
FILE_READ_DATA , &fileob , &TargetDevice ) !=
STATUS_SUCCESS )
DbgPrint( "Couldnt get pointer to harddisk " );
else
DbgPrint( "Could get pointer to harddisk " );

i always get the message “couldnt get the pointer to
harddisk”

please tell me whats going wrong.

-Thanks,
-Regards,
-Harshal


Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Harshal,

If nothing else - try changing, everywhere in your code, the direct
comparison:

!= STATUS_SUCCESS

to use the macro:

NT_SUCCESS(status)

I don’t know if this is the problem in this specific case, but in general -
it is possible for an API to return more than one success code. The macro
is “smart enough” to let through multiple success codes in addition to
STATUS_SUCCESS. Hopefully this will fix the problem, but if not, at least
you will have better code to show for it.

-Evan

if( IoGetDeviceObjectPointer( &TargetDeviceName ,
FILE_READ_DATA , &fileob , &TargetDevice ) !=
STATUS_SUCCESS )
DbgPrint( "Couldnt get pointer to harddisk " );
else
DbgPrint( "Could get pointer to harddisk " );


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com