FreeRDP
include/winpr/thread.h File Reference
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/spec.h>
#include <winpr/handle.h>

Data Structures

struct  STARTUPINFOA
 
struct  STARTUPINFOW
 

Macros

#define STARTF_USESHOWWINDOW   0x00000001
 
#define STARTF_USESIZE   0x00000002
 
#define STARTF_USEPOSITION   0x00000004
 
#define STARTF_USECOUNTCHARS   0x00000008
 
#define STARTF_USEFILLATTRIBUTE   0x00000010
 
#define STARTF_RUNFULLSCREEN   0x00000020
 
#define STARTF_FORCEONFEEDBACK   0x00000040
 
#define STARTF_FORCEOFFFEEDBACK   0x00000080
 
#define STARTF_USESTDHANDLES   0x00000100
 
#define STARTF_USEHOTKEY   0x00000200
 
#define STARTF_TITLEISLINKNAME   0x00000800
 
#define STARTF_TITLEISAPPID   0x00001000
 
#define STARTF_PREVENTPINNING   0x00002000
 
#define LOGON_WITH_PROFILE   0x00000001
 
#define LOGON_NETCREDENTIALS_ONLY   0x00000002
 
#define LOGON_ZERO_PASSWORD_BUFFER   0x80000000
 
#define CreateProcess   CreateProcessA
 
#define CreateProcessAsUser   CreateProcessAsUserA
 
#define CreateProcessWithLogon   CreateProcessWithLogonA
 
#define CreateProcessWithToken   CreateProcessWithTokenA
 
#define CommandLineToArgv   CommandLineToArgvA
 
#define THREAD_MODE_BACKGROUND_BEGIN   0x00010000
 
#define THREAD_MODE_BACKGROUND_END   0x00020000
 
#define THREAD_PRIORITY_ABOVE_NORMAL   1
 
#define THREAD_PRIORITY_BELOW_NORMAL   -1
 
#define THREAD_PRIORITY_HIGHEST   2
 
#define THREAD_PRIORITY_IDLE   -15
 
#define THREAD_PRIORITY_LOWEST   -2
 
#define THREAD_PRIORITY_NORMAL   0
 
#define THREAD_PRIORITY_TIME_CRITICAL   15
 
#define CREATE_SUSPENDED   0x00000004
 
#define STACK_SIZE_PARAM_IS_A_RESERVATION   0x00010000
 
#define TLS_OUT_OF_INDEXES   ((DWORD)0xFFFFFFFF)
 

Typedefs

typedef struct STARTUPINFOALPSTARTUPINFOA
 
typedef struct STARTUPINFOWLPSTARTUPINFOW
 
typedef STARTUPINFOA STARTUPINFO
 
typedef LPSTARTUPINFOA LPSTARTUPINFO
 
typedef void(* PAPCFUNC) (ULONG_PTR Parameter)
 

Functions

