FreeRDP
|
#include <winpr/config.h>
#include <winpr/handle.h>
#include "../handle/nonehandle.h"
#include <winpr/thread.h>
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/environment.h>
#include <grp.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "thread.h"
#include "../security/security.h"
Macros | |
#define | NSIG 64 |
Functions | |
static char * | FindApplicationPath (char *application) |
static HANDLE | CreateProcessHandle (pid_t pid) |
static BOOL | ProcessHandleCloseHandle (HANDLE handle) |
static BOOL | CreateProcessExA (HANDLE hToken, DWORD dwLogonFlags, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) |
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) |
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) |
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) |
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) |
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) |
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) |
BOOL | CreateProcessWithTokenA (HANDLE hToken, DWORD dwLogonFlags, LPCSTR lpApplicationName, LPSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) |
BOOL | CreateProcessWithTokenW (HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) |
VOID | ExitProcess (UINT uExitCode) |
BOOL | GetExitCodeProcess (HANDLE hProcess, LPDWORD lpExitCode) |
HANDLE | _GetCurrentProcess (VOID) |
DWORD | GetCurrentProcessId (VOID) |
BOOL | TerminateProcess (HANDLE hProcess, UINT uExitCode) |
static BOOL | ProcessHandleIsHandle (HANDLE handle) |
static int | ProcessGetFd (HANDLE handle) |
static DWORD | ProcessCleanupHandle (HANDLE handle) |
static int | pidfd_open (pid_t pid) |
Variables | |
static HANDLE_OPS | ops |
#define NSIG 64 |
WinPR: Windows Portable Runtime Process Thread Functions
Copyright 2012 Marc-Andre Moreau marca Copyright 2014 DI (FH) Martin Haimberger ndre .more au@g mail. commarti n.ha imber ger@ thinc ast. 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. CreateProcessA CreateProcessW CreateProcessAsUserA CreateProcessAsUserW ExitProcess GetCurrentProcess GetCurrentProcessId GetExitCodeProcess GetProcessHandleCount GetProcessId GetProcessIdOfThread GetProcessMitigationPolicy GetProcessTimes GetProcessVersion OpenProcess OpenProcessToken ProcessIdToSessionId SetProcessAffinityUpdateMode SetProcessMitigationPolicy SetProcessShutdownParameters TerminateProcess
HANDLE _GetCurrentProcess | ( | VOID | ) |
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 | ||
) |
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 | ||
) |
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 | ||
) |
|
static |
|
static |
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 | ||
) |
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 | ||
) |
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 | ||
) |
BOOL CreateProcessWithTokenA | ( | HANDLE | hToken, |
DWORD | dwLogonFlags, | ||
LPCSTR | lpApplicationName, | ||
LPSTR | lpCommandLine, | ||
DWORD | dwCreationFlags, | ||
LPVOID | lpEnvironment, | ||
LPCSTR | lpCurrentDirectory, | ||
LPSTARTUPINFOA | lpStartupInfo, | ||
LPPROCESS_INFORMATION | lpProcessInformation | ||
) |
BOOL CreateProcessWithTokenW | ( | HANDLE | hToken, |
DWORD | dwLogonFlags, | ||
LPCWSTR | lpApplicationName, | ||
LPWSTR | lpCommandLine, | ||
DWORD | dwCreationFlags, | ||
LPVOID | lpEnvironment, | ||
LPCWSTR | lpCurrentDirectory, | ||
LPSTARTUPINFOW | lpStartupInfo, | ||
LPPROCESS_INFORMATION | lpProcessInformation | ||
) |
VOID ExitProcess | ( | UINT | uExitCode | ) |
|
static |
If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
1) The directory from which the application loaded. 2) The current directory for the parent process. 3) The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. 4) The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System. 5) The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. 6) The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.
DWORD GetCurrentProcessId | ( | VOID | ) |
BOOL GetExitCodeProcess | ( | HANDLE | hProcess, |
LPDWORD | lpExitCode | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
BOOL TerminateProcess | ( | HANDLE | hProcess, |
UINT | uExitCode | ||
) |