[PATCH 1/2] ntoskrnl.exe: Implement IoGetCurrentProcess and KeGetCurrentThread.

Paul Chitescu paulc at voip.null.ro
Thu Oct 4 05:40:04 CDT 2012


On Thursday 04 October 2012 08:25:13 am Dmitry Timoshkov wrote:
> Christian Costa <titan.costa at gmail.com> wrote:
> >  PEPROCESS WINAPI IoGetCurrentProcess(void)
> >  {
> > -    FIXME("() stub\n");
> > -    return NULL;
> > +    TRACE("()\n");
> > +
> > +    /* Return current process id since PEPROCESS is opaque and drivers
> > should not access the struct directly */ +    return
> > (PEPROCESS)PsGetCurrentProcessId();
> >  }
>
> The returned pointer is supposed to be passed to various other ntoskrnl
> APIs, and it's needs to be a valid pointer to the kernel object. Besides
> many not trivial kernel drivers (if not all) really dig into internal
> kernel structures.
>
> Same for KeGetCurrentThread.

AFAIK the structure differs for each major version of Windows and some SP too.

At the minimum I saw some drivers expecting that at the returned pointer to be 
a "System" C-style string.

I tried submitting a patch before but was not accepted.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ntoskrnl_getcurrentprocess.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20121004/0ffef436/attachment.bin>


More information about the wine-devel mailing list