Re: [ntfsd] Re: [ntfsd] RE: How to use ZwOpenSymbolicLinkObject and ZwQuerySymbolicLinkObject?

Hi Jamey,Srin and Ryan:
Thank you very much.Without your help maybe I’ll have to spend more time on such routines.

Jim

You are passing the handle but have not allocated any memory to the
pointer. May I suggest something like this:

HANDLE Handle;
ZwOpenSymbolicLinkObject(&Handle,GENERIC_READ,&ObjectAttributes);

Or

HANDLE Handle;
PHANDLE pHandle = &Handle;
ZwOpenSymbolicLinkObject(pHandle,GENERIC_READ,&ObjectAttributes);

They are both the same except you use an extra bit of stack space in the
second example; which we know we should avoid since we only have 12K of
KM stack to use.

Also:

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

It is a two parameter function that is documented in the DDK. How is it
possible to not understand how this function works?

Also:

In the world of Microsoft, DOS, Windows, etc…, we use \, not // like
in the various flavors of *nix.

Also:

if(!NT_SUCCESS(ZwQuerySymbolicLinkObject(*Handle,&DeviceName,&RetNum)))

*Handle should be &Handle or, in my second example at the top, it would
be pHandle.

Also:

I will stop here…

Jamey

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

Hi Srin:
I have to admit that i’m new learner on driver(especially FSD)
development.That’s why i come here asking for help.All the DDK routines
are strange to me.I don’t think it’s a shame to make mistakes when using
them.
But i don’t agree to your conclusion “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”.Could u tell me what’s
wrong with the sentence
“ZwOpenSymbolicLinkObject(Handle,GENERIC_READ,&ObjectAttributes)”?In
fact I have succeed in getting STATUS_SUCCESS as the returned value.I
modified some other sentences,but this one not included.
I don’t mean to enkindle an argument.I have learned a lot here and
i hope to continue.I’m very thankful to those who answered my
quesions.But i don’t want to be blamed like that.
Anyway,thank you for noticing my question.I wish i can continue in
gaining your help.

Jim
BTW:English is not my mother tongue.I’m sorry if anybody offended by my
words.

ZwOpenSymbolicLinkObject(Handle,GENERIC_READ,&ObjectAttributes)
> 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@netease.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


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