RE: How to use ZwOpenSymbolicLinkObject and ZwQuerySymbolicLinkObject?

I’m amazed that even compiles (must be a .c file, this is why you should
compile everything as .cpp). Do this:

OBJECT_ATTRIBUTES attribs;
UNICODE_STRING linkName;

RtlInitUnicodeString(&linkName, L"\DosDevices\C:");

InitializeObjectAttributes(&attribs, &linkName, OBJ_KERNEL_HANDLE, NULL,
NULL).

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jim Zhong
Sent: Wednesday, April 30, 2003 8:26 PM
To: File Systems Developers
Subject: [ntfsd] How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

Hi:
Here are my codes about using ZwOpenSymbolicLinkObject
and ZwQuerySymbolicLinkObject.There must be something wrong
with them.But i don’t know where it is.

PDEVICE_OBJECT PointertoC;
PFILE_OBJECT FilePointertoC;
UNICODE_STRING DeviceName;
OBJECT_ATTRIBUTES ObjectAttributes;
PHANDLE Handle=NULL;
ULONG RetNum;

InitializeObjectAttributes(&ObjectAttributes,L"//DosDevices//C
:",NULL,NULL,NULL);

if(!NT_SUCCESS(ZwOpenSymbolicLinkObject(Handle,GENERIC_READ,&O
bjectAttributes)))
KdPrint((“ZwOpenSymbolicLinkObject failed\n”));

//I don’t know how to use RtlInitUnicodeString.so…
RtlInitUnicodeString(&DeviceName,L"//device//Ddddddddddddddddd
ddddddddddddddddddd:");

if(!NT_SUCCESS(ZwQuerySymbolicLinkObject(*Handle,&DeviceName,&
RetNum)))
KdPrint((“ZwQuerySymbolicLinkObject failed\n”));

if(!NT_SUCCESS(IoGetDeviceObjectPointer(&DeviceName,FILE_READ_
DATA,&FilePointertoC,&PointertoC)))
KdPrint((“IoGetDeviceObjectPointer failed\n”));

ZwOpenSymbolicLinkObject() doesn’t return
STATUS_SUCCESS.What’s the problem?

Thanks!

Jim


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Ryan,
I believe the developer/student first needs to learn programming
in C. Look at what he is passing as handle to ZwOpenSymbolicLinkObject.
When some one programs this way it does not matter what they compile as
.cpp or .c

-Srin.

-----Original Message-----
From: Nicholas Ryan [mailto:xxxxx@nryan.com]
Sent: Thursday, May 01, 2003 1:02 AM
To: File Systems Developers
Subject: [ntfsd] RE: How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

I’m amazed that even compiles (must be a .c file, this is why you should
compile everything as .cpp). Do this:

OBJECT_ATTRIBUTES attribs;
UNICODE_STRING linkName;

RtlInitUnicodeString(&linkName, L"\DosDevices\C:");

InitializeObjectAttributes(&attribs, &linkName, OBJ_KERNEL_HANDLE, NULL,
NULL).

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jim Zhong
Sent: Wednesday, April 30, 2003 8:26 PM
To: File Systems Developers
Subject: [ntfsd] How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

Hi:
Here are my codes about using ZwOpenSymbolicLinkObject
and ZwQuerySymbolicLinkObject.There must be something wrong
with them.But i don’t know where it is.

PDEVICE_OBJECT PointertoC;
PFILE_OBJECT FilePointertoC;
UNICODE_STRING DeviceName;
OBJECT_ATTRIBUTES ObjectAttributes;
PHANDLE Handle=NULL;
ULONG RetNum;

InitializeObjectAttributes(&ObjectAttributes,L"//DosDevices//C
:",NULL,NULL,NULL);

if(!NT_SUCCESS(ZwOpenSymbolicLinkObject(Handle,GENERIC_READ,&O
bjectAttributes)))
KdPrint((“ZwOpenSymbolicLinkObject failed\n”));

//I don’t know how to use RtlInitUnicodeString.so…
RtlInitUnicodeString(&DeviceName,L"//device//Ddddddddddddddddd
ddddddddddddddddddd:");

if(!NT_SUCCESS(ZwQuerySymbolicLinkObject(*Handle,&DeviceName,&
RetNum)))
KdPrint((“ZwQuerySymbolicLinkObject failed\n”));

if(!NT_SUCCESS(IoGetDeviceObjectPointer(&DeviceName,FILE_READ_
DATA,&FilePointertoC,&PointertoC)))
KdPrint((“IoGetDeviceObjectPointer failed\n”));

ZwOpenSymbolicLinkObject() doesn’t return
STATUS_SUCCESS.What’s the problem?

Thanks!

Jim


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Dido!

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@NAI.com
Sent: Thursday, May 01, 2003 9:24 AM
To: File Systems Developers
Subject: [ntfsd] RE: How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

Ryan,
I believe the developer/student first needs to learn programming
in C. Look at what he is passing as handle to ZwOpenSymbolicLinkObject.
When some one programs this way it does not matter what they compile as
.cpp or .c

-Srin.

-----Original Message-----
From: Nicholas Ryan [mailto:xxxxx@nryan.com]
Sent: Thursday, May 01, 2003 1:02 AM
To: File Systems Developers
Subject: [ntfsd] RE: How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

I’m amazed that even compiles (must be a .c file, this is why you should
compile everything as .cpp). Do this:

OBJECT_ATTRIBUTES attribs;
UNICODE_STRING linkName;

RtlInitUnicodeString(&linkName, L"\DosDevices\C:");

InitializeObjectAttributes(&attribs, &linkName, OBJ_KERNEL_HANDLE, NULL,
NULL).

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jim Zhong
Sent: Wednesday, April 30, 2003 8:26 PM
To: File Systems Developers
Subject: [ntfsd] How to use ZwOpenSymbolicLinkObject and
ZwQuerySymbolicLinkObject?

Hi:
Here are my codes about using ZwOpenSymbolicLinkObject
and ZwQuerySymbolicLinkObject.There must be something wrong
with them.But i don’t know where it is.

PDEVICE_OBJECT PointertoC;
PFILE_OBJECT FilePointertoC;
UNICODE_STRING DeviceName;
OBJECT_ATTRIBUTES ObjectAttributes;
PHANDLE Handle=NULL;
ULONG RetNum;

InitializeObjectAttributes(&ObjectAttributes,L"//DosDevices//C
:",NULL,NULL,NULL);

if(!NT_SUCCESS(ZwOpenSymbolicLinkObject(Handle,GENERIC_READ,&O
bjectAttributes)))
KdPrint((“ZwOpenSymbolicLinkObject failed\n”));

//I don’t know how to use RtlInitUnicodeString.so…
RtlInitUnicodeString(&DeviceName,L"//device//Ddddddddddddddddd
ddddddddddddddddddd:");

if(!NT_SUCCESS(ZwQuerySymbolicLinkObject(*Handle,&DeviceName,&
RetNum)))
KdPrint((“ZwQuerySymbolicLinkObject failed\n”));

if(!NT_SUCCESS(IoGetDeviceObjectPointer(&DeviceName,FILE_READ_
DATA,&FilePointertoC,&PointertoC)))
KdPrint((“IoGetDeviceObjectPointer failed\n”));

ZwOpenSymbolicLinkObject() doesn’t return
STATUS_SUCCESS.What’s the problem?

Thanks!

Jim


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com