If you are in kernel mode, you should specify OBJ_KERNEL_HANDLE. That would
fix the problem you are seeing if you are performing these operations in
different process contexts.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: Mahammadrafi Maniyar [mailto:xxxxx@tataelxsi.co.in]
Sent: Monday, June 24, 2002 12:04 AM
To: NT Developers Interest List
Subject: [ntdev] Re: ZwWriteFile failed
Thanx Dan,
Ya i am checking the return value of ZwCreateFile it showing me status 0.
i am posting the code which i am using to create and write to file.
i am posting the ZwCreatFile parameters which i used to create a file.
InitializeObjectAttributes ( &ObjectAttributes,
&FullFileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL );
ntStatus = ZwCreateFile( &FileHandle,
GENERIC_WRITE,
&ObjectAttributes,
&IoStatus,
NULL, // alloc size =
none
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE,
FILE_OVERWRITE_IF,
FILE_NON_DIRECTORY_FILE ,
NULL, // eabuffer
0 ); // ealength
and the write call have these parameters
ntStatus = ZwWriteFile ( FileHandle,
NULL,
NULL,
NULL,
&IoStatus,
temp,
sizeof(int),
0,
NULL);
Dan Partelly wrote:
STATUS_OBJECT_TYPE_MISMATCH is the result of the fact that the passed
handle
is not reffering to a IoFileObjectType
object. Internaly ZwWriteFile wil translate this handle to an object
pointer, and it will try to validate it as a file object.
If this check aint true, it will give back this status.
My guess is that you pass a incorect handle to ZwWriteFile. You did
checked
the return Status if your ZwCreateFile , isnt it ? Make sure the function
succeds. Cause I think it aint.
You are currently subscribed to ntdev as: xxxxx@tataelxsi.co.in
To unsubscribe send a blank email to %%email.unsub%%
–
: MdRafi Maniyar : Networking & Comm. Gp, Tata Elxsi Ltd |
: Phone : +91-80-8410222 Fax : +91-80-8410219 __________|
You are currently subscribed to ntdev as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%