Hello All,
There are some issue that need your help and advice:
When I try to access the harddrive directly to get some information from MBR, I always get a problem with IoCreateFile. It will retrun STATUS_OBJECT_PATH_NOT_FOUND.
However, this code works ok during the term of debugging, when I logon as administrator and start the driver service manually.
Part of codes as following:
//===================
RtlInitUnicodeString (&ustrDevName, L"\Device\Harddisk0\DR0");
InitializeObjectAttributes (&ObjAttr, &ustrDevName, OBJ_CASE_INSENSITIVE , NULL, NULL);
Status = IoCreateFile (&FileHandle, GENERIC_READ, &ObjAttr, &IOStatusBlk, NULL, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN,
FILE_NON_DIRECTORY_FILE |FILE_SYNCHRONOUS_IO_NONALERT,
NULL, 0, CreateFileTypeNone, NULL, IO_NO_PARAMETER_CHECKING);
DbgPrint((“NWF!GetMBRInfo: IoCreateFile result "%wZ", Status=%08x\n”, &ustrDevName, Status));
//====================
Thanks for any kind of help:)
Try ??\PhysicalDrive0
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntfsd…
> Hello All,
>
> There are some issue that need your help and advice:
>
> When I try to access the harddrive directly to get some information from MBR,
I always get a problem with IoCreateFile. It will retrun
STATUS_OBJECT_PATH_NOT_FOUND.
>
> However, this code works ok during the term of debugging, when I logon as
administrator and start the driver service manually.
>
> Part of codes as following:
>
> //===================
> RtlInitUnicodeString (&ustrDevName,
L"\Device\Harddisk0\DR0");
> InitializeObjectAttributes (&ObjAttr, &ustrDevName, OBJ_CASE_INSENSITIVE ,
NULL, NULL);
>
> Status = IoCreateFile (&FileHandle, GENERIC_READ, &ObjAttr, &IOStatusBlk,
NULL, FILE_ATTRIBUTE_NORMAL,
> FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN,
> FILE_NON_DIRECTORY_FILE |FILE_SYNCHRONOUS_IO_NONALERT,
> NULL, 0, CreateFileTypeNone, NULL, IO_NO_PARAMETER_CHECKING);
> DbgPrint((“NWF!GetMBRInfo: IoCreateFile result "%wZ", Status=%08x\n”,
&ustrDevName, Status));
> //====================
>
> Thanks for any kind of help:)
>
Thanks, but the result is same.
Is there any other executions that need to be loaded ahead so that the device can be located by it’s object name?
Oh, this time, the call will return STATUS_OBJECT_NAME_NOT_FOUND, instead of STATUS_OBJECT_PATH_NOT_FOUND.