GetProcessInformation function

Retrieves information about the specified process.

Syntax


 BOOL WINAPI GetProcessInformation(
  _In_ HANDLE                                     hProcess,
  _In_ PROCESS_INFORMATION_CLASS                  ProcessInformationClass,
       _Out_writes_bytes_(ProcessInformationSize) ProcessInformation,
  _In_ DWORD                                      ProcessInformationSize
);

Parameters

hProcess [in]

A handle to the process. This handle must have the PROCESS_SET_INFORMATION access right. For more information, see Process Security and Access Rights.

ProcessInformationClass [in]

The kind of information to retrieve. The only supported value is ProcessMemoryPriority

ProcessInformation

Pointer to an object to receive the type of information specified by the ProcessInformationClass parameter.

If the ProcessInformationClass parameter is ProcessMemoryPriority, this parameter must point to a MEMORY_PRIORITY_INFORMATION structure.

If the ProcessInformationClass parameter is ProcessPowerThrottling, this parameter must point to a PROCESS_POWER_THROTTLING_STATE structure.

If the ProcessInformationClass parameter is ProcessProtectionLevelInfo, this parameter must point to a PROCESS_PROTECTION_LEVEL_INFORMATION structure.

ProcessInformationSize [in]

The size in bytes of the structure specified by the ProcessInformation parameter.

If the ProcessInformationClass parameter is ProcessMemoryPriority, this parameter must be sizeof(MEMORY_PRIORITY_INFORMATION).

If the ProcessInformationClass parameter is ProcessPowerThrottling, this parameter must be sizeof(PROCESS_POWER_THROTTLING_STATE).

If the ProcessInformationClass parameter is ProcessProtectionLevelInfo, this parameter must be sizeof(PROCESS_PROTECTION_LEVEL_INFORMATION).

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.

Examples

    DWORD ErrorCode;
    BOOL Success;
    MEMORY_PRIORITY_INFORMATION MemPrio;

    //
    // Query process memory priority.
    //

    Success = GetProcessInformation(GetCurrentProcess(),
                                    ProcessMemoryPriority,
                                    &MemPrio,
                                    sizeof(MemPrio));

    if (!Success) {
        ErrorCode = GetLastError();
        fprintf(stderr, "Get process memory priority failed: %d\n", ErrorCode);
    } else {
        printf("Current process memory priority is %d.\n", MemPrio.MemoryPriority);
    }

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetThreadInformation
SetProcessInformation
PROCESS_INFORMATION_CLASS
MEMORY_PRIORITY_INFORMATION

 

 

Show: