FreeRDP
include/winpr/memory.h
1 
20 #ifndef WINPR_MEMORY_H
21 #define WINPR_MEMORY_H
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 
27 #include <winpr/winpr.h>
28 #include <winpr/wtypes.h>
29 
30 #include <winpr/crt.h>
31 #include <winpr/file.h>
32 
33 #ifndef _WIN32
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40  WINPR_ATTR_MALLOC(CloseHandle, 1)
41  WINPR_API HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
42  DWORD flProtect, DWORD dwMaximumSizeHigh,
43  DWORD dwMaximumSizeLow, LPCSTR lpName);
44 
45  WINPR_ATTR_MALLOC(CloseHandle, 1)
46  WINPR_API HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
47  DWORD flProtect, DWORD dwMaximumSizeHigh,
48  DWORD dwMaximumSizeLow, LPCWSTR lpName);
49 
50  WINPR_ATTR_MALLOC(CloseHandle, 1)
51  WINPR_API HANDLE OpenFileMappingA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName);
52 
53  WINPR_ATTR_MALLOC(CloseHandle, 1)
54  WINPR_API HANDLE OpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName);
55 
56  WINPR_API LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess,
57  DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow,
58  size_t dwNumberOfBytesToMap);
59 
60  WINPR_API LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess,
61  DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow,
62  size_t dwNumberOfBytesToMap, LPVOID lpBaseAddress);
63 
64  WINPR_API BOOL FlushViewOfFile(LPCVOID lpBaseAddress, size_t dwNumberOfBytesToFlush);
65 
66  WINPR_API BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #ifdef UNICODE
73 #define CreateFileMapping CreateFileMappingW
74 #define OpenFileMapping OpenFileMappingW
75 #else
76 #define CreateFileMapping CreateFileMappingA
77 #define OpenFileMapping OpenFileMappingA
78 #endif
79 
80 #endif
81 
82 #endif /* WINPR_MEMORY_H */