WINPR_API BOOL CreateProcessA (LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessW (LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessAsUserA (HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessAsUserW (HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessWithLogonA (LPCSTR lpUsername, LPCSTR lpDomain, LPCSTR lpPassword, DWORD dwLogonFlags, LPCSTR lpApplicationName, LPSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessWithLogonW (LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessWithTokenA (HANDLE hToken, DWORD dwLogonFlags, LPCSTR lpApplicationName, LPSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
WINPR_API BOOL CreateProcessWithTokenW (HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
DECLSPEC_NORETURN WINPR_API VOID ExitProcess (UINT uExitCode)
 
WINPR_API BOOL GetExitCodeProcess (HANDLE hProcess, LPDWORD lpExitCode)
 
WINPR_API HANDLE _GetCurrentProcess (void)
 
WINPR_API DWORD GetCurrentProcessId (void)
 
WINPR_API BOOL TerminateProcess (HANDLE hProcess, UINT uExitCode)
 
WINPR_API LPWSTR * CommandLineToArgvW (LPCWSTR lpCmdLine, int *pNumArgs)
 
WINPR_API BOOL SetThreadPriority (HANDLE hThread, int nPriority)
 
WINPR_API HANDLE CreateThread (LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
 
WINPR_API HANDLE CreateRemoteThread (HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
 
WINPR_API VOID ExitThread (DWORD dwExitCode)
 
WINPR_API BOOL GetExitCodeThread (HANDLE hThread, LPDWORD lpExitCode)
 
WINPR_API HANDLE _GetCurrentThread (void)
 
WINPR_API DWORD GetCurrentThreadId (void)
 
WINPR_API DWORD QueueUserAPC (PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData)
 
WINPR_API DWORD ResumeThread (HANDLE hThread)
 
WINPR_API DWORD SuspendThread (HANDLE hThread)
 
WINPR_API BOOL SwitchToThread (void)
 
WINPR_API BOOL TerminateThread (HANDLE hThread, DWORD dwExitCode)
 
WINPR_API DWORD GetCurrentProcessorNumber (void)
 
WINPR_API DWORD TlsAlloc (void)
 
WINPR_API LPVOID TlsGetValue (DWORD dwTlsIndex)
 
WINPR_API BOOL TlsSetValue (DWORD dwTlsIndex, LPVOID lpTlsValue)
 
WINPR_API BOOL TlsFree (DWORD dwTlsIndex)
 
WINPR_API LPSTR * CommandLineToArgvA (LPCSTR lpCmdLine, int *pNumArgs)
 
WINPR_API VOID DumpThreadHandles (void)
 

Macro Definition Documentation

◆ CommandLineToArgv

#define CommandLineToArgv   CommandLineToArgvA

◆ CREATE_SUSPENDED

#define CREATE_SUSPENDED   0x00000004

◆ CreateProcess

#define CreateProcess   CreateProcessA

◆ CreateProcessAsUser

#define CreateProcessAsUser   CreateProcessAsUserA

◆ CreateProcessWithLogon

#define CreateProcessWithLogon   CreateProcessWithLogonA

◆ CreateProcessWithToken

#define CreateProcessWithToken   CreateProcessWithTokenA

◆ LOGON_NETCREDENTIALS_ONLY

#define LOGON_NETCREDENTIALS_ONLY   0x00000002

◆ LOGON_WITH_PROFILE

#define LOGON_WITH_PROFILE   0x00000001

◆ LOGON_ZERO_PASSWORD_BUFFER

#define LOGON_ZERO_PASSWORD_BUFFER   0x80000000

◆ STACK_SIZE_PARAM_IS_A_RESERVATION

#define STACK_SIZE_PARAM_IS_A_RESERVATION   0x00010000

◆ STARTF_FORCEOFFFEEDBACK

#define STARTF_FORCEOFFFEEDBACK   0x00000080

◆ STARTF_FORCEONFEEDBACK

#define STARTF_FORCEONFEEDBACK   0x00000040

◆ STARTF_PREVENTPINNING

#define STARTF_PREVENTPINNING   0x00002000

◆ STARTF_RUNFULLSCREEN

#define STARTF_RUNFULLSCREEN   0x00000020

◆ STARTF_TITLEISAPPID

#define STARTF_TITLEISAPPID   0x00001000

◆ STARTF_TITLEISLINKNAME

#define STARTF_TITLEISLINKNAME   0x00000800

◆ STARTF_USECOUNTCHARS

#define STARTF_USECOUNTCHARS   0x00000008

◆ STARTF_USEFILLATTRIBUTE

#define STARTF_USEFILLATTRIBUTE   0x00000010

◆ STARTF_USEHOTKEY

#define STARTF_USEHOTKEY   0x00000200

◆ STARTF_USEPOSITION

#define STARTF_USEPOSITION   0x00000004

◆ STARTF_USESHOWWINDOW

#define STARTF_USESHOWWINDOW   0x00000001

◆ STARTF_USESIZE

#define STARTF_USESIZE   0x00000002

◆ STARTF_USESTDHANDLES

#define STARTF_USESTDHANDLES   0x00000100

◆ THREAD_MODE_BACKGROUND_BEGIN

#define THREAD_MODE_BACKGROUND_BEGIN   0x00010000

◆ THREAD_MODE_BACKGROUND_END

#define THREAD_MODE_BACKGROUND_END   0x00020000

◆ THREAD_PRIORITY_ABOVE_NORMAL

#define THREAD_PRIORITY_ABOVE_NORMAL   1

◆ THREAD_PRIORITY_BELOW_NORMAL

#define THREAD_PRIORITY_BELOW_NORMAL   -1

◆ THREAD_PRIORITY_HIGHEST

#define THREAD_PRIORITY_HIGHEST   2

◆ THREAD_PRIORITY_IDLE

#define THREAD_PRIORITY_IDLE   -15

◆ THREAD_PRIORITY_LOWEST

#define THREAD_PRIORITY_LOWEST   -2

◆ THREAD_PRIORITY_NORMAL

#define THREAD_PRIORITY_NORMAL   0

◆ THREAD_PRIORITY_TIME_CRITICAL

#define THREAD_PRIORITY_TIME_CRITICAL   15

◆ TLS_OUT_OF_INDEXES

#define TLS_OUT_OF_INDEXES   ((DWORD)0xFFFFFFFF)

Typedef Documentation

◆ LPSTARTUPINFO

◆ LPSTARTUPINFOA

typedef struct STARTUPINFOA * LPSTARTUPINFOA

◆ LPSTARTUPINFOW

typedef struct STARTUPINFOW * LPSTARTUPINFOW

◆ PAPCFUNC

typedef void(* PAPCFUNC) (ULONG_PTR Parameter)

◆ STARTUPINFO

Function Documentation

◆ _GetCurrentProcess()

WINPR_API HANDLE _GetCurrentProcess ( void  )

◆ _GetCurrentThread()

WINPR_API HANDLE _GetCurrentThread ( void  )
Here is the caller graph for this function:

◆ CommandLineToArgvA()

WINPR_API LPSTR* CommandLineToArgvA ( LPCSTR  lpCmdLine,
int *  pNumArgs 
)

CommandLineToArgvW function: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776391/

CommandLineToArgvW has a special interpretation of backslash characters when they are followed by a quotation mark character ("), as follows:

2n backslashes followed by a quotation mark produce n backslashes followed by a quotation mark. (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark. n backslashes not followed by a quotation mark simply produce n backslashes.

The address returned by CommandLineToArgvW is the address of the first element in an array of LPWSTR values; the number of pointers in this array is indicated by pNumArgs. Each pointer to a null-terminated Unicode string represents an individual argument found on the command line.

CommandLineToArgvW allocates a block of contiguous memory for pointers to the argument strings, and for the argument strings themselves; the calling application must free the memory used by the argument list when it is no longer needed. To free the memory, use a single call to the LocalFree function. Parsing C++ Command-Line Arguments: http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft

Microsoft C/C++ startup code uses the following rules when interpreting arguments given on the operating system command line:

Arguments are delimited by white space, which is either a space or a tab.

The caret character (^) is not recognized as an escape character or delimiter. The character is handled completely by the command-line parser in the operating system before being passed to the argv array in the program.

A string surrounded by double quotation marks ("string") is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument.

A double quotation mark preceded by a backslash (") is interpreted as a literal double quotation mark character (").

Backslashes are interpreted literally, unless they immediately precede a double quotation mark.

If an even number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter.

If an odd number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is "escaped" by the remaining backslash, causing a literal double quotation mark (") to be placed in argv.

Here is the caller graph for this function:

◆ CommandLineToArgvW()

WINPR_API LPWSTR* CommandLineToArgvW ( LPCWSTR  lpCmdLine,
int *  pNumArgs 
)
Here is the caller graph for this function:

◆ CreateProcessA()

WINPR_API BOOL CreateProcessA ( LPCSTR  lpApplicationName,
LPSTR  lpCommandLine,
LPSECURITY_ATTRIBUTES  lpProcessAttributes,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
BOOL  bInheritHandles,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCSTR  lpCurrentDirectory,
LPSTARTUPINFOA  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateProcessAsUserA()

WINPR_API BOOL CreateProcessAsUserA ( HANDLE  hToken,
LPCSTR  lpApplicationName,
LPSTR  lpCommandLine,
LPSECURITY_ATTRIBUTES  lpProcessAttributes,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
BOOL  bInheritHandles,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCSTR  lpCurrentDirectory,
LPSTARTUPINFOA  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)
Here is the call graph for this function:

◆ CreateProcessAsUserW()

WINPR_API BOOL CreateProcessAsUserW ( HANDLE  hToken,
LPCWSTR  lpApplicationName,
LPWSTR  lpCommandLine,
LPSECURITY_ATTRIBUTES  lpProcessAttributes,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
BOOL  bInheritHandles,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCWSTR  lpCurrentDirectory,
LPSTARTUPINFOW  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

◆ CreateProcessW()

WINPR_API BOOL CreateProcessW ( LPCWSTR  lpApplicationName,
LPWSTR  lpCommandLine,
LPSECURITY_ATTRIBUTES  lpProcessAttributes,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
BOOL  bInheritHandles,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCWSTR  lpCurrentDirectory,
LPSTARTUPINFOW  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

◆ CreateProcessWithLogonA()

WINPR_API BOOL CreateProcessWithLogonA ( LPCSTR  lpUsername,
LPCSTR  lpDomain,
LPCSTR  lpPassword,
DWORD  dwLogonFlags,
LPCSTR  lpApplicationName,
LPSTR  lpCommandLine,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCSTR  lpCurrentDirectory,
LPSTARTUPINFOA  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

◆ CreateProcessWithLogonW()

WINPR_API BOOL CreateProcessWithLogonW ( LPCWSTR  lpUsername,
LPCWSTR  lpDomain,
LPCWSTR  lpPassword,
DWORD  dwLogonFlags,
LPCWSTR  lpApplicationName,
LPWSTR  lpCommandLine,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCWSTR  lpCurrentDirectory,
LPSTARTUPINFOW  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

◆ CreateProcessWithTokenA()

WINPR_API BOOL CreateProcessWithTokenA ( HANDLE  hToken,
DWORD  dwLogonFlags,
LPCSTR  lpApplicationName,
LPSTR  lpCommandLine,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCSTR  lpCurrentDirectory,
LPSTARTUPINFOA  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)
Here is the call graph for this function:

◆ CreateProcessWithTokenW()

WINPR_API BOOL CreateProcessWithTokenW ( HANDLE  hToken,
DWORD  dwLogonFlags,
LPCWSTR  lpApplicationName,
LPWSTR  lpCommandLine,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCWSTR  lpCurrentDirectory,
LPSTARTUPINFOW  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

◆ CreateRemoteThread()

WINPR_API HANDLE CreateRemoteThread ( HANDLE  hProcess,
LPSECURITY_ATTRIBUTES  lpThreadAttributes,
SIZE_T  dwStackSize,
LPTHREAD_START_ROUTINE  lpStartAddress,
LPVOID  lpParameter,
DWORD  dwCreationFlags,
LPDWORD  lpThreadId 
)
Here is the call graph for this function:

◆ CreateThread()

WINPR_API HANDLE CreateThread ( LPSECURITY_ATTRIBUTES  lpThreadAttributes,
SIZE_T  dwStackSize,
LPTHREAD_START_ROUTINE  lpStartAddress,
LPVOID  lpParameter,
DWORD  dwCreationFlags,
LPDWORD  lpThreadId 
)
Here is the call graph for this function:

◆ DumpThreadHandles()

WINPR_API VOID DumpThreadHandles ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExitProcess()

DECLSPEC_NORETURN WINPR_API VOID ExitProcess ( UINT  uExitCode)

◆ ExitThread()

WINPR_API VOID ExitThread ( DWORD  dwExitCode)
Here is the call graph for this function:

◆ GetCurrentProcessId()

WINPR_API DWORD GetCurrentProcessId ( void  )
Here is the caller graph for this function:

◆ GetCurrentProcessorNumber()

WINPR_API DWORD GetCurrentProcessorNumber ( void  )

◆ GetCurrentThreadId()

WINPR_API DWORD GetCurrentThreadId ( void  )
Here is the caller graph for this function:

◆ GetExitCodeProcess()

WINPR_API BOOL GetExitCodeProcess ( HANDLE  hProcess,
LPDWORD  lpExitCode 
)
Here is the caller graph for this function:

◆ GetExitCodeThread()

WINPR_API BOOL GetExitCodeThread ( HANDLE  hThread,
LPDWORD  lpExitCode 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ QueueUserAPC()

WINPR_API DWORD QueueUserAPC ( PAPCFUNC  pfnAPC,
HANDLE  hThread,
ULONG_PTR  dwData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResumeThread()

WINPR_API DWORD ResumeThread ( HANDLE  hThread)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetThreadPriority()

WINPR_API BOOL SetThreadPriority ( HANDLE  hThread,
int  nPriority 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SuspendThread()

WINPR_API DWORD SuspendThread ( HANDLE  hThread)
Here is the call graph for this function:

◆ SwitchToThread()

WINPR_API BOOL SwitchToThread ( void  )

◆ TerminateProcess()

WINPR_API BOOL TerminateProcess ( HANDLE  hProcess,
UINT  uExitCode 
)
Here is the caller graph for this function:

◆ TerminateThread()

WINPR_API BOOL TerminateThread ( HANDLE  hThread,
DWORD  dwExitCode 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TlsAlloc()

WINPR_API DWORD TlsAlloc ( void  )

WinPR: Windows Portable Runtime Process Thread Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. TlsAlloc TlsFree TlsGetValue TlsSetValue

Here is the caller graph for this function:

◆ TlsFree()

WINPR_API BOOL TlsFree ( DWORD  dwTlsIndex)

◆ TlsGetValue()

WINPR_API LPVOID TlsGetValue ( DWORD  dwTlsIndex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TlsSetValue()

WINPR_API BOOL TlsSetValue ( DWORD  dwTlsIndex,
LPVOID  lpTlsValue 
)
Here is the caller graph for this function: