ProcessIdToSessionId function kernel32

Win32Result<bool> ProcessIdToSessionId(
  1. int dwProcessId,
  2. Pointer<Uint32> pSessionId
)

Retrieves the Remote Desktop Services session associated with a specified process.

To learn more, see learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-processidtosessionid.

Implementation

Win32Result<bool> ProcessIdToSessionId(
  int dwProcessId,
  Pointer<Uint32> pSessionId,
) {
  resolveGetLastError();
  final result_ = _ProcessIdToSessionId(dwProcessId, pSessionId);
  return .new(value: result_ != FALSE, error: GetLastError());
}