@@ -31,18 +31,8 @@ The hooks in this file modify the following functions to work correctly with utf
31
31
MoveFile
32
32
DeleteFile
33
33
GetModuleHandle
34
- sopen_s
35
- _chdir
36
- _mkdir
37
- _rmdir
38
- remove
39
- rename
40
34
41
- The following will also work correctly with utf8 strings as they eventually call the above hooked functions:
42
-
43
- fopen
44
- unlink
45
- fstream
35
+ Some more will also work correctly with utf8 strings as they eventually call the above hooked functions
46
36
47
37
BUT
48
38
* Many other functions are not hooked and will need utf8 conversions when used, like these:
59
49
namespace SharedUtil
60
50
{
61
51
62
- // ///////////////////////////////////////////////////////////
63
- //
64
- // Function defs
65
- //
66
- // ///////////////////////////////////////////////////////////
67
-
68
- typedef
69
- HANDLE
70
- (WINAPI
71
- *FUNC_CreateFileA)(
72
- __in LPCSTR lpFileName,
73
- __in DWORD dwDesiredAccess,
74
- __in DWORD dwShareMode,
75
- __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
76
- __in DWORD dwCreationDisposition,
77
- __in DWORD dwFlagsAndAttributes,
78
- __in_opt HANDLE hTemplateFile
79
- );
80
-
81
- typedef
82
- HMODULE
83
- (WINAPI
84
- *FUNC_LoadLibraryA)(
85
- __in LPCSTR lpLibFileName
86
- );
87
-
88
- typedef
89
- HMODULE
90
- (WINAPI
91
- *FUNC_LoadLibraryExA)(
92
- __in LPCSTR lpLibFileName,
93
- __reserved HANDLE hFile,
94
- __in DWORD dwFlags
95
- );
96
-
97
- typedef
98
- BOOL
99
- (WINAPI
100
- *FUNC_SetDllDirectoryA)(
101
- __in_opt LPCSTR lpPathName
102
- );
103
-
104
- typedef
105
- BOOL
106
- (WINAPI
107
- *FUNC_SetCurrentDirectoryA)(
108
- __in LPCSTR lpPathName
109
- );
110
-
111
- typedef int (WINAPI *FUNC_AddFontResourceExA)( __in LPCSTR name, __in DWORD fl, __reserved PVOID res);
112
- typedef BOOL (WINAPI *FUNC_RemoveFontResourceExA)( __in LPCSTR name, __in DWORD fl, __reserved PVOID pdv);
113
-
114
- typedef
115
- BOOL
116
- (WINAPI
117
- *FUNC_RemoveDirectoryA)(
118
- __in LPCSTR lpPathName
119
- );
120
-
121
- typedef
122
- BOOL
123
- (WINAPI
124
- *FUNC_GetDiskFreeSpaceExA)(
125
- __in_opt LPCSTR lpDirectoryName,
126
- __out_opt PULARGE_INTEGER lpFreeBytesAvailableToCaller,
127
- __out_opt PULARGE_INTEGER lpTotalNumberOfBytes,
128
- __out_opt PULARGE_INTEGER lpTotalNumberOfFreeBytes
129
- );
130
-
131
- typedef
132
- DWORD
133
- (WINAPI
134
- *FUNC_GetFileAttributesA)(
135
- __in LPCSTR lpFileName
136
- );
137
-
138
- typedef
139
- BOOL
140
- (WINAPI
141
- *FUNC_SetFileAttributesA)(
142
- __in LPCSTR lpFileName,
143
- __in DWORD dwFileAttributes
144
- );
145
-
146
- typedef HINSTANCE (STDAPICALLTYPE *FUNC_ShellExecuteA)(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters,
147
- LPCSTR lpDirectory, INT nShowCmd);
148
-
149
- typedef
150
- BOOL
151
- (WINAPI
152
- *FUNC_CreateDirectoryA)(
153
- __in LPCSTR lpPathName,
154
- __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
155
- );
156
-
157
- typedef
158
- BOOL
159
- (WINAPI
160
- *FUNC_CopyFileA)(
161
- __in LPCSTR lpExistingFileName,
162
- __in LPCSTR lpNewFileName,
163
- __in BOOL bFailIfExists
164
- );
165
-
166
- typedef
167
- BOOL
168
- (WINAPI
169
- *FUNC_MoveFileA)(
170
- __in LPCSTR lpExistingFileName,
171
- __in LPCSTR lpNewFileName
172
- );
173
-
174
- typedef
175
- BOOL
176
- (WINAPI
177
- *FUNC_DeleteFileA)(
178
- __in LPCSTR lpFileName
179
- );
180
-
181
- typedef
182
- HMODULE
183
- (WINAPI
184
- *FUNC_GetModuleHandleA)(
185
- __in_opt LPCSTR lpModuleName
186
- );
187
-
188
52
// ///////////////////////////////////////////////////////////
189
53
//
190
54
// Hook variables
191
55
//
192
56
// ///////////////////////////////////////////////////////////
193
57
#define HOOKVAR (name ) \
58
+ using FUNC_##name = decltype (&name); \
194
59
FUNC_##name pfn##name;
195
60
196
61
HOOKVAR ( CreateFileA )
0 commit comments