Yes you can use the symbolic link name.
When is your filter driver running this code? Are you doing this during
boot? If so there’s a strong chance that the disk drivers won’t have
been initialized yet in which case you can’t see the partitions.
Can you step back a second and explain what your filter driver is trying
to do that you need to open a raw partition by name and write to it?
What are you filtering? What is it you’re trying to write to the disk?
There’s been a lot of focus on your use of UNICODE_STRING, but i’m more
curious about whether the goal you’re chasing is really going to get you
what you want.
-p
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of yuvraj rege
Sent: Sunday, March 05, 2006 1:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] how to access the raw partition
Hello Sir ,
I have tried the pathname “\Device\Harddisk0\Partition2”. Now the
syntax problem is solved because I have used
FileName.Length= FileName.Length - sizeof(WCHAR);
to ommit the NULL from my path.
But this time the new result encountered is STATUS_OBJECT_NOT_FOUND.
I am using Device Tree for finding right object .How can I find the
right object?
Can I use the sysmbolic link? I am doubtfull about that.
Regards
Yuvraj Rege
NTSTATUS
WcdCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
UNICODE_STRING FileName;
NTSTATUS ntStatus;
HANDLE FileHandle;
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR PathPrefix =
L"\Device\Harddisk0\Partition2";
ULONG FileNameLength;
IO_STATUS_BLOCK IoStatus;
char *result;
UNREFERENCED_PARAMETER(DeviceObject);
Irp->IoStatus.Status = STATUS_SUCCESS;
file://ZwCreateFile stuff
RtlInitUnicodeString(&FileName, PathPrefix);
FileName.Length= FileName.Length - sizeof(WCHAR);
InitializeObjectAttributes ( &ObjectAttributes,
&FileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL );
ntStatus= ZwCreateFile(
&FileHandle,
FILE_READ_DATA | FILE_WRITE_DATA,
&ObjectAttributes,
&IoStatus,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN_IF,
FILE_NON_DIRECTORY_FILE,
NULL,
0
);
result=OsrNTStatusToString(ntStatus);
DbgPrint(“\n\n%s”,result);
ZwClose( FileHandle );
DbgPrint(“\n\nWCD : WCD_Create called”);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
} // end WcdCreate()
Jiyo cricket on Yahoo! India cricket
http:cricket/>
Yahoo! Messenger Mobile
http:hoo.com/new/messenger/> Stay in touch with your buddies all the time.
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</http:></http:>