Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
13 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: cmutoa.h
  4. //
  5. // Module: CMUTOA.DLL
  6. //
  7. // Synopsis: This header file includes the type definitions and function headers
  8. // needed to use the CM Unicode to Ansi conversion dll. This dll contains
  9. // UA APIs that allow a Unicode App to work on Win9x. The idea for this
  10. // dll was borrowed from F. Avery Bishop's April 1999 MSJ article
  11. // "Design a Single Unicode App that Runs on Both Windows 98 and Windows 2000"
  12. //
  13. // Copyright (c) 1999 Microsoft Corporation
  14. //
  15. // Author: quintinb Created 4-25-99
  16. //
  17. //+----------------------------------------------------------------------------
  18. #ifndef _CMUTOA
  19. #define _CMUTOA
  20. typedef WINUSERAPI LRESULT (WINAPI *UAPI_CallWindowProc)(WNDPROC, HWND, UINT, WPARAM, LPARAM);
  21. typedef WINUSERAPI LPWSTR (WINAPI *UAPI_CharLower)(LPWSTR);
  22. typedef WINUSERAPI LPWSTR (WINAPI *UAPI_CharNext)(LPCWSTR);
  23. typedef WINUSERAPI LPWSTR (WINAPI *UAPI_CharPrev)(LPCWSTR, LPCWSTR);
  24. typedef WINUSERAPI LPWSTR (WINAPI *UAPI_CharUpper)(LPWSTR);
  25. typedef WINUSERAPI HWND (WINAPI *UAPI_CreateDialogParam)(IN HINSTANCE, IN LPCWSTR, IN HWND, IN DLGPROC, IN LPARAM);
  26. typedef WINBASEAPI BOOL (WINAPI *UAPI_CreateDirectory)(LPCWSTR, LPSECURITY_ATTRIBUTES);
  27. typedef WINBASEAPI HANDLE (WINAPI *UAPI_CreateEvent)(LPSECURITY_ATTRIBUTES, BOOL, BOOL, LPCWSTR);
  28. typedef WINBASEAPI HANDLE (WINAPI *UAPI_CreateFileMapping)(HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCWSTR);
  29. typedef WINBASEAPI HANDLE (WINAPI *UAPI_CreateFile)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
  30. typedef WINBASEAPI HANDLE (WINAPI *UAPI_CreateMutex)(LPSECURITY_ATTRIBUTES, BOOL, LPCWSTR);
  31. typedef WINBASEAPI BOOL (WINAPI *UAPI_CreateProcess)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION);
  32. typedef WINUSERAPI HWND (WINAPI *UAPI_CreateWindowEx)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
  33. typedef WINUSERAPI LRESULT (WINAPI *UAPI_DefWindowProc)(HWND, UINT, WPARAM, LPARAM);
  34. typedef WINBASEAPI BOOL (WINAPI *UAPI_DeleteFile)(LPCWSTR);
  35. typedef WINUSERAPI INT_PTR (WINAPI *UAPI_DialogBoxParam)(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
  36. typedef WINUSERAPI LRESULT (WINAPI *UAPI_DispatchMessage)(CONST MSG*);
  37. typedef WINBASEAPI DWORD (WINAPI *UAPI_ExpandEnvironmentStrings)(LPCWSTR, LPWSTR, DWORD);
  38. typedef WINBASEAPI HRSRC (WINAPI *UAPI_FindResourceEx)(HMODULE, LPCWSTR, LPCWSTR, WORD);
  39. typedef WINUSERAPI HWND (WINAPI *UAPI_FindWindowEx)(HWND, HWND, LPCWSTR, LPCWSTR);
  40. typedef WINUSERAPI DWORD (WINAPI *UAPI_GetClassLong)(HWND, int);
  41. typedef WINBASEAPI int (WINAPI *UAPI_GetDateFormat)(LCID, DWORD, CONST SYSTEMTIME *, LPCWSTR, LPWSTR, int);
  42. typedef WINUSERAPI UINT (WINAPI *UAPI_GetDlgItemText)(HWND, int, LPWSTR, int);
  43. typedef WINBASEAPI DWORD (WINAPI *UAPI_GetFileAttributes)(LPCWSTR);
  44. typedef WINUSERAPI BOOL (WINAPI *UAPI_GetMessage)(LPMSG, HWND, UINT, UINT);
  45. typedef WINBASEAPI DWORD (WINAPI *UAPI_GetModuleFileName)(HMODULE, LPWSTR, DWORD);
  46. typedef WINBASEAPI HMODULE (WINAPI *UAPI_GetModuleHandle)(LPCWSTR);
  47. typedef WINBASEAPI UINT (WINAPI *UAPI_GetPrivateProfileInt)(LPCWSTR, LPCWSTR, INT, LPCWSTR);
  48. typedef WINBASEAPI DWORD (WINAPI *UAPI_GetPrivateProfileString)(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, DWORD, LPCWSTR);
  49. typedef WINBASEAPI BOOL (WINAPI *UAPI_GetStringTypeEx)(LCID, DWORD, LPCWSTR, int, LPWORD);
  50. typedef WINBASEAPI UINT (WINAPI *UAPI_GetSystemDirectory)(LPWSTR, UINT);
  51. typedef WINBASEAPI UINT (WINAPI *UAPI_GetTempFileName)(LPCWSTR, LPCWSTR, UINT, LPWSTR);
  52. typedef WINBASEAPI DWORD (WINAPI *UAPI_GetTempPath)(DWORD, LPWSTR);
  53. typedef WINBASEAPI int (WINAPI *UAPI_GetTimeFormat)(LCID, DWORD, CONST SYSTEMTIME *, LPCWSTR, LPWSTR, int);
  54. typedef WINADVAPI BOOL (WINAPI *UAPI_GetUserName)(LPWSTR, LPDWORD);
  55. typedef WINBASEAPI BOOL (WINAPI *UAPI_GetVersionEx)(LPOSVERSIONINFOW);
  56. #ifdef _WIN64
  57. typedef WINUSERAPI LONG_PTR (WINAPI *UAPI_GetWindowLong)(HWND, int);
  58. #else
  59. typedef WINUSERAPI LONG (WINAPI *UAPI_GetWindowLong)(HWND, int);
  60. #endif
  61. typedef WINUSERAPI int (WINAPI *UAPI_GetWindowTextLength)(HWND);
  62. typedef WINUSERAPI int (WINAPI *UAPI_GetWindowText)(HWND, LPWSTR, int);
  63. typedef WINUSERAPI BOOL (WINAPI *UAPI_InsertMenu)(HMENU, UINT, UINT, UINT_PTR, LPCWSTR);
  64. typedef WINUSERAPI BOOL (WINAPI *UAPI_IsDialogMessage)(HWND, LPMSG);
  65. typedef WINUSERAPI HCURSOR (WINAPI *UAPI_LoadCursor)(HINSTANCE, LPCWSTR);
  66. typedef WINUSERAPI HICON (WINAPI *UAPI_LoadIcon)(HINSTANCE, LPCWSTR);
  67. typedef WINUSERAPI HANDLE (WINAPI *UAPI_LoadImage)(IN HINSTANCE, IN LPCWSTR, IN UINT, IN int, IN int, IN UINT);
  68. typedef WINBASEAPI HMODULE (WINAPI *UAPI_LoadLibraryEx)(LPCWSTR, HANDLE, DWORD);
  69. typedef WINUSERAPI HMENU (WINAPI *UAPI_LoadMenu)(IN HINSTANCE, IN LPCWSTR);
  70. typedef WINUSERAPI INT (WINAPI *UAPI_LoadString)(HINSTANCE, UINT, LPWSTR, INT);
  71. typedef WINBASEAPI LPWSTR (WINAPI *UAPI_lstrcat)(LPWSTR, LPCWSTR);
  72. typedef WINBASEAPI int (WINAPI *UAPI_lstrcmpi)(LPCWSTR, LPCWSTR);
  73. typedef WINBASEAPI int (WINAPI *UAPI_lstrcmp)(LPCWSTR, LPCWSTR);
  74. typedef WINBASEAPI LPWSTR (WINAPI *UAPI_lstrcpyn)(LPWSTR, LPCWSTR, int);
  75. typedef WINBASEAPI LPWSTR (WINAPI *UAPI_lstrcpy)(LPWSTR, LPCWSTR);
  76. typedef WINBASEAPI int (WINAPI *UAPI_lstrlen)(LPCWSTR);
  77. typedef WINBASEAPI HANDLE (WINAPI *UAPI_OpenEvent)(DWORD, BOOL, LPCWSTR);
  78. typedef WINBASEAPI HANDLE (WINAPI *UAPI_OpenFileMapping)(DWORD, BOOL, LPCWSTR);
  79. typedef WINUSERAPI BOOL (WINAPI *UAPI_PeekMessage)(LPMSG, HWND, UINT, UINT, UINT);
  80. typedef WINUSERAPI BOOL (WINAPI *UAPI_PostMessage)(HWND, UINT, WPARAM, LPARAM);
  81. typedef WINUSERAPI BOOL (WINAPI *UAPI_PostThreadMessage)(IN DWORD, IN UINT, IN WPARAM, IN LPARAM);
  82. typedef WINADVAPI LONG (APIENTRY *UAPI_RegCreateKeyEx)(HKEY, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
  83. typedef WINADVAPI LONG (APIENTRY *UAPI_RegDeleteKey)(HKEY, LPCWSTR);
  84. typedef WINADVAPI LONG (APIENTRY *UAPI_RegDeleteValue)(HKEY, LPCWSTR);
  85. typedef WINADVAPI LONG (APIENTRY *UAPI_RegEnumKeyEx)(IN HKEY hKey, IN DWORD dwIndex, OUT LPWSTR lpName, IN OUT LPDWORD lpcbName, IN LPDWORD lpReserved, IN OUT LPWSTR lpClass, IN OUT LPDWORD lpcbClass, OUT PFILETIME lpftLastWriteTime);
  86. typedef WINUSERAPI ATOM (WINAPI *UAPI_RegisterClassEx)(CONST WNDCLASSEXW *);
  87. typedef WINUSERAPI UINT (WINAPI *UAPI_RegisterWindowMessage)(LPCWSTR);
  88. typedef WINADVAPI LONG (APIENTRY *UAPI_RegOpenKeyEx)(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
  89. typedef WINADVAPI LONG (APIENTRY *UAPI_RegQueryValueEx)(HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
  90. typedef WINADVAPI LONG (APIENTRY *UAPI_RegSetValueEx)(HKEY, LPCWSTR, DWORD, DWORD, CONST BYTE*, DWORD);
  91. typedef WINBASEAPI DWORD (WINAPI *UAPI_SearchPath)(IN LPCWSTR, IN LPCWSTR, IN LPCWSTR, IN DWORD, OUT LPWSTR, OUT LPWSTR *);
  92. typedef WINUSERAPI LONG_PTR (WINAPI *UAPI_SendDlgItemMessage)(HWND, INT, UINT, WPARAM, LPARAM);
  93. typedef WINUSERAPI LRESULT (WINAPI *UAPI_SendMessage)(HWND, UINT, WPARAM, LPARAM );
  94. typedef WINBASEAPI BOOL (WINAPI* UAPI_SetCurrentDirectory)(IN LPCWSTR);
  95. typedef WINUSERAPI BOOL (WINAPI *UAPI_SetDlgItemText)(HWND, int, LPCWSTR);
  96. #ifdef _WIN64
  97. typedef WINUSERAPI LONG_PTR (WINAPI *UAPI_SetWindowLong)(HWND, int, LONG_PTR);
  98. #else
  99. typedef WINUSERAPI LONG (WINAPI *UAPI_SetWindowLong)(HWND, int, LONG);
  100. #endif
  101. typedef WINUSERAPI BOOL (WINAPI *UAPI_SetWindowText)(HWND, LPCWSTR);
  102. typedef WINUSERAPI BOOL (WINAPI *UAPI_UnregisterClass)(LPCWSTR, HINSTANCE);
  103. typedef WINUSERAPI BOOL (WINAPI *UAPI_WinHelp)(HWND, LPCWSTR, UINT, ULONG_PTR);
  104. typedef WINBASEAPI BOOL (WINAPI *UAPI_WritePrivateProfileString)(LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR);
  105. typedef WINUSERAPI int (WINAPIV *UAPI_wsprintf)(LPWSTR, LPCWSTR, ...);
  106. typedef WINUSERAPI int (WINAPI *UAPI_wvsprintf)(LPWSTR, LPCWSTR, va_list arglist);
  107. //
  108. // If a module needs SHGetPathFromIDList it will have to include shlobj.h, which it will need to
  109. // have the definition of an LPCITEMIDLIST anyway. This prevents modules that don't need
  110. // the shell header, from having to include it just to use cmutoa.dll.
  111. //
  112. #ifdef _SHLOBJ_H_
  113. typedef WINSHELLAPI BOOL (WINAPI *UAPI_SHGetPathFromIDList)(LPCITEMIDLIST, LPWSTR);
  114. #endif
  115. typedef union _tagUAPIInit {
  116. struct
  117. {
  118. UAPI_CallWindowProc *pCallWindowProcU;
  119. UAPI_CharLower *pCharLowerU;
  120. UAPI_CharNext *pCharNextU;
  121. UAPI_CharPrev *pCharPrevU;
  122. UAPI_CharUpper *pCharUpperU;
  123. UAPI_CreateDialogParam *pCreateDialogParamU;
  124. UAPI_CreateDirectory *pCreateDirectoryU;
  125. UAPI_CreateEvent *pCreateEventU;
  126. UAPI_CreateFile *pCreateFileU;
  127. UAPI_CreateFileMapping *pCreateFileMappingU;
  128. UAPI_CreateMutex *pCreateMutexU;
  129. UAPI_CreateProcess *pCreateProcessU;
  130. UAPI_CreateWindowEx *pCreateWindowExU;
  131. UAPI_DefWindowProc *pDefWindowProcU;
  132. UAPI_DeleteFile *pDeleteFileU;
  133. UAPI_DialogBoxParam *pDialogBoxParamU;
  134. UAPI_DispatchMessage *pDispatchMessageU;
  135. UAPI_ExpandEnvironmentStrings *pExpandEnvironmentStringsU;
  136. UAPI_FindResourceEx *pFindResourceExU;
  137. UAPI_FindWindowEx *pFindWindowExU;
  138. UAPI_GetClassLong *pGetClassLongU;
  139. UAPI_GetDateFormat *pGetDateFormatU;
  140. UAPI_GetDlgItemText *pGetDlgItemTextU;
  141. UAPI_GetFileAttributes *pGetFileAttributesU;
  142. UAPI_GetMessage *pGetMessageU;
  143. UAPI_GetModuleFileName *pGetModuleFileNameU;
  144. UAPI_GetModuleHandle *pGetModuleHandleU;
  145. UAPI_GetPrivateProfileInt *pGetPrivateProfileIntU;
  146. UAPI_GetPrivateProfileString *pGetPrivateProfileStringU;
  147. UAPI_GetStringTypeEx *pGetStringTypeExU;
  148. UAPI_GetSystemDirectory *pGetSystemDirectoryU;
  149. UAPI_GetTempFileName *pGetTempFileNameU;
  150. UAPI_GetTempPath *pGetTempPathU;
  151. UAPI_GetTimeFormat *pGetTimeFormatU;
  152. UAPI_GetUserName *pGetUserNameU;
  153. UAPI_GetVersionEx *pGetVersionExU;
  154. UAPI_GetWindowLong *pGetWindowLongU;
  155. UAPI_GetWindowText *pGetWindowTextU;
  156. UAPI_GetWindowTextLength *pGetWindowTextLengthU;
  157. UAPI_InsertMenu *pInsertMenuU;
  158. UAPI_IsDialogMessage *pIsDialogMessageU;
  159. UAPI_LoadCursor *pLoadCursorU;
  160. UAPI_LoadIcon *pLoadIconU;
  161. UAPI_LoadImage *pLoadImageU;
  162. UAPI_LoadLibraryEx *pLoadLibraryExU;
  163. UAPI_LoadMenu *pLoadMenuU;
  164. UAPI_LoadString *pLoadStringU;
  165. UAPI_lstrcat *plstrcatU;
  166. UAPI_lstrcmp *plstrcmpU;
  167. UAPI_lstrcmpi *plstrcmpiU;
  168. UAPI_lstrcpy *plstrcpyU;
  169. UAPI_lstrcpyn *plstrcpynU;
  170. UAPI_lstrlen *plstrlenU;
  171. UAPI_OpenEvent *pOpenEventU;
  172. UAPI_OpenFileMapping *pOpenFileMappingU;
  173. UAPI_PeekMessage *pPeekMessageU;
  174. UAPI_PostMessage *pPostMessageU;
  175. UAPI_PostThreadMessage *pPostThreadMessageU;
  176. UAPI_RegCreateKeyEx *pRegCreateKeyExU;
  177. UAPI_RegDeleteKey *pRegDeleteKeyU;
  178. UAPI_RegDeleteValue *pRegDeleteValueU;
  179. UAPI_RegEnumKeyEx *pRegEnumKeyExU;
  180. UAPI_RegisterClassEx *pRegisterClassExU;
  181. UAPI_RegisterWindowMessage *pRegisterWindowMessageU;
  182. UAPI_RegOpenKeyEx *pRegOpenKeyExU;
  183. UAPI_RegQueryValueEx *pRegQueryValueExU;
  184. UAPI_RegSetValueEx *pRegSetValueExU;
  185. UAPI_SearchPath *pSearchPathU;
  186. UAPI_SendDlgItemMessage *pSendDlgItemMessageU;
  187. UAPI_SendMessage *pSendMessageU;
  188. UAPI_SetCurrentDirectory *pSetCurrentDirectoryU;
  189. UAPI_SetDlgItemText *pSetDlgItemTextU;
  190. UAPI_SetWindowLong *pSetWindowLongU;
  191. UAPI_SetWindowText *pSetWindowTextU;
  192. UAPI_UnregisterClass *pUnregisterClassU;
  193. UAPI_WinHelp *pWinHelpU;
  194. UAPI_WritePrivateProfileString *pWritePrivateProfileStringU;
  195. UAPI_wsprintf *pwsprintfU;
  196. UAPI_wvsprintf *pwvsprintfU;
  197. };
  198. LPVOID *ppvUapiFun[79];
  199. }UAPIINIT, *PUAPIINIT;
  200. BOOL InitCmUToA(PUAPIINIT);
  201. BOOL InitCmRasUtoA();
  202. void FreeCmRasUtoA();
  203. #endif // _CMUTOA