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 GetLogicalDriveStrings
\r
33 #define GetLogicalDriveStrings GetLogicalDriveStringsM
\r
34 DWORD GetLogicalDriveStringsM(DWORD nBufferLength, LPSTR lpBuffer);
\r
35 #undef RegisterClassEx
\r
36 #define RegisterClassEx RegisterClassExM
\r
37 ATOM RegisterClassExM(CONST WNDCLASSEXA * v0);
\r
38 #undef CreateWindowEx
\r
39 #define CreateWindowEx CreateWindowExM
\r
40 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
41 #undef GetWindowLong
\r
42 #define GetWindowLong GetWindowLongM
\r
43 LONG GetWindowLongM(HWND hWnd, int nIndex);
\r
44 #undef SetWindowLong
\r
45 #define SetWindowLong SetWindowLongM
\r
46 LONG SetWindowLongM(HWND hWnd, int nIndex, LONG dwNewLong);
\r
47 #undef DefWindowProc
\r
48 #define DefWindowProc DefWindowProcM
\r
49 LRESULT DefWindowProcM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
50 #undef CallWindowProc
\r
51 #define CallWindowProc CallWindowProcM
\r
52 LRESULT CallWindowProcM(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
54 #define SendMessage SendMessageM
\r
55 LRESULT SendMessageM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
57 #define DefDlgProc DefDlgProcM
\r
58 LRESULT DefDlgProcM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
59 #undef SendDlgItemMessage
\r
60 #define SendDlgItemMessage SendDlgItemMessageM
\r
61 LRESULT SendDlgItemMessageM(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
\r
62 #undef SetWindowText
\r
63 #define SetWindowText SetWindowTextM
\r
64 BOOL SetWindowTextM(HWND hWnd, LPCSTR lpString);
\r
65 #undef DragQueryFile
\r
66 #define DragQueryFile DragQueryFileM
\r
67 UINT DragQueryFileM(HDROP hDrop, UINT iFile, LPSTR lpszFile, UINT cch);
\r
68 #undef GetCommandLine
\r
69 #define GetCommandLine GetCommandLineM
\r
70 LPSTR GetCommandLineM();
\r
71 #undef GetCurrentDirectory
\r
72 #define GetCurrentDirectory GetCurrentDirectoryM
\r
73 DWORD GetCurrentDirectoryM(DWORD nBufferLength, LPSTR lpBuffer);
\r
74 #undef SetCurrentDirectory
\r
75 #define SetCurrentDirectory SetCurrentDirectoryM
\r
76 BOOL SetCurrentDirectoryM(LPCSTR lpPathName);
\r
78 #define GetTempPath GetTempPathM
\r
79 DWORD GetTempPathM(DWORD nBufferLength, LPSTR lpBuffer);
\r
80 #undef GetFileAttributes
\r
81 #define GetFileAttributes GetFileAttributesM
\r
82 DWORD GetFileAttributesM(LPCSTR lpFileName);
\r
83 #undef GetModuleFileName
\r
84 #define GetModuleFileName GetModuleFileNameM
\r
85 DWORD GetModuleFileNameM(HMODULE hModule, LPCH lpFilename, DWORD nSize);
\r
87 #define RegOpenKeyEx RegOpenKeyExM
\r
88 LSTATUS RegOpenKeyExM(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
\r
89 #undef RegCreateKeyEx
\r
90 #define RegCreateKeyEx RegCreateKeyExM
\r
91 LSTATUS RegCreateKeyExM(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition);
\r
92 #undef RegDeleteValue
\r
93 #define RegDeleteValue RegDeleteValueM
\r
94 LSTATUS RegDeleteValueM(HKEY hKey, LPCSTR lpValueName);
\r
95 #undef RegQueryValueEx
\r
96 #define RegQueryValueEx RegQueryValueExM
\r
97 LSTATUS RegQueryValueExM(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
\r
98 #undef RegSetValueEx
\r
99 #define RegSetValueEx RegSetValueExM
\r
100 LSTATUS RegSetValueExM(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData);
\r
102 #define TextOut TextOutM
\r
103 BOOL TextOutM(HDC hdc, int x, int y, LPCSTR lpString, int c);
\r
104 #undef GetTextExtentPoint32
\r
105 #define GetTextExtentPoint32 GetTextExtentPoint32M
\r
106 BOOL GetTextExtentPoint32M(HDC hdc, LPCSTR lpString, int c, LPSIZE psizl);
\r
107 #undef PropertySheet
\r
108 #define PropertySheet PropertySheetM
\r
109 INT_PTR PropertySheetM(LPCPROPSHEETHEADERA v0);
\r
110 #undef GetOpenFileName
\r
111 #define GetOpenFileName GetOpenFileNameM
\r
112 BOOL GetOpenFileNameM(LPOPENFILENAMEA v0);
\r
113 #undef GetSaveFileName
\r
114 #define GetSaveFileName GetSaveFileNameM
\r
115 BOOL GetSaveFileNameM(LPOPENFILENAMEA v0);
\r
117 #define HtmlHelp HtmlHelpM
\r
118 HWND HtmlHelpM(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData);
\r
119 #undef CreateProcess
\r
120 #define CreateProcess CreateProcessM
\r
121 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
122 #undef FindExecutable
\r
123 #define FindExecutable FindExecutableM
\r
124 HINSTANCE FindExecutableM(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult);
\r
125 #undef ShellExecute
\r
126 #define ShellExecute ShellExecuteM
\r
127 HINSTANCE ShellExecuteM(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
\r
128 #undef ShellExecuteEx
\r
129 #define ShellExecuteEx ShellExecuteExM
\r
130 BOOL ShellExecuteExM(LPSHELLEXECUTEINFOA lpExecInfo);
\r
131 #undef SHBrowseForFolder
\r
132 #define SHBrowseForFolder SHBrowseForFolderM
\r
133 PIDLIST_ABSOLUTE SHBrowseForFolderM(LPBROWSEINFOA lpbi);
\r
134 #undef SHGetPathFromIDList
\r
135 #define SHGetPathFromIDList SHGetPathFromIDListM
\r
136 BOOL SHGetPathFromIDListM(PCIDLIST_ABSOLUTE pidl, LPSTR pszPath);
\r
137 #undef SHFileOperation
\r
138 #define SHFileOperation SHFileOperationM
\r
139 int SHFileOperationM(LPSHFILEOPSTRUCTA lpFileOp);
\r
141 #define AppendMenu AppendMenuM
\r
142 BOOL AppendMenuM(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem);
\r
143 #undef GetMenuItemInfo
\r
144 #define GetMenuItemInfo GetMenuItemInfoM
\r
145 BOOL GetMenuItemInfoM(HMENU hmenu, UINT item, BOOL fByPosition, LPMENUITEMINFOA lpmii);
\r
146 #undef CreateFontIndirect
\r
147 #define CreateFontIndirect CreateFontIndirectM
\r
148 HFONT CreateFontIndirectM(CONST LOGFONTA *lplf);
\r
150 #define ChooseFont ChooseFontM
\r
151 BOOL ChooseFontM(LPCHOOSEFONTA v0);
\r
152 #undef DialogBoxParam
\r
153 #define DialogBoxParam DialogBoxParamM
\r
154 INT_PTR DialogBoxParamM(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
\r
155 #undef CreateDialogParam
\r
156 #define CreateDialogParam CreateDialogParamM
\r
157 HWND CreateDialogParamM(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
\r
158 #undef sndPlaySound
\r
159 #define sndPlaySound sndPlaySoundM
\r
160 BOOL sndPlaySoundM(LPCSTR pszSound, UINT fuSound);
\r
161 #undef SetClipboardData
\r
162 #define SetClipboardData SetClipboardDataM
\r
163 HANDLE SetClipboardDataM(UINT uFormat, HANDLE hMem);
\r
165 #define CopyFile CopyFileM
\r
166 BOOL CopyFileM(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists);
\r
168 #define mkdir _mkdirM
\r
169 int mkdirM(const char * _Path);
\r
171 #define _mkdir _mkdirM
\r
172 int _mkdirM(const char * _Path);
\r
174 #define rmdir rmdirM
\r
175 int rmdirM(const char * _Path);
\r
177 #define _rmdir _rmdirM
\r
178 int _rmdirM(const char * _Path);
\r
180 #define _mbslen _mbslenM
\r
181 size_t _mbslenM(const unsigned char * _Str);
\r
183 #define _mbschr _mbschrM
\r
184 unsigned char * _mbschrM(const unsigned char * _Str, unsigned int _Ch);
\r
186 #define _mbsrchr _mbsrchrM
\r
187 unsigned char * _mbsrchrM(const unsigned char * _Str, unsigned int _Ch);
\r
189 #define _mbsstr _mbsstrM
\r
190 unsigned char * _mbsstrM(const unsigned char * _Str, const unsigned char * _Substr);
\r
192 #define _mbscmp _mbscmpM
\r
193 int _mbscmpM(const unsigned char * _Str1, const unsigned char * _Str2);
\r
195 #define _mbsicmp _mbsicmpM
\r
196 int _mbsicmpM(const unsigned char * _Str1, const unsigned char * _Str2);
\r
198 #define _mbsncmp _mbsncmpM
\r
199 int _mbsncmpM(const unsigned char * _Str1, const unsigned char * _Str2, size_t _MaxCount);
\r
201 #define _mbslwr _mbslwrM
\r
202 unsigned char * _mbslwrM(unsigned char * _String);
\r
204 #define _mbsupr _mbsuprM
\r
205 unsigned char * _mbsuprM(unsigned char * _String);
\r
207 #define _mbsninc _mbsnincM
\r
208 unsigned char * _mbsnincM(const unsigned char * _Str, size_t _Count);
\r
210 #define fopen fopenM
\r
211 FILE * fopenM(const char * _Filename, const char * _Mode);
\r
213 #undef CreateWindow
\r
214 #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
216 #define DialogBox(hInstance, lpTemplate, hWndParent, lpDialogFunc) DialogBoxParam(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
\r
220 int MtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count);
\r
221 int WtoM(LPSTR pDst, int size, LPCWSTR pSrc, int count);
\r
222 int AtoW(LPWSTR pDst, int size, LPCSTR pSrc, int count);
\r
223 int WtoA(LPSTR pDst, int size, LPCWSTR pSrc, int count);
\r
224 int TerminateStringM(LPSTR lpString, int size);
\r
225 int TerminateStringW(LPWSTR lpString, int size);
\r
226 int TerminateStringA(LPSTR lpString, int size);
\r
227 size_t GetMultiStringLengthM(LPCSTR lpString);
\r
228 size_t GetMultiStringLengthW(LPCWSTR lpString);
\r
229 size_t GetMultiStringLengthA(LPCSTR lpString);
\r
230 int MtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc);
\r
231 int WtoMMultiString(LPSTR pDst, int size, LPCWSTR pSrc);
\r
232 int AtoWMultiString(LPWSTR pDst, int size, LPCSTR pSrc);
\r
233 int WtoAMultiString(LPSTR pDst, int size, LPCWSTR pSrc);
\r
234 char* AllocateStringM(int size);
\r
235 wchar_t* AllocateStringW(int size);
\r
236 char* AllocateStringA(int size);
\r
237 wchar_t* DuplicateMtoW(LPCSTR lpString, int c);
\r
238 wchar_t* DuplicateMtoWBuffer(LPCSTR lpString, int c, int size);
\r
239 wchar_t* DuplicateMtoWMultiString(LPCSTR lpString);
\r
240 wchar_t* DuplicateMtoWMultiStringBuffer(LPCSTR lpString, int size);
\r
241 char* DuplicateWtoM(LPCWSTR lpString, int c);
\r
242 wchar_t* DuplicateAtoW(LPCSTR lpString, int c);
\r
243 char* DuplicateWtoA(LPCWSTR lpString, int c);
\r
244 DWORD GetNextCharM(LPCSTR lpString, LPCSTR* ppNext);
\r
245 BOOL FixStringM(LPSTR pDst, LPCSTR pSrc);
\r
246 BOOL FixMultiStringM(LPSTR pDst, LPCSTR pSrc);
\r
247 BOOL CheckStringM(LPCSTR lpString);
\r
248 BOOL CheckMultiStringM(LPCSTR lpString);
\r
249 void FreeDuplicatedString(void* p);
\r
251 int WINAPI WinMainM(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
\r