/src/FreeRDP/winpr/libwinpr/handle/handle.c
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * WinPR: Windows Portable Runtime |
3 | | * Handle Management |
4 | | * |
5 | | * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> |
6 | | * Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com> |
7 | | * |
8 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | | * you may not use this file except in compliance with the License. |
10 | | * You may obtain a copy of the License at |
11 | | * |
12 | | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | | * |
14 | | * Unless required by applicable law or agreed to in writing, software |
15 | | * distributed under the License is distributed on an "AS IS" BASIS, |
16 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | * See the License for the specific language governing permissions and |
18 | | * limitations under the License. |
19 | | */ |
20 | | |
21 | | #include <winpr/config.h> |
22 | | |
23 | | #include <winpr/handle.h> |
24 | | |
25 | | #ifndef _WIN32 |
26 | | |
27 | | #include <pthread.h> |
28 | | |
29 | | #include "../synch/synch.h" |
30 | | #include "../thread/thread.h" |
31 | | #include "../pipe/pipe.h" |
32 | | #include "../comm/comm.h" |
33 | | #include "../security/security.h" |
34 | | |
35 | | #ifdef WINPR_HAVE_UNISTD_H |
36 | | #include <unistd.h> |
37 | | #endif |
38 | | |
39 | | #include <winpr/assert.h> |
40 | | |
41 | | #include "../handle/handle.h" |
42 | | |
43 | | BOOL CloseHandle(HANDLE hObject) |
44 | 0 | { |
45 | 0 | ULONG Type = 0; |
46 | 0 | WINPR_HANDLE* Object = NULL; |
47 | |
|
48 | 0 | if (!winpr_Handle_GetInfo(hObject, &Type, &Object)) |
49 | 0 | return FALSE; |
50 | | |
51 | 0 | if (!Object) |
52 | 0 | return FALSE; |
53 | | |
54 | 0 | if (!Object->ops) |
55 | 0 | return FALSE; |
56 | | |
57 | 0 | if (Object->ops->CloseHandle) |
58 | 0 | return Object->ops->CloseHandle(hObject); |
59 | | |
60 | 0 | return FALSE; |
61 | 0 | } |
62 | | |
63 | | BOOL DuplicateHandle(WINPR_ATTR_UNUSED HANDLE hSourceProcessHandle, |
64 | | WINPR_ATTR_UNUSED HANDLE hSourceHandle, |
65 | | WINPR_ATTR_UNUSED HANDLE hTargetProcessHandle, |
66 | | WINPR_ATTR_UNUSED LPHANDLE lpTargetHandle, |
67 | | WINPR_ATTR_UNUSED DWORD dwDesiredAccess, WINPR_ATTR_UNUSED BOOL bInheritHandle, |
68 | | WINPR_ATTR_UNUSED DWORD dwOptions) |
69 | 0 | { |
70 | 0 | *((ULONG_PTR*)lpTargetHandle) = (ULONG_PTR)hSourceHandle; |
71 | 0 | return TRUE; |
72 | 0 | } |
73 | | |
74 | | BOOL GetHandleInformation(WINPR_ATTR_UNUSED HANDLE hObject, WINPR_ATTR_UNUSED LPDWORD lpdwFlags) |
75 | 0 | { |
76 | 0 | WLog_ERR("TODO", "TODO: Implement"); |
77 | 0 | return TRUE; |
78 | 0 | } |
79 | | |
80 | | BOOL SetHandleInformation(WINPR_ATTR_UNUSED HANDLE hObject, WINPR_ATTR_UNUSED DWORD dwMask, |
81 | | WINPR_ATTR_UNUSED DWORD dwFlags) |
82 | 0 | { |
83 | 0 | WLog_ERR("TODO", "TODO: Implement"); |
84 | 0 | return TRUE; |
85 | 0 | } |
86 | | |
87 | | #endif |