/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(HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle,  | 
64  |  |                      LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle,  | 
65  |  |                      DWORD dwOptions)  | 
66  | 0  | { | 
67  | 0  |   *((ULONG_PTR*)lpTargetHandle) = (ULONG_PTR)hSourceHandle;  | 
68  | 0  |   return TRUE;  | 
69  | 0  | }  | 
70  |  |  | 
71  |  | BOOL GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags)  | 
72  | 0  | { | 
73  | 0  |   return TRUE;  | 
74  | 0  | }  | 
75  |  |  | 
76  |  | BOOL SetHandleInformation(HANDLE hObject, DWORD dwMask, DWORD dwFlags)  | 
77  | 0  | { | 
78  | 0  |   return TRUE;  | 
79  | 0  | }  | 
80  |  |  | 
81  |  | #endif  |