Re: PsCreateSystemThread on Win2k

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



IIRC, you have to create the thread in a separate context, otherwise it will
run in the app context of the creating threa.

According to WDK documentation, process context depends on ProcessHandle
parameter - if it is NULL (according to DDK/WDK documentation, this is what
drivers should specify), then your thread runs in context of the system
process, and if its (HANDLE)-1, then it runs in context of a caller process

OBJ_KERNEL_HANDLE just means
that the handle you create that represents the thread is a protected kernel
handle

AFAIK, OBJ_KERNEL_HANDLE makes sure that the target handle is placed into
the handle table of the system process, rather than that of a caller. The
only reason why I mentioned OBJ_KERNEL_HANDLE is because its mentioning in
PsCreateSystemThread() documentation implies that the caller does not
necessarily
have to be the system process itself...

Anton Bassov

"Doron Holan [MS]" wrote:

IIRC, you have to create the thread in a separate context, otherwise it will
run in the app context of the creating threa. OBJ_KERNEL_HANDLE just means
that the handle you create that represents the thread is a protected kernel
handle

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.


"Anton Bassov" <AntonBassov@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:17F16ECB-29B4-40F7-9935-8E59D76DEB14@xxxxxxxxxxxxxxxx
The DDK states that PsCreateSystemThread under Win2K must be called from
the
system process context only.

I somehow failed to find such statement in W2K DDK documentation, although
WDK documentation, indeed, says it... However, W2K DDK documentation says
exactly the opposite - it states that callers that run in context of any
process, apart from the system, should set the OBJ_KERNEL_HANDLE flag
within
the Attributes parameter
(although it also says that this parameter should be NULL)....

In my experience, there is no problem with creating a system thread in
context of any caller whatsoever under W2K( at least as long as you
specify
NULL as Attributes, ProcessHandle and ClientId parameters - I did not try
anything else, but I believe it would work as well).

Therefore, there is just an ommision in WDK. Look at how they put it
-"Drivers for Windows 2000 and Windows 98/Me.....", i.e. as if W2K was
9x-based, rather than NT-based system....

Anton Bassov

"ijor" wrote:

The DDK states that PsCreateSystemThread under Win2K must be called from
the
system process context only. However checking older DDK versions and
older
samples seem to condtradict that statement. This suggest that it can, but
it
shouldn't perhaps because it exposes a bug or a security hole in Win2k.

So the question is if it is still possible to call PsCreateSystemThread
from
an abritrary process context, perhaps taking special precautions.

Yeah, I know that I can schedule a work item to create the system thread.
But this creates an overly sinchronization complication between the
dispatch
routines, the work item and the system thread.



.



Relevant Pages

  • [kde] Re: Making new folder in kmail?
    ... Maybe you used the context menu this time? ... So it's definitely not FLOSS only ... Few developers /want/ to write documentation. ... Temps here in Phoenix are running about 100F/38C highs, ...
    (KDE)
  • Re: State of Forth 200x
    ... it needs is documentation and some proposal made so that other ... OOF, thus going even further backwards) and usage, and it's even documented ... Classes are the context. ... inroad in one branch of the Forth user community, ...
    (comp.lang.forth)
  • Re: [Tk] Docummentation for Events
    ... I don't mean the basic documentation about Tk events. ... passed thru %tags and may be bound to the handler. ... of the mouse pointer relative to the receiving window. ... in context M, thing B in context N and thing C in context T. ...
    (comp.lang.tcl)
  • Re: Booting Debian/testing fails
    ... It tells us that our documentation isn't up to their needs. ... on Debian, ... context of my root partition but not when I asked it to start a shell in ... the installer context? ...
    (Debian-User)
  • Re: [PATCH 1/7] async: Asynchronous function calls to speed up kernel boot
    ... be called within the caller's context. ... complex because the caller wants to do a more complex thing. ... BUT it does not solve the caller not getting memory, ... the scheduled function is not allowed to make the metadata ...
    (Linux-Kernel)