FreeRDP
handle.c
1 
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 {
45  ULONG Type = 0;
46  WINPR_HANDLE* Object = NULL;
47 
48  if (!winpr_Handle_GetInfo(hObject, &Type, &Object))
49  return FALSE;
50 
51  if (!Object)
52  return FALSE;
53 
54  if (!Object->ops)
55  return FALSE;
56 
57  if (Object->ops->CloseHandle)
58  return Object->ops->CloseHandle(hObject);
59 
60  return FALSE;
61 }
62 
63 BOOL DuplicateHandle(HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle,
64  LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle,
65  DWORD dwOptions)
66 {
67  *((ULONG_PTR*)lpTargetHandle) = (ULONG_PTR)hSourceHandle;
68  return TRUE;
69 }
70 
71 BOOL GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags)
72 {
73  return TRUE;
74 }
75 
76 BOOL SetHandleInformation(HANDLE hObject, DWORD dwMask, DWORD dwFlags)
77 {
78  return TRUE;
79 }
80 
81 #endif