From f6ee26f15a22ec1c521ff26b59121d876a940722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 24 Sep 2013 14:35:03 -0400 Subject: [PATCH] winpr: fix noreturn warnings --- winpr/libwinpr/rpc/rpc.c | 3 ++- winpr/libwinpr/thread/process.c | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/winpr/libwinpr/rpc/rpc.c b/winpr/libwinpr/rpc/rpc.c index 3f6685925..d82e4fe6c 100644 --- a/winpr/libwinpr/rpc/rpc.c +++ b/winpr/libwinpr/rpc/rpc.c @@ -520,9 +520,10 @@ RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BIND return 0; } -DECLSPEC_NORETURN void RpcRaiseException(RPC_STATUS exception) +void RpcRaiseException(RPC_STATUS exception) { fprintf(stderr, "RpcRaiseException: 0x%08luX\n", exception); + exit((int) exception); } RPC_STATUS RpcTestCancel() diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index a1f43a659..62d7f1faf 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -365,9 +365,9 @@ BOOL CreateProcessWithTokenW(HANDLE hToken, DWORD dwLogonFlags, return TRUE; } -DECLSPEC_NORETURN VOID ExitProcess(UINT uExitCode) +VOID ExitProcess(UINT uExitCode) { - + exit((int) uExitCode); } BOOL GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode) @@ -399,11 +399,28 @@ DWORD GetCurrentProcessId(VOID) DWORD GetProcessId(HANDLE Process) { - return 0; + WINPR_PROCESS* process; + + process = (WINPR_PROCESS*) Process; + + if (!process) + return 0; + + return (DWORD) process->pid; } BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode) { + WINPR_PROCESS* process; + + process = (WINPR_PROCESS*) hProcess; + + if (!process) + return FALSE; + + if (kill(process->pid, SIGTERM)) + return FALSE; + return TRUE; }