WTSFreeMemoryExA function (wtsapi32.h)

Frees memory that contains WTS_PROCESS_INFO_EX or WTS_SESSION_INFO_1 structures allocated by a Remote Desktop Services function.

Syntax

BOOL WTSFreeMemoryExA(
  [in] WTS_TYPE_CLASS WTSTypeClass,
  [in] PVOID          pMemory,
  [in] ULONG          NumberOfEntries
);

Parameters

[in] WTSTypeClass

A value of the WTS_TYPE_CLASS enumeration type that specifies the type of structures contained in the buffer referenced by the pMemory parameter.

[in] pMemory

A pointer to the buffer to free.

[in] NumberOfEntries

The number of elements in the buffer referenced by the pMemory parameter.

Return value

If the function succeeds, the return value is a nonzero value.

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

Remarks

Several Remote Desktop Services functions allocate buffers to return information. To free buffers that contain WTS_PROCESS_INFO_EX or WTS_SESSION_INFO_1 structures, you must call the WTSFreeMemoryEx function. To free other buffers, you can call either the WTSFreeMemory function or the WTSFreeMemoryEx function.

Note

The wtsapi32.h header defines WTSFreeMemoryEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 7
Minimum supported server Windows Server 2008 R2
Target Platform Windows
Header wtsapi32.h
Library Wtsapi32.lib
DLL Wtsapi32.dll
API set ext-ms-win-session-wtsapi32-l1-1-0 (introduced in Windows 8)

See also

WTSEnumerateProcesses

WTSEnumerateProcessesEx

WTSEnumerateSessions

WTSFreeMemory

WTSQuerySessionInformation

WTSQueryUserConfig

WTS_PROCESS_INFO_EX

WTS_SESSION_INFO_1