cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

library.h (3117B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Library Loader
      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_LIBRARY_H
     21#define WINPR_LIBRARY_H
     22
     23#include <winpr/winpr.h>
     24#include <winpr/wtypes.h>
     25
     26#if !defined(_WIN32) || defined(_UWP)
     27
     28typedef HANDLE DLL_DIRECTORY_COOKIE;
     29
     30#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
     31#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
     32#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
     33#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
     34
     35#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
     36#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
     37#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
     38#define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x00000010
     39#define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x00000020
     40#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x00000040
     41#define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
     42#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
     43#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
     44#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
     45#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
     46
     47#ifdef __cplusplus
     48extern "C"
     49{
     50#endif
     51
     52	WINPR_API DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory);
     53	WINPR_API BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie);
     54	WINPR_API BOOL SetDefaultDllDirectories(DWORD DirectoryFlags);
     55
     56	WINPR_API HMODULE LoadLibraryA(LPCSTR lpLibFileName);
     57	WINPR_API HMODULE LoadLibraryW(LPCWSTR lpLibFileName);
     58
     59	WINPR_API HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
     60	WINPR_API HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
     61
     62#ifdef __cplusplus
     63}
     64#endif
     65
     66#ifdef UNICODE
     67#define LoadLibrary LoadLibraryW
     68#define LoadLibraryEx LoadLibraryExW
     69#else
     70#define LoadLibrary LoadLibraryA
     71#define LoadLibraryEx LoadLibraryExA
     72#endif
     73
     74#endif
     75
     76#if !defined(_WIN32) && !defined(__CYGWIN__)
     77
     78#ifdef __cplusplus
     79extern "C"
     80{
     81#endif
     82
     83	WINPR_API HMODULE GetModuleHandleA(LPCSTR lpModuleName);
     84	WINPR_API HMODULE GetModuleHandleW(LPCWSTR lpModuleName);
     85
     86	WINPR_API DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
     87	WINPR_API DWORD GetModuleFileNameW(HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
     88
     89	WINPR_API FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
     90
     91	WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
     92
     93#ifdef __cplusplus
     94}
     95#endif
     96
     97#ifdef UNICODE
     98#define GetModuleHandle GetModuleHandleW
     99#define GetModuleFileName GetModuleFileNameW
    100#else
    101#define GetModuleHandle GetModuleHandleA
    102#define GetModuleFileName GetModuleFileNameA
    103#endif
    104
    105#endif
    106
    107#endif /* WINPR_LIBRARY_H */