1 #ifndef _WDL_WIN32_UTF8_H_
2 #define _WDL_WIN32_UTF8_H_
8 #if defined(_WIN32) && !defined(WDL_NO_SUPPORT_UTF8)
10 #ifndef WDL_WIN32_UTF8_IMPL
11 #define WDL_WIN32_UTF8_IMPL
12 #define WDL_WIN32_UTF8_IMPL_NOTSTATIC
19 WDL_WIN32_UTF8_IMPL BOOL
SetWindowTextUTF8(HWND hwnd
, LPCTSTR str
);
20 WDL_WIN32_UTF8_IMPL BOOL
SetDlgItemTextUTF8(HWND hDlg
, int nIDDlgItem
, LPCTSTR lpString
);
21 WDL_WIN32_UTF8_IMPL
int GetWindowTextUTF8(HWND hWnd
, LPTSTR lpString
, int nMaxCount
);
22 WDL_WIN32_UTF8_IMPL UINT
GetDlgItemTextUTF8(HWND hDlg
, int nIDDlgItem
, LPTSTR lpString
, int nMaxCount
);
23 WDL_WIN32_UTF8_IMPL
int MessageBoxUTF8(HWND hwnd
, LPCTSTR lpText
, LPCTSTR lpCaption
, UINT fl
);
25 WDL_WIN32_UTF8_IMPL BOOL
CreateDirectoryUTF8(LPCTSTR path
, LPSECURITY_ATTRIBUTES attr
);
26 WDL_WIN32_UTF8_IMPL BOOL
DeleteFileUTF8(LPCTSTR path
);
27 WDL_WIN32_UTF8_IMPL BOOL
MoveFileUTF8(LPCTSTR existfn
, LPCTSTR newfn
);
28 WDL_WIN32_UTF8_IMPL BOOL
CopyFileUTF8(LPCTSTR existfn
, LPCTSTR newfn
, BOOL fie
);
29 WDL_WIN32_UTF8_IMPL DWORD
GetCurrentDirectoryUTF8(DWORD nBufferLength
, LPTSTR lpBuffer
);
30 WDL_WIN32_UTF8_IMPL BOOL
SetCurrentDirectoryUTF8(LPCTSTR path
);
31 WDL_WIN32_UTF8_IMPL BOOL
RemoveDirectoryUTF8(LPCTSTR path
);
32 WDL_WIN32_UTF8_IMPL HINSTANCE
LoadLibraryUTF8(LPCTSTR path
);
34 WDL_WIN32_UTF8_IMPL HANDLE
CreateFileUTF8(LPCTSTR lpFileName
,DWORD dwDesiredAccess
,DWORD dwShareMode
,LPSECURITY_ATTRIBUTES lpSecurityAttributes
,DWORD dwCreationDisposition
,DWORD dwFlagsAndAttributes
,HANDLE hTemplateFile
);
36 WDL_WIN32_UTF8_IMPL UINT
DragQueryFileUTF8(HDROP hDrop
, UINT idx
, char *buf
, UINT bufsz
);
38 WDL_WIN32_UTF8_IMPL
int DrawTextUTF8(HDC hdc
, LPCTSTR str
, int nc
, LPRECT lpRect
, UINT format
);
40 WDL_WIN32_UTF8_IMPL BOOL
GetOpenFileNameUTF8(LPOPENFILENAME lpofn
);
41 WDL_WIN32_UTF8_IMPL BOOL
GetSaveFileNameUTF8(LPOPENFILENAME lpofn
);
43 #if _MSC_VER > 1700 && defined(_WIN64)
44 WDL_WIN32_UTF8_IMPL BOOL
SHGetPathFromIDListUTF8(const struct _ITEMIDLIST __unaligned
*pidl
, LPSTR pszPath
, int pszPathLen
);
46 WDL_WIN32_UTF8_IMPL BOOL
SHGetPathFromIDListUTF8(const struct _ITEMIDLIST
*pidl
, LPSTR pszPath
, int pszPathLen
);
49 WDL_WIN32_UTF8_IMPL BOOL
SHGetSpecialFolderPathUTF8(HWND hwndOwner
, LPTSTR lpszPath
, int pszPathLen
, int csidl
, BOOL create
);
51 WDL_WIN32_UTF8_IMPL
struct _ITEMIDLIST
*SHBrowseForFolderUTF8(struct _browseinfoA
*browseInfoA
);
52 WDL_WIN32_UTF8_IMPL
int WDL_UTF8_SendBFFM_SETSEL(HWND hwnd
, const char *str
); // sends BFFM_SETSELECTIONA or BFFM_SETSELECTIONW
54 WDL_WIN32_UTF8_IMPL HINSTANCE
ShellExecuteUTF8(HWND hwnd
, LPCTSTR lpOp
, LPCTSTR lpFile
, LPCTSTR lpParm
, LPCTSTR lpDir
, INT nShowCmd
);
56 WDL_WIN32_UTF8_IMPL BOOL
GetUserNameUTF8(LPTSTR lpString
, LPDWORD nMaxCount
);
57 WDL_WIN32_UTF8_IMPL BOOL
GetComputerNameUTF8(LPTSTR lpString
, LPDWORD nMaxCount
);
59 WDL_WIN32_UTF8_IMPL BOOL
InsertMenuUTF8(HMENU hMenu
, UINT uPosition
, UINT uFlags
, UINT_PTR uIDNewItem
, LPCTSTR str
);
60 WDL_WIN32_UTF8_IMPL BOOL
InsertMenuItemUTF8( HMENU hMenu
,UINT uItem
, BOOL fByPosition
, LPMENUITEMINFO lpmii
);
61 WDL_WIN32_UTF8_IMPL BOOL
SetMenuItemInfoUTF8(HMENU hMenu
, UINT uItem
, BOOL fByPosition
,LPMENUITEMINFO lpmii
);
62 WDL_WIN32_UTF8_IMPL BOOL
GetMenuItemInfoUTF8(HMENU hMenu
, UINT uItem
,BOOL fByPosition
,LPMENUITEMINFO lpmii
);
64 WDL_WIN32_UTF8_IMPL
int statUTF8(const char *filename
, struct stat
*buffer
);
65 WDL_WIN32_UTF8_IMPL
FILE *fopenUTF8(const char *filename
, const char *mode
);
67 WDL_WIN32_UTF8_IMPL
int GetKeyNameTextUTF8(LONG lParam
, LPTSTR lpString
, int nMaxCount
);
70 WDL_WIN32_UTF8_IMPL WCHAR
*WDL_UTF8ToWC(const char *buf
, BOOL doublenull
, int minsize
, DWORD
*sizeout
);
72 WDL_WIN32_UTF8_IMPL BOOL
WDL_HasUTF8(const char *_str
);
74 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_HookComboBox(HWND h
);
75 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_HookListView(HWND h
);
76 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_HookListBox(HWND h
);
77 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_HookTreeView(HWND h
);
78 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_HookTabCtrl(HWND h
);
80 WDL_WIN32_UTF8_IMPL LPSTR
GetCommandParametersUTF8();
81 WDL_WIN32_UTF8_IMPL
void WDL_UTF8_ListViewConvertDispInfoToW(void *di
); //NMLVDISPINFO
83 WDL_WIN32_UTF8_IMPL UINT
GetPrivateProfileIntUTF8(LPCTSTR appStr
, LPCTSTR keyStr
, INT def
, LPCTSTR fnStr
);
84 WDL_WIN32_UTF8_IMPL DWORD
GetPrivateProfileStringUTF8(LPCTSTR appStr
, LPCTSTR keyStr
, LPCTSTR defStr
, LPTSTR retStr
, DWORD nSize
, LPCTSTR fnStr
);
85 WDL_WIN32_UTF8_IMPL BOOL
WritePrivateProfileStringUTF8(LPCTSTR appStr
, LPCTSTR keyStr
, LPCTSTR str
, LPCTSTR fnStr
);
86 WDL_WIN32_UTF8_IMPL BOOL
GetPrivateProfileStructUTF8(LPCTSTR appStr
, LPCTSTR keyStr
, LPVOID pStruct
, UINT uSize
, LPCTSTR fnStr
);
87 WDL_WIN32_UTF8_IMPL BOOL
WritePrivateProfileStructUTF8(LPCTSTR appStr
, LPCTSTR keyStr
, LPVOID pStruct
, UINT uSize
, LPCTSTR fnStr
);
89 WDL_WIN32_UTF8_IMPL DWORD
GetModuleFileNameUTF8(HMODULE hModule
, LPTSTR fnStr
, DWORD nSize
);
91 WDL_WIN32_UTF8_IMPL BOOL
CreateProcessUTF8( LPCTSTR lpApplicationName
, LPTSTR lpCommandLine
,
92 LPSECURITY_ATTRIBUTES lpProcessAttributes
,
93 LPSECURITY_ATTRIBUTES lpThreadAttributes
, BOOL bInheritHandles
,
94 DWORD dwCreationFlags
,
96 LPCTSTR lpCurrentDirectory
,
97 LPSTARTUPINFO lpStartupInfo
,
98 LPPROCESS_INFORMATION lpProcessInformation
);
103 #define SetWindowText SetWindowTextUTF8
105 #ifdef SetDlgItemText
106 #undef SetDlgItemText
108 #define SetDlgItemText SetDlgItemTextUTF8
114 #define GetWindowText GetWindowTextUTF8
116 #ifdef GetDlgItemText
117 #undef GetDlgItemText
119 #define GetDlgItemText GetDlgItemTextUTF8
124 #define MessageBox MessageBoxUTF8
129 #define DragQueryFile DragQueryFileUTF8
131 #ifdef GetOpenFileName
132 #undef GetOpenFileName
134 #define GetOpenFileName GetOpenFileNameUTF8
136 #ifdef GetSaveFileName
137 #undef GetSaveFileName
139 #define GetSaveFileName GetSaveFileNameUTF8
144 #define ShellExecute ShellExecuteUTF8
149 #define GetUserName GetUserNameUTF8
151 #ifdef GetComputerName
152 #undef GetComputerName
154 #define GetComputerName GetComputerNameUTF8
156 #ifdef CreateDirectory
157 #undef CreateDirectory
159 #define CreateDirectory CreateDirectoryUTF8
164 #define DeleteFile DeleteFileUTF8
169 #define MoveFile MoveFileUTF8
174 #define CopyFile CopyFileUTF8
176 #ifdef GetCurrentDirectory
177 #undef GetCurrentDirectory
179 #define GetCurrentDirectory GetCurrentDirectoryUTF8
181 #ifdef SetCurrentDirectory
182 #undef SetCurrentDirectory
184 #define SetCurrentDirectory SetCurrentDirectoryUTF8
187 #ifdef RemoveDirectory
188 #undef RemoveDirectory
190 #define RemoveDirectory RemoveDirectoryUTF8
196 #define CreateFile CreateFileUTF8
202 #define InsertMenu InsertMenuUTF8
204 #ifdef InsertMenuItem
205 #undef InsertMenuItem
207 #define InsertMenuItem InsertMenuItemUTF8
209 #ifdef SetMenuItemInfo
210 #undef SetMenuItemInfo
212 #define SetMenuItemInfo SetMenuItemInfoUTF8
214 #ifdef GetMenuItemInfo
215 #undef GetMenuItemInfo
217 #define GetMenuItemInfo GetMenuItemInfoUTF8
222 #define LoadLibrary LoadLibraryUTF8
224 #ifdef GetPrivateProfileInt
225 #undef GetPrivateProfileInt
227 #define GetPrivateProfileInt GetPrivateProfileIntUTF8
229 #ifdef GetPrivateProfileString
230 #undef GetPrivateProfileString
232 #define GetPrivateProfileString GetPrivateProfileStringUTF8
234 #ifdef WritePrivateProfileString
235 #undef WritePrivateProfileString
237 #define WritePrivateProfileString WritePrivateProfileStringUTF8
239 #ifdef WritePrivateProfileStruct
240 #undef WritePrivateProfileStruct
242 #define WritePrivateProfileStruct WritePrivateProfileStructUTF8
244 #ifdef GetPrivateProfileStruct
245 #undef GetPrivateProfileStruct
247 #define GetPrivateProfileStruct GetPrivateProfileStructUTF8
250 #ifdef GetModuleFileName
251 #undef GetModuleFileName
253 #define GetModuleFileName GetModuleFileNameUTF8
258 #define CreateProcess CreateProcessUTF8
262 // compat defines for when UTF disabled
263 #define DrawTextUTF8 DrawText
264 #define statUTF8 stat
265 #define fopenUTF8 fopen
266 #define WDL_UTF8_HookComboBox(x)
267 #define WDL_UTF8_HookListView(x)
268 #define WDL_UTF8_HookListBox(x)
269 #define WDL_UTF8_HookTreeView(x)
270 #define WDL_UTF8_HookTabCtrl(x)
271 #define WDL_UTF8_ListViewConvertDispInfoToW(x)