Leaked source code of windows server 2003
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.

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