]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/dll.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / dll.hpp
CommitLineData
7c673cae
FG
1// dll.hpp --------------------------------------------------------------//
2
3// Copyright 2010 Vicente J. Botet Escriba
4// Copyright 2014 Renato Tegon Forti, Antony Polukhin
5// Copyright 2015 Andrey Semashev
6// Copyright 2015 Antony Polukhin
7
8// Distributed under the Boost Software License, Version 1.0.
9// See http://www.boost.org/LICENSE_1_0.txt
10
11
12#ifndef BOOST_DETAIL_WINAPI_DLL_HPP
13#define BOOST_DETAIL_WINAPI_DLL_HPP
14
15#include <boost/detail/winapi/basic_types.hpp>
16
17#ifdef BOOST_HAS_PRAGMA_ONCE
18#pragma once
19#endif
20
21#if !defined( BOOST_USE_WINDOWS_H )
22extern "C" {
23namespace boost { namespace detail { namespace winapi {
24#ifdef _WIN64
25typedef INT_PTR_ (WINAPI *FARPROC_)();
26typedef INT_PTR_ (WINAPI *NEARPROC_)();
27typedef INT_PTR_ (WINAPI *PROC_)();
28#else
29typedef int (WINAPI *FARPROC_)();
30typedef int (WINAPI *NEARPROC_)();
31typedef int (WINAPI *PROC_)();
32#endif // _WIN64
33}}} // namespace boost::detail::winapi
34
35#if !defined( BOOST_NO_ANSI_APIS )
36BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
37LoadLibraryA(boost::detail::winapi::LPCSTR_ lpFileName);
38
39BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
40LoadLibraryExA(
41 boost::detail::winapi::LPCSTR_ lpFileName,
42 boost::detail::winapi::HANDLE_ hFile,
43 boost::detail::winapi::DWORD_ dwFlags
44);
45
46BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
47GetModuleHandleA(boost::detail::winapi::LPCSTR_ lpFileName);
48
49BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI
50GetModuleFileNameA(
51 boost::detail::winapi::HMODULE_ hModule,
52 boost::detail::winapi::LPSTR_ lpFilename,
53 boost::detail::winapi::DWORD_ nSize
54);
55#endif
56
57BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
58LoadLibraryW(boost::detail::winapi::LPCWSTR_ lpFileName);
59
60BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
61LoadLibraryExW(
62 boost::detail::winapi::LPCWSTR_ lpFileName,
63 boost::detail::winapi::HANDLE_ hFile,
64 boost::detail::winapi::DWORD_ dwFlags
65);
66
67BOOST_SYMBOL_IMPORT boost::detail::winapi::HMODULE_ WINAPI
68GetModuleHandleW(boost::detail::winapi::LPCWSTR_ lpFileName);
69
70BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI
71GetModuleFileNameW(
72 boost::detail::winapi::HMODULE_ hModule,
73 boost::detail::winapi::LPWSTR_ lpFilename,
74 boost::detail::winapi::DWORD_ nSize
75);
76
77BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
78FreeLibrary(boost::detail::winapi::HMODULE_ hModule);
79
80#if !defined( UNDER_CE )
81BOOST_SYMBOL_IMPORT boost::detail::winapi::FARPROC_ WINAPI
82GetProcAddress(boost::detail::winapi::HMODULE_ hModule, boost::detail::winapi::LPCSTR_ lpProcName);
83#else
84// On Windows CE there are two functions: GetProcAddressA (since Windows CE 3.0) and GetProcAddressW.
85// GetProcAddress is a macro that is _always_ defined to GetProcAddressW.
86BOOST_SYMBOL_IMPORT boost::detail::winapi::FARPROC_ WINAPI
87GetProcAddressA(boost::detail::winapi::HMODULE_ hModule, boost::detail::winapi::LPCSTR_ lpProcName);
88BOOST_SYMBOL_IMPORT boost::detail::winapi::FARPROC_ WINAPI
89GetProcAddressW(boost::detail::winapi::HMODULE_ hModule, boost::detail::winapi::LPCWSTR_ lpProcName);
90#endif
91
92struct _MEMORY_BASIC_INFORMATION;
93
94#if !defined( BOOST_WINAPI_IS_MINGW )
95BOOST_SYMBOL_IMPORT boost::detail::winapi::SIZE_T_ WINAPI
96VirtualQuery(
97 boost::detail::winapi::LPCVOID_ lpAddress,
98 ::_MEMORY_BASIC_INFORMATION* lpBuffer,
99 boost::detail::winapi::ULONG_PTR_ dwLength
100);
101#else // !defined( BOOST_WINAPI_IS_MINGW )
102BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI
103VirtualQuery(
104 boost::detail::winapi::LPCVOID_ lpAddress,
105 ::_MEMORY_BASIC_INFORMATION* lpBuffer,
106 boost::detail::winapi::DWORD_ dwLength
107);
108#endif // !defined( BOOST_WINAPI_IS_MINGW )
109} // extern "C"
110#endif // #if !defined( BOOST_USE_WINDOWS_H )
111
112namespace boost {
113namespace detail {
114namespace winapi {
115
116typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS MEMORY_BASIC_INFORMATION_ {
117 PVOID_ BaseAddress;
118 PVOID_ AllocationBase;
119 DWORD_ AllocationProtect;
120 SIZE_T_ RegionSize;
121 DWORD_ State;
122 DWORD_ Protect;
123 DWORD_ Type;
124} *PMEMORY_BASIC_INFORMATION_;
125
126#if defined( BOOST_USE_WINDOWS_H )
127typedef ::FARPROC FARPROC_;
128typedef ::NEARPROC NEARPROC_;
129typedef ::PROC PROC_;
130
131const DWORD_ DONT_RESOLVE_DLL_REFERENCES_ = DONT_RESOLVE_DLL_REFERENCES;
132const DWORD_ LOAD_WITH_ALTERED_SEARCH_PATH_ = LOAD_WITH_ALTERED_SEARCH_PATH;
133#else // defined( BOOST_USE_WINDOWS_H )
134const DWORD_ DONT_RESOLVE_DLL_REFERENCES_ = 0x00000001;
135const DWORD_ LOAD_WITH_ALTERED_SEARCH_PATH_ = 0x00000008;
136#endif // defined( BOOST_USE_WINDOWS_H )
137
138// This one is not defined by MinGW
139const DWORD_ LOAD_IGNORE_CODE_AUTHZ_LEVEL_ = 0x00000010;
140
141#if !defined( BOOST_NO_ANSI_APIS )
142using ::LoadLibraryA;
143using ::LoadLibraryExA;
144using ::GetModuleHandleA;
145using ::GetModuleFileNameA;
146#endif // !defined( BOOST_NO_ANSI_APIS )
147using ::LoadLibraryW;
148using ::LoadLibraryExW;
149using ::GetModuleHandleW;
150using ::GetModuleFileNameW;
151using ::FreeLibrary;
152
153#if !defined( UNDER_CE )
154// For backward compatibility, don't use directly. Use get_proc_address instead.
155using ::GetProcAddress;
156#else
157using ::GetProcAddressA;
158using ::GetProcAddressW;
159#endif
160
161BOOST_FORCEINLINE FARPROC_ get_proc_address(HMODULE_ hModule, LPCSTR_ lpProcName)
162{
163#if !defined( UNDER_CE )
164 return ::GetProcAddress(hModule, lpProcName);
165#else
166 return ::GetProcAddressA(hModule, lpProcName);
167#endif
168}
169
170BOOST_FORCEINLINE SIZE_T_ VirtualQuery(LPCVOID_ lpAddress, MEMORY_BASIC_INFORMATION_* lpBuffer, ULONG_PTR_ dwLength)
171{
172 return ::VirtualQuery(lpAddress, reinterpret_cast< ::_MEMORY_BASIC_INFORMATION* >(lpBuffer), dwLength);
173}
174
175#if !defined( BOOST_NO_ANSI_APIS )
176BOOST_FORCEINLINE HMODULE_ load_library(LPCSTR_ lpFileName)
177{
178 return ::LoadLibraryA(lpFileName);
179}
180
181BOOST_FORCEINLINE HMODULE_ load_library_ex(LPCSTR_ lpFileName, HANDLE_ hFile, DWORD_ dwFlags)
182{
183 return ::LoadLibraryExA(lpFileName, hFile, dwFlags);
184}
185
186BOOST_FORCEINLINE HMODULE_ get_module_handle(LPCSTR_ lpFileName)
187{
188 return ::GetModuleHandleA(lpFileName);
189}
190
191BOOST_FORCEINLINE DWORD_ get_module_file_name(HMODULE_ hModule, LPSTR_ lpFilename, DWORD_ nSize)
192{
193 return ::GetModuleFileNameA(hModule, lpFilename, nSize);
194}
195#endif // #if !defined( BOOST_NO_ANSI_APIS )
196
197BOOST_FORCEINLINE HMODULE_ load_library(LPCWSTR_ lpFileName)
198{
199 return ::LoadLibraryW(lpFileName);
200}
201
202BOOST_FORCEINLINE HMODULE_ load_library_ex(LPCWSTR_ lpFileName, HANDLE_ hFile, DWORD_ dwFlags)
203{
204 return ::LoadLibraryExW(lpFileName, hFile, dwFlags);
205}
206
207BOOST_FORCEINLINE HMODULE_ get_module_handle(LPCWSTR_ lpFileName)
208{
209 return ::GetModuleHandleW(lpFileName);
210}
211
212BOOST_FORCEINLINE DWORD_ get_module_file_name(HMODULE_ hModule, LPWSTR_ lpFilename, DWORD_ nSize)
213{
214 return ::GetModuleFileNameW(hModule, lpFilename, nSize);
215}
216
217} // namespace winapi
218} // namespace detail
219} // namespace boost
220
221#endif // BOOST_DETAIL_WINAPI_DLL_HPP