11#pragma once
22
33#include <Windows.h>
4- #include "../Snap.Hutao.Remastered.Native/IHutaoNative_h.h"
5- #include "../Snap.Hutao.Remastered.Native/IHutaoNativeRegistryNotification_h.h"
6- #include "../Snap.Hutao.Remastered.Native/IHutaoString_h.h"
4+ #include "../Snap.Hutao.Remastered.Native/IHutaoNative.h"
5+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeLoopbackSupport.h"
6+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeRegistryNotification.h"
7+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeWindowSubclass.h"
8+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeWindowNonRude.h"
9+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeDeviceCapabilities.h"
10+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativePhysicalDrive.h"
11+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeLogicalDrive.h"
12+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeInputLowLevelKeyboardSource.h"
13+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeFileSystem.h"
14+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeFileSystem2.h"
15+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeFileSystem3.h"
16+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeFileSystem4.h"
17+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeNotifyIcon.h"
18+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeHotKeyAction.h"
19+ #include "../Snap.Hutao.Remastered.Native/IHutaoNativeProcess.h"
20+ #include "../Snap.Hutao.Remastered.Native/IHutaoString.h"
721#include "../Snap.Hutao.Remastered.Native/HutaoNativeLoggingCallback.h"
822#include "../Snap.Hutao.Remastered.Native/HutaoNativeMessageCallback.h"
23+ #include "../Snap.Hutao.Remastered.Native/HutaoNativeHotKeyBeforeSwitchCallback.h"
924
10- #define DLL_IMPORT __declspec(dllimport) extern "C"
25+ // Empty callback function definitions
26+ static void __stdcall EmptyMessageCallback (FailureInfo * , PWSTR , ULONG64 ) {}
27+ static void __stdcall EmptyLoggingCallback (FailureInfo * ) {}
1128
12- DLL_IMPORT HRESULT __stdcall HutaoCreateInstance (
29+ extern "C" {
30+
31+ __declspec(dllimport ) HRESULT __stdcall HutaoCreateInstance (
1332 IHutaoNative * * ppInstance );
14- DLL_IMPORT HRESULT __stdcall HutaoStringCreateInstance (
33+
34+ __declspec(dllimport ) HRESULT __stdcall HutaoStringCreateInstance (
1535 IHutaoString * * ppInstance );
16- DLL_IMPORT HRESULT __stdcall HutaoNativeRegistryNotificationCreateInstance (
36+
37+ __declspec(dllimport ) HRESULT __stdcall HutaoNativeRegistryNotificationCreateInstance (
1738 IHutaoNativeRegistryNotification * * ppInstance );
18- DLL_IMPORT HRESULT HutaoInitializeWilCallbacks (HutaoNativeLoggingCallback loggingCallback , HutaoNativeMessageCallback messageCallback );
19- DLL_IMPORT void HutaoTestWilCallbacks ();
39+
40+ __declspec(dllimport ) HRESULT __stdcall HutaoInitializeWilCallbacks (
41+ HutaoNativeLoggingCallback loggingCallback ,
42+ HutaoNativeMessageCallback messageCallback );
43+
44+ __declspec(dllimport ) void __stdcall HutaoTestWilCallbacks ();
45+
46+ __declspec(dllimport ) BOOL __stdcall HutaoHResultIsWin32 (HRESULT hr , WIN32_ERROR error );
47+
48+ __declspec(dllimport ) HRESULT __stdcall HutaoNativeHotKeyInitializeBeforeSwitchCallback (
49+ HutaoNativeHotKeyBeforeSwitchCallback callback );
50+
51+ }
52+
53+ // Test helper function declarations
54+ inline HRESULT MakeHutaoNative (IHutaoNative * * ppInstance )
55+ {
56+ return HutaoCreateInstance (ppInstance );
57+ }
58+
59+ inline HRESULT MakeHutaoNative2 (IHutaoNative2 * * ppInstance )
60+ {
61+ // IHutaoNative2 is derived from IHutaoNative
62+ IHutaoNative * pNative = nullptr ;
63+ HRESULT hr = HutaoCreateInstance (& pNative );
64+ if (SUCCEEDED (hr ))
65+ {
66+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative2 ), (void * * )ppInstance );
67+ pNative -> Release ();
68+ }
69+ return hr ;
70+ }
71+
72+ inline HRESULT MakeHutaoNative3 (IHutaoNative3 * * ppInstance )
73+ {
74+ // IHutaoNative3 is derived from IHutaoNative
75+ IHutaoNative * pNative = nullptr ;
76+ HRESULT hr = HutaoCreateInstance (& pNative );
77+ if (SUCCEEDED (hr ))
78+ {
79+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative3 ), (void * * )ppInstance );
80+ pNative -> Release ();
81+ }
82+ return hr ;
83+ }
84+
85+ inline HRESULT MakeHutaoNative4 (IHutaoNative4 * * ppInstance )
86+ {
87+ // IHutaoNative4 is derived from IHutaoNative
88+ IHutaoNative * pNative = nullptr ;
89+ HRESULT hr = HutaoCreateInstance (& pNative );
90+ if (SUCCEEDED (hr ))
91+ {
92+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative4 ), (void * * )ppInstance );
93+ pNative -> Release ();
94+ }
95+ return hr ;
96+ }
97+
98+ inline HRESULT MakeHutaoNative5 (IHutaoNative5 * * ppInstance )
99+ {
100+ // IHutaoNative5 is derived from IHutaoNative
101+ IHutaoNative * pNative = nullptr ;
102+ HRESULT hr = HutaoCreateInstance (& pNative );
103+ if (SUCCEEDED (hr ))
104+ {
105+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative5 ), (void * * )ppInstance );
106+ pNative -> Release ();
107+ }
108+ return hr ;
109+ }
110+
111+ inline HRESULT MakeHutaoNative6 (IHutaoNative6 * * ppInstance )
112+ {
113+ // IHutaoNative6 is derived from IHutaoNative
114+ IHutaoNative * pNative = nullptr ;
115+ HRESULT hr = HutaoCreateInstance (& pNative );
116+ if (SUCCEEDED (hr ))
117+ {
118+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative6 ), (void * * )ppInstance );
119+ pNative -> Release ();
120+ }
121+ return hr ;
122+ }
123+
124+ inline HRESULT MakeHutaoNative7 (IHutaoNative7 * * ppInstance )
125+ {
126+ // IHutaoNative7 is derived from IHutaoNative
127+ IHutaoNative * pNative = nullptr ;
128+ HRESULT hr = HutaoCreateInstance (& pNative );
129+ if (SUCCEEDED (hr ))
130+ {
131+ hr = pNative -> QueryInterface (__uuidof (IHutaoNative7 ), (void * * )ppInstance );
132+ pNative -> Release ();
133+ }
134+ return hr ;
135+ }
136+
137+ inline HRESULT MakeRegistryNotification (IHutaoNativeRegistryNotification * * ppInstance )
138+ {
139+ return HutaoNativeRegistryNotificationCreateInstance (ppInstance );
140+ }
141+
142+ inline HRESULT MakeWindowSubclass (HWND hWnd , HutaoNativeWindowSubclassCallback callback , GCHandle userData , IHutaoNativeWindowSubclass * * ppInstance )
143+ {
144+ // Create through IHutaoNative
145+ IHutaoNative * pNative = nullptr ;
146+ HRESULT hr = HutaoCreateInstance (& pNative );
147+ if (SUCCEEDED (hr ))
148+ {
149+ hr = pNative -> MakeWindowSubclass (hWnd , callback , userData , ppInstance );
150+ pNative -> Release ();
151+ }
152+ return hr ;
153+ }
154+
155+ inline HRESULT MakeWindowNonRude (HWND hWnd , IHutaoNativeWindowNonRude * * ppInstance )
156+ {
157+ // Create through IHutaoNative
158+ IHutaoNative * pNative = nullptr ;
159+ HRESULT hr = HutaoCreateInstance (& pNative );
160+ if (SUCCEEDED (hr ))
161+ {
162+ hr = pNative -> MakeWindowNonRude (hWnd , ppInstance );
163+ pNative -> Release ();
164+ }
165+ return hr ;
166+ }
167+ inline void SetHutaoNativeLoggingCallback (HutaoNativeLoggingCallback callback )
168+ {
169+ // Use empty message callback
170+ HutaoNativeMessageCallback emptyMsgCallback = HutaoNativeMessageCallback ::Create (EmptyMessageCallback );
171+ HutaoInitializeWilCallbacks (callback , emptyMsgCallback );
172+ }
173+
174+ inline void SetHutaoNativeMessageCallback (HutaoNativeMessageCallback callback )
175+ {
176+ // Use empty logging callback
177+ HutaoNativeLoggingCallback emptyLogCallback = HutaoNativeLoggingCallback ::Create (EmptyLoggingCallback );
178+ HutaoInitializeWilCallbacks (emptyLogCallback , callback );
179+ }
0 commit comments