Skip to content

Latest commit

 

History

History
97 lines (78 loc) · 3.15 KB

nf-processthreadsapi-processidtosessionid.md

File metadata and controls

97 lines (78 loc) · 3.15 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:processthreadsapi.ProcessIdToSessionId
ProcessIdToSessionId function (processthreadsapi.h)
Retrieves the Remote Desktop Services session associated with a specified process.
ProcessIdToSessionId
ProcessIdToSessionId function [Remote Desktop Services]
_win32_processidtosessionid
processthreadsapi/ProcessIdToSessionId
termserv.processidtosessionid
termserv\processidtosessionid.htm
processthreadsapi
99a3f047-705c-40bc-8cc2-055257a4f2b3
12/05/2018
ProcessIdToSessionId, ProcessIdToSessionId function [Remote Desktop Services], _win32_processidtosessionid, processthreadsapi/ProcessIdToSessionId, termserv.processidtosessionid
processthreadsapi.h
Windows.h
Windows
Windows Vista
Windows Server 2008
Kernel32.lib
Kernel32.dll
Windows
19H1
ProcessIdToSessionId
processthreadsapi/ProcessIdToSessionId
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-Core-ProcessThreads-l1-1-0.dll
API-MS-Win-Core-ProcessThreads-l1-1-1.dll
API-MS-Win-Core-ProcessThreads-l1-1-2.dll
API-MS-Win-Downlevel-Kernel32-l1-1-0.dll
KernelBase.dll
MinKernelBase.dll
API-MS-Win-Core-ProcessThreads-L1-1-3.dll
ProcessIdToSessionId

ProcessIdToSessionId function

-description

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

-parameters

-param dwProcessId [in]

Specifies a process identifier. Use the GetCurrentProcessId function to retrieve the process identifier for the current process.

-param pSessionId [out]

Pointer to a variable that receives the identifier of the Remote Desktop Services session under which the specified process is running. To retrieve the identifier of the session currently attached to the console, use the WTSGetActiveConsoleSessionId function.

-returns

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 GetLastError.

-remarks

Callers must hold the PROCESS_QUERY_INFORMATION access right for the specified process. For more information, see Process Security and Access Rights.

-see-also

OSVERSIONINFOEX

WTSQuerySessionInformation