Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using
exallocate.
Now i want to read from that file in another thread. But i am not able to do
so.
the status returned is0xc000000d which stands for a parameter problem, when
i do
a zwreadfile in another thread. what could be the problem

thanks
mayank

Did you specifiy OBJ_KERNEL_HANDLE? Are both threads system threads? Handles
are process specific.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 12:52 PM
To: NT Developers Interest List
Subject: [ntdev] Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using exallocate. Now i want to read from that file in another
thread. But i am not able to do so. the status returned is0xc000000d which
stands for a parameter problem, when i do a zwreadfile in another thread.
what could be the problem

thanks
mayank


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

Did you specify OBJ_KERNEL_HANDLE when initializing the object
attributes for ZwCreateFile? This will allow you to use the handle in
the context of any process (and fixes a security problem to boot).

Mayank Kumar wrote:

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using
exallocate.
Now i want to read from that file in another thread. But i am not able to do
so.
the status returned is0xc000000d which stands for a parameter problem, when
i do
a zwreadfile in another thread. what could be the problem

thanks
mayank


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

  • Nick Ryan (MVP for DDK)

no , i did not specify OBJ_KERNEL_HANDLE in initializeobjectattributes.
One of the threads is a user mode thread ,because the file gets created as
result of an
ioctl call (arbitrary thread context) and the file is accessed via a driver
created thread.

what should i do??
Mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, July 11, 2003 10:24 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

Did you specifiy OBJ_KERNEL_HANDLE? Are both threads system threads? Handles
are process specific.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 12:52 PM
To: NT Developers Interest List
Subject: [ntdev] Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using exallocate. Now i want to read from that file in another
thread. But i am not able to do so. the status returned is0xc000000d which
stands for a parameter problem, when i do a zwreadfile in another thread.
what could be the problem

thanks
mayank


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


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

If you are planning to run this code on NT. OBJ_KERNEL_HANDLE would not
work on NT.

-Srin.

-----Original Message-----
From: Nick Ryan [mailto:xxxxx@nryan.com]
Sent: Friday, July 11, 2003 10:02 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Shared access to file handle

Did you specify OBJ_KERNEL_HANDLE when initializing the object
attributes for ZwCreateFile? This will allow you to use the handle in
the context of any process (and fixes a security problem to boot).

Mayank Kumar wrote:

> Hi all,
> i am facing the following problem.
> I am creating a file in thread x and storing its handle in a data
structure
> allocated using
> exallocate.
> Now i want to read from that file in another thread. But i am not
able
to do
> so.
> the status returned is0xc000000d which stands for a parameter
problem,
when
> i do
> a zwreadfile in another thread. what could be the problem
>
> thanks
> mayank
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nryan.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

  • Nick Ryan (MVP for DDK)

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

Schedule a work queue item from your IOCTL and create the file in system
context and use the file in system thread context.

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 10:11 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

no , i did not specify OBJ_KERNEL_HANDLE in
initializeobjectattributes.
One of the threads is a user mode thread ,because the file gets
created as
result of an
ioctl call (arbitrary thread context) and the file is accessed via a
driver
created thread.

what should i do??
Mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, July 11, 2003 10:24 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

Did you specifiy OBJ_KERNEL_HANDLE? Are both threads system threads?
Handles
are process specific.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 12:52 PM
To: NT Developers Interest List
Subject: [ntdev] Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data
structure
allocated using exallocate. Now i want to read from that file in
another
thread. But i am not able to do so. the status returned is0xc000000d
which
stands for a parameter problem, when i do a zwreadfile in another
thread.
what could be the problem

thanks
mayank


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


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

Use OBJ_KERNEL_HANDLE.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 1:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

no , i did not specify OBJ_KERNEL_HANDLE in initializeobjectattributes. One
of the threads is a user mode thread ,because the file gets created as
result of an ioctl call (arbitrary thread context) and the file is accessed
via a driver created thread.

what should i do??
Mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, July 11, 2003 10:24 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

Did you specifiy OBJ_KERNEL_HANDLE? Are both threads system threads? Handles
are process specific.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 12:52 PM
To: NT Developers Interest List
Subject: [ntdev] Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using exallocate. Now i want to read from that file in another
thread. But i am not able to do so. the status returned is0xc000000d which
stands for a parameter problem, when i do a zwreadfile in another thread.
what could be the problem

thanks
mayank


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


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

Hi All
using this flag OBJ_KERNEL_HANDLE has solved the problem
Thanks
Mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, July 11, 2003 10:45 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

Use OBJ_KERNEL_HANDLE.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 1:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

no , i did not specify OBJ_KERNEL_HANDLE in initializeobjectattributes. One
of the threads is a user mode thread ,because the file gets created as
result of an ioctl call (arbitrary thread context) and the file is accessed
via a driver created thread.

what should i do??
Mayank

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, July 11, 2003 10:24 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Shared access to file handle

Did you specifiy OBJ_KERNEL_HANDLE? Are both threads system threads? Handles
are process specific.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Mayank Kumar [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Friday, July 11, 2003 12:52 PM
To: NT Developers Interest List
Subject: [ntdev] Shared access to file handle

Hi all,
i am facing the following problem.
I am creating a file in thread x and storing its handle in a data structure
allocated using exallocate. Now i want to read from that file in another
thread. But i am not able to do so. the status returned is0xc000000d which
stands for a parameter problem, when i do a zwreadfile in another thread.
what could be the problem

thanks
mayank


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


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


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


You are currently subscribed to ntdev as:
xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com