Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:47

0001 /*
0002  * Copyright 2020 Andrey Semashev
0003  *
0004  * Distributed under the Boost Software License, Version 1.0.
0005  * See http://www.boost.org/LICENSE_1_0.txt
0006  */
0007 
0008 #ifndef BOOST_WINAPI_GET_PROC_ADDRESS_HPP_INCLUDED_
0009 #define BOOST_WINAPI_GET_PROC_ADDRESS_HPP_INCLUDED_
0010 
0011 #include <boost/winapi/basic_types.hpp>
0012 
0013 #ifdef BOOST_HAS_PRAGMA_ONCE
0014 #pragma once
0015 #endif
0016 
0017 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0018 
0019 #include <boost/winapi/detail/header.hpp>
0020 
0021 #if !defined(BOOST_USE_WINDOWS_H)
0022 namespace boost { namespace winapi {
0023 #ifdef _WIN64
0024 typedef INT_PTR_ (BOOST_WINAPI_WINAPI_CC *FARPROC_)();
0025 typedef INT_PTR_ (BOOST_WINAPI_WINAPI_CC *NEARPROC_)();
0026 typedef INT_PTR_ (BOOST_WINAPI_WINAPI_CC *PROC_)();
0027 #else
0028 typedef int (BOOST_WINAPI_WINAPI_CC *FARPROC_)();
0029 typedef int (BOOST_WINAPI_WINAPI_CC *NEARPROC_)();
0030 typedef int (BOOST_WINAPI_WINAPI_CC *PROC_)();
0031 #endif // _WIN64
0032 }} // namespace boost::winapi
0033 
0034 extern "C" {
0035 #if !defined(UNDER_CE)
0036 BOOST_WINAPI_IMPORT boost::winapi::FARPROC_ BOOST_WINAPI_WINAPI_CC
0037 GetProcAddress(boost::winapi::HMODULE_ hModule, boost::winapi::LPCSTR_ lpProcName);
0038 #else
0039 // On Windows CE there are two functions: GetProcAddressA (since Windows CE 3.0) and GetProcAddressW.
0040 // GetProcAddress is a macro that is _always_ defined to GetProcAddressW.
0041 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::FARPROC_ BOOST_WINAPI_WINAPI_CC
0042 GetProcAddressA(boost::winapi::HMODULE_ hModule, boost::winapi::LPCSTR_ lpProcName);
0043 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::FARPROC_ BOOST_WINAPI_WINAPI_CC
0044 GetProcAddressW(boost::winapi::HMODULE_ hModule, boost::winapi::LPCWSTR_ lpProcName);
0045 #endif
0046 } // extern "C"
0047 #endif // !defined(BOOST_USE_WINDOWS_H)
0048 
0049 namespace boost {
0050 namespace winapi {
0051 
0052 #if defined(BOOST_USE_WINDOWS_H)
0053 typedef ::FARPROC FARPROC_;
0054 typedef ::NEARPROC NEARPROC_;
0055 typedef ::PROC PROC_;
0056 #endif // defined(BOOST_USE_WINDOWS_H)
0057 
0058 #if !defined(UNDER_CE)
0059 // For backward compatibility, don't use directly. Use get_proc_address instead.
0060 using ::GetProcAddress;
0061 #else
0062 using ::GetProcAddressA;
0063 using ::GetProcAddressW;
0064 #endif
0065 
0066 BOOST_FORCEINLINE FARPROC_ get_proc_address(HMODULE_ hModule, LPCSTR_ lpProcName)
0067 {
0068 #if !defined(UNDER_CE)
0069     return ::GetProcAddress(hModule, lpProcName);
0070 #else
0071     return ::GetProcAddressA(hModule, lpProcName);
0072 #endif
0073 }
0074 
0075 } // namespace winapi
0076 } // namespace boost
0077 
0078 #include <boost/winapi/detail/footer.hpp>
0079 
0080 #endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0081 #endif // BOOST_WINAPI_GET_PROC_ADDRESS_HPP_INCLUDED_