OSDN Git Service

Shell Extension for Windows 11 or later (5)
[winmerge-jp/winmerge-jp.git] / Src / dllpstub.h
1 #pragma once
2
3 /**
4  * @brief define the suffixes to decorate TCHAR width specific module/function names
5  */
6
7 #ifdef _UNICODE
8 #define DECORATE_A
9 #define DECORATE_W "W"
10 #define DECORATE_U "U"
11 #else
12 #define DECORATE_A "A"
13 #define DECORATE_W
14 #define DECORATE_U
15 #endif
16 #define DECORATE_AW DECORATE_A DECORATE_W
17
18 /**
19  * @brief stub class to help implement DLL proxies
20  *
21  * A DLLPSTUB must be embedded in an object followed immediately by a 
22  * char array name of the DLL to load
23  * Eg
24  *  ...
25  *  DLLPSTUB stub;
26  *  char dllname[50];
27  *
28  * If dll is not found, DLLPSTUB::Load will throw an exception
29  * If any of dwMajorVersion, dwMinorVersion, dwBuildNumber are non-zero
30  * the DLLPSTUB::Load will throw an exception (CO_S_NOTALLINTERFACES) unless
31  * the dll exports DllGetVersion and reports a version at least as high as
32  * requested by these members
33  */
34 struct DLLPSTUB
35 {
36         DWORD dwMajorVersion;                                   // Major version
37         DWORD dwMinorVersion;                                   // Minor version
38         DWORD dwBuildNumber;                                    // Build number
39         DWORD dwPadding;                                                // Pad to 64 bit boundary
40         static void Throw(LPCSTR name, HMODULE, DWORD dwError, bool bFreeLibrary);
41         HMODULE Load();
42 };