Re: ZwOpenFile helppppppppp by Alex
Alex
Mon May 31 21:36:32 CDT 2004
Thank Alex!
So which value must be used for it ?
For a normal file ( text file ) , and for a Device ( Comm Port ) . I only
tried to pass different values to get true result . In DDK wrote nothing
about it !
damm ..
"Alex the 1'ts" <AlX@a> wrote in message
news:OrgLnzxREHA.2496@TK2MSFTNGP11.phx.gbl...
> NTSTATUS 0x0C000000D is "STATUS_INVALID_PARAMETER"
>
> So, double check your parameters, re-read the ddk documentation for
> ZwOpenFile, and, don' use something you don't understand or didn't check
out
> in the DDK first, example, why did you used "OBJ_EXCLUSIVE"?
>
> Did you looked in DDK what OBJ_EXCLUSIVE is used for?
>
>
>
> "Alex" <Chipheo2k@hotmail.com> wrote in message
> news:ujGwCnvREHA.3660@tk2msftngp13.phx.gbl...
>
> > Thank you so much ! Gram !
> > In fact , I must Open COM port in my driver , but I tried to open a
> normal
> > file first, and have not openned it . So I do not understand why .
> > I have deleted the lines KeRaiseIrdl . And tried with path
> > \\??\\C:\\test.out . and always get errors. Maybe in
> > InitializeObjectAttrbutes??
> > If you have any idea about openning COM port , pls help me directly with
> COM
> > . I am now very confuse .
> > Waiting for help from you !
> > Thank you so much !
> >
> > HANDLE fileOpen;
> > OBJECT_ATTRIBUTES objAttr;
> > UNICODE_STRING sLinkName;
> > #define COM_NAME L"\\??\\C:\\test.out"
> > RtlInitUnicodeString( &sLinkName, COM_NAME);
> >
> > InitializeObjectAttributes(
> > &objAttr,
> > &sLinkName,
> > OBJ_EXCLUSIVE,
> > NULL,
> > NULL);
> >
> > LARGE_INTEGER nSize;
> > IO_STATUS_BLOCK ioStat;
> >
> >
> > NTSTATUS statusOpen = ZwOpenFile(
> > OUT &fileOpen,
> > IN FILE_READ_DATA | FILE_WRITE_DATA,
> > IN &objAttr,
> > OUT &ioStat,
> > IN FILE_SHARE_READ,
> > IN FILE_NON_DIRECTORY_FILE
> > );
> >
> >
> > DbgPrint("statusOpen= %X.", statusOpen); // return statusOpen=
> > C000000D.
> >
> >
> >
> >
> >
> >
> > "Gram" <anonymous@discussions.microsoft.com> wrote in message
> > news:FF8EF646-4089-4998-B330-E7F53392341E@microsoft.com...
> > > Alex,
> > > You did not specify how exactly did the ZwOpenFile failed, more
details
> > could be useful...
> > > You cannot access files with this path, try \\??\\C:\\test.out.
> > > Also, why do you use KeRaiseIrql? PASSIVE_LEVEL is the lowest and if
you
> > aren't already there
> > > you should not try to use the ZwOpenFile?
> > >
> > > G.
> > >
> >
> >
>
>