SetProcessValidCallTargets function (memoryapi.h)

Provides Control Flow Guard (CFG) with a list of valid indirect call targets and specifies whether they should be marked valid or not. The valid call target information is provided as a list of offsets relative to a virtual memory range (start and size of the range). The call targets specified should be 16-byte aligned and in ascending order.

Syntax

BOOL SetProcessValidCallTargets(
  [in]      HANDLE                hProcess,
  [in]      PVOID                 VirtualAddress,
  [in]      SIZE_T                RegionSize,
  [in]      ULONG                 NumberOfOffsets,
  [in, out] PCFG_CALL_TARGET_INFO OffsetInformation
);

Parameters

[in] hProcess

The handle to the target process.

[in] VirtualAddress

The start of the virtual memory region whose call targets are being marked valid. The memory region must be allocated using one of the executable memory protection constants.

[in] RegionSize

The size of the virtual memory region.

[in] NumberOfOffsets

The number of offsets relative to the virtual memory ranges.

[in, out] OffsetInformation

A list of offsets and flags relative to the virtual memory ranges.

Return value

TRUE if the operation was successful; otherwise, FALSE. To retrieve error values for this function, call GetLastError.

Remarks

This function does not succeed if Control Flow Guard is not enabled for the target process. This can be checked using GetProcessMitigationPolicy.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps | UWP apps]
Minimum supported server Windows Server 2016 [desktop apps | UWP apps]
Target Platform Windows
Header memoryapi.h (include Windows.h, Memoryapi.h)
Library WindowsApp.lib
DLL Kernelbase.dll