github.com/searKing/golang/go@v1.2.117/os/signal/cgo/include/boost/winapi/dll.hpp (about)

     1  /*
     2   * Copyright 2010 Vicente J. Botet Escriba
     3   * Copyright 2014 Renato Tegon Forti, Antony Polukhin
     4   * Copyright 2015, 2020 Andrey Semashev
     5   * Copyright 2015 Antony Polukhin
     6   *
     7   * Distributed under the Boost Software License, Version 1.0.
     8   * See http://www.boost.org/LICENSE_1_0.txt
     9   */
    10  
    11  #ifndef BOOST_WINAPI_DLL_HPP_INCLUDED_
    12  #define BOOST_WINAPI_DLL_HPP_INCLUDED_
    13  
    14  #include <boost/winapi/basic_types.hpp>
    15  #include <boost/winapi/get_proc_address.hpp>
    16  #include <boost/winapi/detail/header.hpp>
    17  
    18  #ifdef BOOST_HAS_PRAGMA_ONCE
    19  #pragma once
    20  #endif
    21  
    22  #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
    23  
    24  #if !defined( BOOST_USE_WINDOWS_H )
    25  extern "C" {
    26  
    27  #if !defined( BOOST_NO_ANSI_APIS )
    28  BOOST_WINAPI_IMPORT boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    29  LoadLibraryA(boost::winapi::LPCSTR_ lpFileName);
    30  
    31  BOOST_WINAPI_IMPORT boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    32  LoadLibraryExA(
    33      boost::winapi::LPCSTR_ lpFileName,
    34      boost::winapi::HANDLE_ hFile,
    35      boost::winapi::DWORD_ dwFlags
    36  );
    37  
    38  BOOST_WINAPI_IMPORT boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    39  GetModuleHandleA(boost::winapi::LPCSTR_ lpFileName);
    40  
    41  BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
    42  GetModuleFileNameA(
    43      boost::winapi::HMODULE_ hModule,
    44      boost::winapi::LPSTR_ lpFilename,
    45      boost::winapi::DWORD_ nSize
    46  );
    47  #endif
    48  
    49  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    50  LoadLibraryW(boost::winapi::LPCWSTR_ lpFileName);
    51  
    52  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    53  LoadLibraryExW(
    54      boost::winapi::LPCWSTR_ lpFileName,
    55      boost::winapi::HANDLE_ hFile,
    56      boost::winapi::DWORD_ dwFlags
    57  );
    58  
    59  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HMODULE_ BOOST_WINAPI_WINAPI_CC
    60  GetModuleHandleW(boost::winapi::LPCWSTR_ lpFileName);
    61  
    62  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
    63  GetModuleFileNameW(
    64      boost::winapi::HMODULE_ hModule,
    65      boost::winapi::LPWSTR_ lpFilename,
    66      boost::winapi::DWORD_ nSize
    67  );
    68  
    69  struct _MEMORY_BASIC_INFORMATION;
    70  
    71  #if !defined( BOOST_WINAPI_IS_MINGW )
    72  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::SIZE_T_ BOOST_WINAPI_WINAPI_CC
    73  VirtualQuery(
    74      boost::winapi::LPCVOID_ lpAddress,
    75      ::_MEMORY_BASIC_INFORMATION* lpBuffer,
    76      boost::winapi::SIZE_T_ dwLength
    77  );
    78  #else // !defined( BOOST_WINAPI_IS_MINGW )
    79  BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
    80  VirtualQuery(
    81      boost::winapi::LPCVOID_ lpAddress,
    82      ::_MEMORY_BASIC_INFORMATION* lpBuffer,
    83      boost::winapi::DWORD_ dwLength
    84  );
    85  #endif // !defined( BOOST_WINAPI_IS_MINGW )
    86  } // extern "C"
    87  #endif // #if !defined( BOOST_USE_WINDOWS_H )
    88  
    89  namespace boost {
    90  namespace winapi {
    91  
    92  typedef struct BOOST_MAY_ALIAS MEMORY_BASIC_INFORMATION_ {
    93      PVOID_  BaseAddress;
    94      PVOID_  AllocationBase;
    95      DWORD_  AllocationProtect;
    96      SIZE_T_ RegionSize;
    97      DWORD_  State;
    98      DWORD_  Protect;
    99      DWORD_  Type;
   100  } *PMEMORY_BASIC_INFORMATION_;
   101  
   102  #if defined( BOOST_USE_WINDOWS_H )
   103  BOOST_CONSTEXPR_OR_CONST DWORD_ DONT_RESOLVE_DLL_REFERENCES_           = DONT_RESOLVE_DLL_REFERENCES;
   104  BOOST_CONSTEXPR_OR_CONST DWORD_ LOAD_WITH_ALTERED_SEARCH_PATH_         = LOAD_WITH_ALTERED_SEARCH_PATH;
   105  #else // defined( BOOST_USE_WINDOWS_H )
   106  BOOST_CONSTEXPR_OR_CONST DWORD_ DONT_RESOLVE_DLL_REFERENCES_           = 0x00000001;
   107  BOOST_CONSTEXPR_OR_CONST DWORD_ LOAD_WITH_ALTERED_SEARCH_PATH_         = 0x00000008;
   108  #endif // defined( BOOST_USE_WINDOWS_H )
   109  
   110  // This one is not defined by MinGW
   111  BOOST_CONSTEXPR_OR_CONST DWORD_ LOAD_IGNORE_CODE_AUTHZ_LEVEL_          = 0x00000010;
   112  
   113  #if !defined( BOOST_NO_ANSI_APIS )
   114  using ::LoadLibraryA;
   115  using ::LoadLibraryExA;
   116  using ::GetModuleHandleA;
   117  using ::GetModuleFileNameA;
   118  #endif // !defined( BOOST_NO_ANSI_APIS )
   119  using ::LoadLibraryW;
   120  using ::LoadLibraryExW;
   121  using ::GetModuleHandleW;
   122  using ::GetModuleFileNameW;
   123  
   124  BOOST_FORCEINLINE SIZE_T_ VirtualQuery(LPCVOID_ lpAddress, MEMORY_BASIC_INFORMATION_* lpBuffer, SIZE_T_ dwLength)
   125  {
   126      return ::VirtualQuery(lpAddress, reinterpret_cast< ::_MEMORY_BASIC_INFORMATION* >(lpBuffer), dwLength);
   127  }
   128  
   129  #if !defined( BOOST_NO_ANSI_APIS )
   130  BOOST_FORCEINLINE HMODULE_ load_library(LPCSTR_ lpFileName)
   131  {
   132      return ::LoadLibraryA(lpFileName);
   133  }
   134  
   135  BOOST_FORCEINLINE HMODULE_ load_library_ex(LPCSTR_ lpFileName, HANDLE_ hFile, DWORD_ dwFlags)
   136  {
   137      return ::LoadLibraryExA(lpFileName, hFile, dwFlags);
   138  }
   139  
   140  BOOST_FORCEINLINE HMODULE_ get_module_handle(LPCSTR_ lpFileName)
   141  {
   142      return ::GetModuleHandleA(lpFileName);
   143  }
   144  
   145  BOOST_FORCEINLINE DWORD_ get_module_file_name(HMODULE_ hModule, LPSTR_ lpFilename, DWORD_ nSize)
   146  {
   147      return ::GetModuleFileNameA(hModule, lpFilename, nSize);
   148  }
   149  #endif // #if !defined( BOOST_NO_ANSI_APIS )
   150  
   151  BOOST_FORCEINLINE HMODULE_ load_library(LPCWSTR_ lpFileName)
   152  {
   153      return ::LoadLibraryW(lpFileName);
   154  }
   155  
   156  BOOST_FORCEINLINE HMODULE_ load_library_ex(LPCWSTR_ lpFileName, HANDLE_ hFile, DWORD_ dwFlags)
   157  {
   158      return ::LoadLibraryExW(lpFileName, hFile, dwFlags);
   159  }
   160  
   161  BOOST_FORCEINLINE HMODULE_ get_module_handle(LPCWSTR_ lpFileName)
   162  {
   163      return ::GetModuleHandleW(lpFileName);
   164  }
   165  
   166  BOOST_FORCEINLINE DWORD_ get_module_file_name(HMODULE_ hModule, LPWSTR_ lpFilename, DWORD_ nSize)
   167  {
   168      return ::GetModuleFileNameW(hModule, lpFilename, nSize);
   169  }
   170  
   171  } // namespace winapi
   172  } // namespace boost
   173  
   174  #endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
   175  
   176  //
   177  // FreeLibrary is in a different partition set (slightly)
   178  //
   179  
   180  #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
   181  
   182  #if !defined(BOOST_USE_WINDOWS_H)
   183  extern "C" {
   184  BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
   185  FreeLibrary(boost::winapi::HMODULE_ hModule);
   186  }
   187  #endif
   188  
   189  namespace boost {
   190  namespace winapi {
   191  using ::FreeLibrary;
   192  }
   193  }
   194  
   195  #endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
   196  
   197  #include <boost/winapi/detail/footer.hpp>
   198  
   199  #endif // BOOST_WINAPI_DLL_HPP_INCLUDED_