QueueUserAPC

From aldeid
Jump to navigation Jump to search

Description

Used to execute code for a different thread. Malware sometimes uses QueueUserAPC to inject code into another process.

Syntax

DWORD WINAPI QueueUserAPC(
  _In_  PAPCFUNC pfnAPC,
  _In_  HANDLE hThread,
  _In_  ULONG_PTR dwData
);

Parameters

pfnAPC [in]
A pointer to the application-supplied APC function to be called when the specified thread performs an alertable wait operation. For more information, see APCProc.
hThread [in]
A handle to the thread. The handle must have the THREAD_SET_CONTEXT access right.
dwData [in]
A single value that is passed to the APC function pointed to by the pfnAPC parameter.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.