5 out of 7 rated this helpful - Rate this topic

EncodePointer function

Applies to: desktop apps | Metro style apps

Encodes the specified pointer. Encoded pointers can be used to provide another layer of protection for pointer values.

Syntax

PVOID EncodePointer(
  __in  PVOID Ptr
);

Parameters

Ptr [in]

The pointer to be encoded.

Return value

The function returns the encoded pointer.

Remarks

Encoding globally available pointers helps protect them from being exploited. The EncodePointer function obfuscates the pointer value with a secret so that it cannot be predicted by an external agent. The secret used by EncodePointer is different for each process.

A pointer must be decoded before it can be used.

Requirements

Minimum supported client

Windows Vista, Windows XP with SP2

Minimum supported server

Windows Server 2008, Windows Server 2003 with SP1

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

DecodePointer
EncodeSystemPointer

 

 

Send comments about this topic to Microsoft

Build date: 4/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
VC++2010
If your using VC++ 2010 to build your application or Windows DLL the minimum supported OS that it will be able to run on is Windows XP SP2 even thought SDK supports targeting WIN2K it makes no difference when using platform toolset vc100.

The quick way to workaround this issue is to use VC++2008 and earlier. If you still want to use VC++2010 you can set the Platform Toolset to vc90. This allows you to support Windows 2000 or later.
Application Compatibility
If an application is incompatible with the use of these functions, set its compatibility settings to "Windows 2000".
Not properly guarded
EncodePointer and its related set of functions are not properly guarded with a _WIN32_WINNT >= 0x0501 #ifdef.