Export (0) Print
Expand All

KeUnstackDetachProcess routine

The KeUnstackDetachProcess routine detaches the current thread from the address space of a process and restores the previous attach state.

Caution  Use this routine with extreme caution. (See the following Remarks section.)

Syntax


VOID KeUnstackDetachProcess(
  _In_  PRKAPC_STATE ApcState
);

Parameters

ApcState [in]

Opaque pointer to a KAPC_STATE structure that was returned from a previous call to KeStackAttachProcess.

Return value

None

Remarks

Every successful call to KeStackAttachProcess must be matched by a subsequent call to KeUnstackDetachProcess.

Note  Attaching a thread to a different process can prevent asynchronous I/O operations from completing and can potentially cause deadlocks. In general, the lines of code between the call to KeStackAttachProcess and the call to KeUnstackDetachProcess should be very simple and should not call complex routines or send IRPs to other drivers.

For more information about using system threads and managing synchronization within a nonarbitrary thread context, see Driver Threads, Dispatcher Objects, and Resources.

Requirements

Version

This routine is available on Microsoft Windows 2000 and later.

Header

Ntifs.h (include Ntifs.h or Fltkernel.h)

Library

Ntoskrnl.lib

IRQL

< DISPATCH_LEVEL

See also

IoGetCurrentProcess
IoGetRequestorProcess
IoThreadToProcess
KeGetCurrentIrql
KeGetCurrentThread
KeStackAttachProcess
PsGetCurrentProcess
PsGetCurrentThread

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft