2 // Copyright (C) 2011 Suguru Kawamoto
\r
3 // マルチバイト文字ワイド文字APIラッパー
\r
5 #ifndef __MBSWRAPPER_H__
\r
6 #define __MBSWRAPPER_H__
\r
12 #ifndef DO_NOT_REPLACE
\r
15 #define WinMain WinMainM
\r
16 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow);
\r
18 #define LoadLibrary LoadLibraryM
\r
19 HMODULE LoadLibraryM(LPCSTR lpLibFileName);
\r
21 #define CreateFile CreateFileM
\r
22 HANDLE CreateFileM(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
\r
24 #define MessageBox MessageBoxM
\r
25 int MessageBoxM(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
\r
26 #undef FindFirstFile
\r
27 #define FindFirstFile FindFirstFileM
\r
28 HANDLE FindFirstFileM(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
\r
30 #define FindNextFile FindNextFileM
\r
31 BOOL FindNextFileM(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
\r
32 #undef FindFirstChangeNotification
\r
33 #define FindFirstChangeNotification FindFirstChangeNotificationM
\r
34 HANDLE FindFirstChangeNotificationM(LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter);
\r
35 #undef GetLogicalDriveStrings
\r
36 #define GetLogicalDriveStrings GetLogicalDriveStringsM
\r
37 DWORD GetLogicalDriveStringsM(DWORD nBufferLength, LPSTR lpBuffer);
\r
38 #undef RegisterClassEx
\r
39 #define RegisterClassEx RegisterClassExM
\r
40 ATOM RegisterClassExM(CONST WNDCLASSEXA * v0);
\r
41 #undef CreateWindowEx
\r
42 #define CreateWindowEx CreateWindowExM
\r
43 HWND CreateWindowExM(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
\r
44 #undef GetWindowLong
\r
45 #define GetWindowLong GetWindowLongM
\r
46 LONG GetWindowLongM(HWND hWnd, int nIndex);
\r
47 #undef SetWindowLong
\r
48 #define SetWindowLong SetWindowLongM
\r
49 LONG SetWindowLongM(HWND hWnd, int nIndex, LONG dwNewLong);
\r
50 #undef GetWindowLongPtr
\r
51 #define GetWindowLongPtr GetWindowLongPtrM
\r
52 LONG_PTR GetWindowLongPtrM(HWND hWnd, int nIndex);
\r
53 #undef SetWindowLongPtr
\r
54 #define SetWindowLongPtr SetWindowLongPtrM
\r
55 LONG_PTR SetWindowLongPtrM(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
\r
56 #undef DefWindowProc
\r
57 #define DefWindowProc DefWindowProcM
\r
58 LRESULT DefWindowProcM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
59 #undef CallWindowProc
\r
60 #define CallWindowProc CallWindowProcM
\r
61 LRESULT CallWindowProcM(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
63 #define SendMessage SendMessageM
\r
64 LRESULT SendMessageM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
66 #define DefDlgProc DefDlgProcM
\r
67 LRESULT DefDlgProcM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
68 #undef SendDlgItemMessage
\r
69 #define SendDlgItemMessage SendDlgItemMessageM
\r
70 LRESULT SendDlgItemMessageM(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
71 #undef SetWindowText
\r
72 #define SetWindowText SetWindowTextM
\r
73 BOOL SetWindowTextM(HWND hWnd, LPCSTR lpString);
\r
74 #undef DragQueryFile
\r
75 #define DragQueryFile DragQueryFileM
\r
76 UINT DragQueryFileM(HDROP hDrop, UINT iFile, LPSTR lpszFile, UINT cch);
\r
77 #undef GetCommandLine
\r
78 #define GetCommandLine GetCommandLineM
\r
79 LPSTR GetCommandLineM();
\r
80 #undef GetCurrentDirectory
\r
81 #define GetCurrentDirectory GetCurrentDirectoryM
\r
82 DWORD GetCurrentDirectoryM(DWORD nBufferLength, LPSTR lpBuffer);
\r
83 #undef SetCurrentDirectory
\r
84 #define SetCurrentDirectory SetCurrentDirectoryM
\r
85 BOOL SetCurrentDirectoryM(LPCSTR lpPathName);
\r
87 #define GetTempPath GetTempPathM
\r
88 DWORD GetTempPathM(DWORD nBufferLength, LPSTR lpBuffer);
\r
89 #undef GetFileAttributes
\r
90 #define GetFileAttributes GetFileAttributesM
\r
91 DWORD GetFileAttributesM(LPCSTR lpFileName);
\r
92 #undef GetModuleFileName
\r
93 #define GetModuleFileName GetModuleFileNameM
\r
94 DWORD GetModuleFileNameM(HMODULE hModule, LPCH lpFilename, DWORD nSize);
\r
96 #define RegOpenKeyEx RegOpenKeyExM
\r
97 LSTATUS RegOpenKeyExM(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
\r
98 #undef RegCreateKeyEx
\r
99 #define RegCreateKeyEx RegCreateKeyExM
\r
100 LSTATUS RegCreateKeyExM(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition);
\r
101 #undef RegDeleteValue
\r
102 #define RegDeleteValue RegDeleteValueM
\r
103 LSTATUS RegDeleteValueM(HKEY hKey, LPCSTR lpValueName);
\r
104 #undef RegQueryValueEx
\r
105 #define RegQueryValueEx RegQueryValueExM
\r
106 LSTATUS RegQueryValueExM(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
\r
107 #undef RegSetValueEx
\r
108 #define RegSetValueEx RegSetValueExM
\r
109 LSTATUS RegSetValueExM(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData);
\r
111 #define TextOut TextOutM
\r
112 BOOL TextOutM(HDC hdc, int x, int y, LPCSTR lpString, int c);
\r
113 #undef GetTextExtentPoint32
\r
114 #define GetTextExtentPoint32 GetTextExtentPoint32M
\r
115 BOOL GetTextExtentPoint32M(HDC hdc, LPCSTR lpString, int c, LPSIZE psizl);
\r
116 #undef PropertySheet
\r
117 #define PropertySheet PropertySheetM
\r
118 INT_PTR PropertySheetM(LPCPROPSHEETHEADERA v0);
\r
119 #undef GetOpenFileName
\r
120 #define GetOpenFileName GetOpenFileNameM
\r
121 BOOL GetOpenFileNameM(LPOPENFILENAMEA v0);
\r
122 #undef GetSaveFileName
\r
123 #define GetSaveFileName GetSaveFileNameM
\r
124 BOOL GetSaveFileNameM(LPOPENFILENAMEA v0);
\r
126 #define HtmlHelp HtmlHelpM
\r
127 HWND HtmlHelpM(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData);
\r
128 #undef CreateProcess
\r
129 #define CreateProcess CreateProcessM
\r
130 BOOL CreateProcessM(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
\r
131 #undef FindExecutable
\r
132 #define FindExecutable FindExecutableM
\r
133 HINSTANCE FindExecutableM(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult);
\r
134 #undef ShellExecute
\r
135 #define ShellExecute ShellExecuteM
\r
136 HINSTANCE ShellExecuteM(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
\r
137 #undef ShellExecuteEx
\r
138 #define ShellExecuteEx ShellExecuteExM
\r
139 BOOL ShellExecuteExM(LPSHELLEXECUTEINFOA lpExecInfo);
\r
140 #undef SHBrowseForFolder
\r
141 #define SHBrowseForFolder SHBrowseForFolderM
\r
142 PIDLIST_ABSOLUTE SHBrowseForFolderM(LPBROWSEINFOA lpbi);
\r
143 #undef SHGetPathFromIDList
\r
144 #define SHGetPathFromIDList SHGetPathFromIDListM
\r
145 BOOL SHGetPathFromIDListM(PCIDLIST_ABSOLUTE pidl, LPSTR pszPath);
\r
146 #undef SHFileOperation
\r
147 #define SHFileOperation SHFileOperationM
\r
148 int SHFileOperationM(LPSHFILEOPSTRUCTA lpFileOp);
\r
149 #undef SHGetFileInfo
\r
150 #define SHGetFileInfo SHGetFileInfoM
\r
151 DWORD_PTR SHGetFileInfoM(LPCSTR pszPath, DWORD dwFileAttributes, SHFILEINFOA *psfi, UINT cbFileInfo, UINT uFlags);
\r
153 #define AppendMenu AppendMenuM
\r
154 BOOL AppendMenuM(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem);
\r
155 #undef GetMenuItemInfo
\r
156 #define GetMenuItemInfo GetMenuItemInfoM
\r
157 BOOL GetMenuItemInfoM(HMENU hmenu, UINT item, BOOL fByPosition, LPMENUITEMINFOA lpmii);
\r
158 #undef CreateFontIndirect
\r
159 #define CreateFontIndirect CreateFontIndirectM
\r
160 HFONT CreateFontIndirectM(CONST LOGFONTA *lplf);
\r
162 #define ChooseFont ChooseFontM
\r
163 BOOL ChooseFontM(LPCHOOSEFONTA v0);
\r
164 #undef DialogBoxParam
\r
165 #define DialogBoxParam DialogBoxParamM
\r
166 INT_PTR DialogBoxParamM(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
\r
167 #undef CreateDialogParam
\r
168 #define CreateDialogParam CreateDialogParamM
\r
169 HWND CreateDialogParamM(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
\r
170 #undef sndPlaySound
\r
171 #define sndPlaySound sndPlaySoundM
\r
172 BOOL sndPlaySoundM(LPCSTR pszSound, UINT fuSound);
\r
173 #undef SetClipboardData
\r
174 #define SetClipboardData SetClipboardDataM
\r
175 HANDLE SetClipboardDataM(UINT uFormat, HANDLE hMem);
\r
177 #define CopyFile CopyFileM
\r
178 BOOL CopyFileM(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists);
\r
180 #define MoveFile MoveFileM
\r
181 BOOL MoveFileM(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
\r
183 #define DeleteFile DeleteFileM
\r
184 BOOL DeleteFileM(LPCSTR lpFileName);
\r
186 #define mkdir _mkdirM
\r
187 int mkdirM(const char * _Path);
\r
189 #define _mkdir _mkdirM
\r
190 int _mkdirM(const char * _Path);
\r
192 #define rmdir rmdirM
\r
193 int rmdirM(const char * _Path);
\r
195 #define _rmdir _rmdirM
\r
196 int _rmdirM(const char * _Path);
\r
198 #define remove removeM
\r
199 int removeM(const char * _Filename);
\r
201 #define _remove _removeM
\r
202 int _removeM(const char * _Filename);
\r
204 #define _unlink _unlinkM
\r
205 int _unlinkM(const char * _Filename);
\r
207 #define _mbslen _mbslenM
\r
208 size_t _mbslenM(const unsigned char * _Str);
\r
210 #define _mbschr _mbschrM
\r
211 unsigned char * _mbschrM(const unsigned char * _Str, unsigned int _Ch);
\r
213 #define _mbsrchr _mbsrchrM
\r
214 unsigned char * _mbsrchrM(const unsigned char * _Str, unsigned int _Ch);
\r
216 #define _mbsstr _mbsstrM
\r
217 unsigned char * _mbsstrM(const unsigned char * _Str, const unsigned char * _Substr);
\r
219 #define _mbscmp _mbscmpM
\r
220 int _mbscmpM(const unsigned char * _Str1, const unsigned char * _Str2);
\r
222 #define _mbsicmp _mbsicmpM
\r
223 int _mbsicmpM(const unsigned char * _Str1, const unsigned char * _Str2);
\r
225 #define _mbsncmp _mbsncmpM
\r
226 int _mbsncmpM(const unsigned char * _Str1, const unsigned char * _Str2, size_t _MaxCount);
\r
228 #define _mbslwr _mbslwrM
\r
229 unsigned char * _mbslwrM(unsigned char * _String);
\r
231 #define _mbsupr _mbsuprM
\r
232 unsigned char * _mbsuprM(unsigned char * _String);
\r
234 #define _mbsninc _mbsnincM
\r
235 unsigned char * _mbsnincM(const unsigned char * _Str, size_t _Count);
\r
237 #define fopen fopenM
\r
238 FILE * fopenM(const char * _Filename, const char * _Mode);
\r
240 #undef CreateWindow
\r
241 #define CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) CreateWindowEx(0L, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
\r
243 #define DialogBox(hInstance, lpTemplate, hWndParent, lpDialogFunc) DialogBoxParam(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
\r
247 #ifdef FORCE_SJIS_ON_ACTIVE_CODE_PAGE
\r
252 #ifdef EMULATE_UTF8_WCHAR_CONVERSION
\r
253 #define MultiByteToWideChar MultiByteToWideCharAlternative
\r
254 #define WideCharToMultiByte WideCharToMultiByteAlternative
\r
257 int MtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count);
\r
258 int WtoM(LPSTR pDst, int size, LPCWSTR pSrc, int count);
\r
259 int AtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count);
\r
260 int WtoA(LPSTR pDst, int size, LPCWSTR pSrc, int count);
\r
261 int TerminateStringM(LPSTR lpString, int size);
\r
262 int TerminateStringW(LPWSTR lpString, int size);
\r
263 int TerminateStringA(LPSTR lpString, int size);
\r
264 size_t GetMultiStringLengthM(LPCSTR lpString);
\r
265 size_t GetMultiStringLengthW(LPCWSTR lpString);
\r
266 size_t GetMultiStringLengthA(LPCSTR lpString);
\r
267 int MtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc);
\r
268 int WtoMMultiString(LPSTR pDst, int size, LPCWSTR pSrc);
\r
269 int AtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc);
\r
270 int WtoAMultiString(LPSTR pDst, int size, LPCWSTR pSrc);
\r
271 char* AllocateStringM(int size);
\r
272 wchar_t* AllocateStringW(int size);
\r
273 char* AllocateStringA(int size);
\r
274 wchar_t* DuplicateMtoW(LPCSTR lpString, int c);
\r
275 wchar_t* DuplicateMtoWBuffer(LPCSTR lpString, int c, int size);
\r
276 wchar_t* DuplicateMtoWMultiString(LPCSTR lpString);
\r
277 wchar_t* DuplicateMtoWMultiStringBuffer(LPCSTR lpString, int size);
\r
278 char* DuplicateWtoM(LPCWSTR lpString, int c);
\r
279 wchar_t* DuplicateAtoW(LPCSTR lpString, int c);
\r
280 char* DuplicateWtoA(LPCWSTR lpString, int c);
\r
281 DWORD GetNextCharM(LPCSTR lpString, LPCSTR pLimit, LPCSTR* ppNext);
\r
282 int PutNextCharM(LPSTR lpString, LPSTR pLimit, LPSTR* ppNext, DWORD Code);
\r
283 DWORD GetNextCharW(LPCWSTR lpString, LPCWSTR pLimit, LPCWSTR* ppNext);
\r
284 int PutNextCharW(LPWSTR lpString, LPWSTR pLimit, LPWSTR* ppNext, DWORD Code);
\r
285 int GetCodeCountM(LPCSTR lpString, int CharCount);
\r
286 int GetCodeCountW(LPCWSTR lpString, int CharCount);
\r
287 BOOL FixStringM(LPSTR pDst, LPCSTR pSrc);
\r
288 BOOL FixMultiStringM(LPSTR pDst, LPCSTR pSrc);
\r
289 BOOL CheckStringM(LPCSTR lpString);
\r
290 BOOL CheckMultiStringM(LPCSTR lpString);
\r
291 void FreeDuplicatedString(void* p);
\r
292 int MultiByteToWideCharAlternative(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
\r
293 int WideCharToMultiByteAlternative(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
\r
295 int WINAPI WinMainM(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
\r