Re: determining process context



David wrote:
Hi Don,
 I tried to get the Process context in dispatch routine using
PsGetCurrentProcess and tried to supply this argument to my
PsCreateSystemThread but when I do this, it DOESNT create Thread AT
ALL.
If I change that process handle parameter to (HANDLE)0 , it creates the
thread (which must be in System Context).

So how do I create thread in Current Process context?


Read the docs for PsCreateSystemThread. The handle parameter allows you to create the thread in the process context specified by the handle rather than the default, which is the system process. The other alternative is, as noted earler, to use KeStackAttachProcess.


You have however been warned that there are issues and complications and edge cases and essentially here be dragons. Good luck.


--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com


- David

Doron Holan [MS] wrote:

you can create a transaction object and add buffers to it with individual
IOCTL calls.  in the end, you should map the buffers into kernel space in
the dispatch routine and then hand them off to the thread.  getting the
thread back into the process context is not easy, do all the process context
specific actions in your dispatch code.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"David" <know_devig@xxxxxxxxxxx> wrote in message news:1122099724.982502.35280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi Doron,
     My application requirement is passing multiple buffers to the
kernel so I cannot use buffered or direct method because it will be
locked,
we want to lock the buffers only when device requests it for DMA.
Alternative approach is call-back events but performance wise passing
buffers to kernel will be efficient. Thats why we are using neither
method so we can lock the buffer only when required.




.



Relevant Pages

  • Re: determining process context
    ... I tried to get the Process context in dispatch routine using ... So how do I create thread in Current Process context? ... > you can create a transaction object and add buffers to it with individual ... >> kernel so I cannot use buffered or direct method because it will be ...
    (microsoft.public.development.device.drivers)
  • Re: How to avoid data copies in a driver ?
    ... You cannot use a user-mode file-descriptor in the kernel. ... The kernel itself doesn't have a process context. ... Using memory mapping as previously advised, lets you DMA ...
    (Linux-Kernel)
  • Re: async i/o question
    ... Then you just misuderstood how the kernel works when processing read, ... Usually a driver has both things implemented. ... both communicating through command/data queues. ... In process context, your kernel driver has to ensure it does not use single ...
    (comp.os.linux.development.system)
  • Re: determining process context
    ... You have to create a thread with the correct process context, ... process handle of the current process in the DISPATCH routine, ... > But if PsCreateSystemThread doesnt put u in User context then is there ...
    (microsoft.public.development.device.drivers)
  • Re: determining process context
    ... PsGetCurrentProcess, PsCreateSystemThread fails. ... Is it possible to create thread from Dispatch routine, ... Mark Roddy wrote: ... >> So how do I create thread in Current Process context? ...
    (microsoft.public.development.device.drivers)