Wow64EncodeApcRoutine - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTPSAPI_H
// Threads
#if (PHNT_MODE != PHNT_MODE_KERNEL)

#define Wow64EncodeApcRoutine(ApcRoutine) \
    ((PVOID)((0 - ((LONG_PTR)(ApcRoutine))) << 2))

#endif
#endif

View code on GitHub

This macro encodes the function pointer and indicates to NtQueueApcThread, NtQueueApcThreadEx, or NtQueueApcThreadEx2 that the APC should be executed in the WoW64 mode.

To decode the pointer back, use Wow64DecodeApcRoutine.

See also