handle.h (1794B)
1/** 2 * WinPR: Windows Portable Runtime 3 * Handle Management 4 * 5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef WINPR_HANDLE_H 21#define WINPR_HANDLE_H 22 23#include <stdio.h> 24#include <stdlib.h> 25#include <string.h> 26#include <winpr/winpr.h> 27#include <winpr/wtypes.h> 28#include <winpr/security.h> 29 30#ifdef __cplusplus 31extern "C" 32{ 33#endif 34 35#define WINPR_FD_READ_BIT 0 36#define WINPR_FD_READ (1 << WINPR_FD_READ_BIT) 37 38#define WINPR_FD_WRITE_BIT 1 39#define WINPR_FD_WRITE (1 << WINPR_FD_WRITE_BIT) 40 41#ifndef _WIN32 42 43#define DUPLICATE_CLOSE_SOURCE 0x00000001 44#define DUPLICATE_SAME_ACCESS 0x00000002 45 46#define HANDLE_FLAG_INHERIT 0x00000001 47#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x00000002 48 49 WINPR_API BOOL CloseHandle(HANDLE hObject); 50 51 WINPR_API BOOL DuplicateHandle(HANDLE hSourceProcessHandle, HANDLE hSourceHandle, 52 HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, 53 DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions); 54 55 WINPR_API BOOL GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags); 56 WINPR_API BOOL SetHandleInformation(HANDLE hObject, DWORD dwMask, DWORD dwFlags); 57 58#endif 59 60#ifdef __cplusplus 61} 62#endif 63 64#endif /* WINPR_HANDLE_H */