Re: determining process context
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxx>
- Date: Sat, 23 Jul 2005 11:07:24 -0400
You have to create a thread with the correct process context, i.e get the
process handle of the current process in the DISPATCH routine, and then
create a thread to perform the request.
Obviously, there are optimizations here depending on known use patterns, for
instance I suspect that most requests will come from one, or a limited
number of processes, so you have a thread for each process to do the
mapping. Also, you need to handle the case where the process goes away.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"David" <know_devig@xxxxxxxxxxx> wrote in message
news:1122130783.339225.155920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi Don,
> In one of the discussions on such topic you had suggested alternative
> approach to IFS kit. I am trying to implement that, i.e. Sending IOCTL
> from application and performing wait in Kernel in a thread created
> using PsCreateSystemThread (In dispatch routine)
> But if PsCreateSystemThread doesnt put u in User context then is there
> any other way to wait in kernel, without blocking other IOCTL
> operations.
> Your help is really appreciated.
>
> - David
> Don Burn wrote:
>> "David" <know_devig@xxxxxxxxxxx> wrote in message
>> news:1122099525.124179.295440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> > Does that mean, when it runs under system process context it is
>> > essentially same "Application" process context by which this dispatch
>> > routine is called?
>> > Reason of this question is, I need to access buffer pointer from IRP
>> > which has User virtual address and in order to access that, i need to
>> > be in same process context else i will corrupt some memory.
>> > So am i doing it correctly by running PsCreateSystemThread in system
>> > process context ? if not, what do I need to do to achieve this?
>> >
>> > - David
>> >
>> David,
>>
>> You sre going to have to change process contexts, for this you are
>> going to need KeStackAttachProcess to change to the correct process and
>> KeUnstackDetachProcess to revert back. Unfortunately, these routines and
>> their associated data structures are only defined in the IFS kit which
>> you
>> will have to buy from Microsoft.
>>
>> As Doron pointed out, this is complex code to get right. Validating
>> the buffer is not an easy task. If at all possible, don't do things this
>> way.
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Remove StopSpam from the email to reply
>
.
- References:
- determining process context
- From: David
- Re: determining process context
- From: cristalink
- Re: determining process context
- From: David
- Re: determining process context
- From: Don Burn
- Re: determining process context
- From: David
- determining process context
- Prev by Date: Re: determining process context
- Next by Date: Re: Networking in windows
- Previous by thread: Re: determining process context
- Next by thread: Re: determining process context
- Index(es):
Relevant Pages
|
Loading