Blame winpr/include/winpr/library.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * WinPR: Windows Portable Runtime
Packit 1fb8d4
 * Library Loader
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef WINPR_LIBRARY_H
Packit 1fb8d4
#define WINPR_LIBRARY_H
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/winpr.h>
Packit 1fb8d4
#include <winpr/wtypes.h>
Packit 1fb8d4
Packit 1fb8d4
#if !defined(_WIN32) || defined(_UWP)
Packit 1fb8d4
Packit 1fb8d4
typedef HANDLE DLL_DIRECTORY_COOKIE;
Packit 1fb8d4
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
Packit Service 5a9772
Packit Service 5a9772
#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
Packit Service 5a9772
#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
Packit Service 5a9772
#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
Packit Service 5a9772
#define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x00000010
Packit Service 5a9772
#define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x00000020
Packit Service 5a9772
#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x00000040
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
Packit Service 5a9772
#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory);
Packit Service 5a9772
	WINPR_API BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie);
Packit Service 5a9772
	WINPR_API BOOL SetDefaultDllDirectories(DWORD DirectoryFlags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HMODULE LoadLibraryA(LPCSTR lpLibFileName);
Packit Service 5a9772
	WINPR_API HMODULE LoadLibraryW(LPCWSTR lpLibFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
Packit Service 5a9772
	WINPR_API HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define LoadLibrary LoadLibraryW
Packit Service 5a9772
#define LoadLibraryEx LoadLibraryExW
Packit 1fb8d4
#else
Packit Service 5a9772
#define LoadLibrary LoadLibraryA
Packit Service 5a9772
#define LoadLibraryEx LoadLibraryExA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#if !defined(_WIN32) && !defined(__CYGWIN__)
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HMODULE GetModuleHandleA(LPCSTR lpModuleName);
Packit Service 5a9772
	WINPR_API HMODULE GetModuleHandleW(LPCWSTR lpModuleName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
Packit Service 5a9772
	WINPR_API DWORD GetModuleFileNameW(HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define GetModuleHandle GetModuleHandleW
Packit Service 5a9772
#define GetModuleFileName GetModuleFileNameW
Packit 1fb8d4
#else
Packit Service 5a9772
#define GetModuleHandle GetModuleHandleA
Packit Service 5a9772
#define GetModuleFileName GetModuleFileNameA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* WINPR_LIBRARY_H */