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.

612 lines
13 KiB

  1. #ifndef __ECM_UNICODE_H__
  2. #define __ECM_UNICODE_H__
  3. // necessary defns -- remove?
  4. #include <rpc.h>
  5. #include <rpcdce.h>
  6. #include <wincrypt.h>
  7. #include <shfusion.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. BOOL WINAPI FIsWinNT(void);
  12. BOOL WINAPI FIsWinNT5(VOID);
  13. BOOL WINAPI MkMBStrEx(PBYTE pbBuff, DWORD cbBuff, LPCWSTR wsz, int cchW, char ** pszMB, int *pcbConverted);
  14. BOOL WINAPI MkMBStr(PBYTE pbBuff, DWORD cbBuff, LPCWSTR wsz, char ** pszMB);
  15. void WINAPI FreeMBStr(PBYTE pbBuff, char * szMB);
  16. LPWSTR WINAPI MkWStr(char * szMB);
  17. void WINAPI FreeWStr(LPWSTR wsz);
  18. BOOL WINAPI wstr2guid(const WCHAR *pwszIn, GUID *pgOut);
  19. BOOL WINAPI guid2wstr(const GUID *pgIn, WCHAR *pwszOut);
  20. // The following is also needed for non-x86 due to a bug in advapi32 for
  21. // CryptAcquireContextW.
  22. BOOL WINAPI CryptAcquireContextU(
  23. HCRYPTPROV *phProv,
  24. LPCWSTR lpContainer,
  25. LPCWSTR lpProvider,
  26. DWORD dwProvType,
  27. DWORD dwFlags
  28. );
  29. BOOL WINAPI CryptEnumProvidersU(
  30. DWORD dwIndex,
  31. DWORD *pdwReserved,
  32. DWORD dwFlags,
  33. DWORD *pdwProvType,
  34. LPWSTR pwszProvName,
  35. DWORD *pcbProvName
  36. );
  37. // The following is also needed for non-x86 due to the fact that the
  38. // A/W versions of the ListView_ functions do not exist.
  39. // (these are implemented in ispu\common\unicode\commctrl.cpp)
  40. int WINAPI ListView_InsertItemU(
  41. HWND hwnd,
  42. const LPLVITEMW pitem
  43. );
  44. void WINAPI ListView_SetItemTextU(
  45. HWND hwnd,
  46. int i,
  47. int iSubItem,
  48. LPCWSTR pszText
  49. );
  50. int WINAPI ListView_InsertColumnU(
  51. HWND hwnd,
  52. int i,
  53. const LPLVCOLUMNW plvC);
  54. BOOL WINAPI ListView_GetItemU(
  55. HWND hwnd,
  56. LPLVITEMW pitem
  57. );
  58. LONG WINAPI RegOpenHKCUKeyExA(
  59. HKEY hKey, // handle of open key
  60. LPCSTR lpSubKey, // address of name of subkey to open
  61. DWORD ulOptions, // reserved
  62. REGSAM samDesired, // security access mask
  63. PHKEY phkResult // address of handle of open key
  64. );
  65. //
  66. // the following api's handle the problem with impersinating another user
  67. // and having the HKEY_CURRENT_USER opened to an incorrect user's SID.
  68. //
  69. LONG WINAPI RegCreateHKCUKeyExU (
  70. HKEY hKey,
  71. LPCWSTR lpSubKey,
  72. DWORD Reserved,
  73. LPWSTR lpClass,
  74. DWORD dwOptions,
  75. REGSAM samDesired,
  76. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  77. PHKEY phkResult,
  78. LPDWORD lpdwDisposition
  79. );
  80. LONG WINAPI RegCreateHKCUKeyExA (
  81. HKEY hKey,
  82. LPCSTR lpSubKey,
  83. DWORD Reserved,
  84. LPSTR lpClass,
  85. DWORD dwOptions,
  86. REGSAM samDesired,
  87. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  88. PHKEY phkResult,
  89. LPDWORD lpdwDisposition
  90. );
  91. LONG WINAPI RegOpenHKCUKeyExU(
  92. HKEY hKey,
  93. LPCWSTR lpSubKey,
  94. DWORD ulOptions,
  95. REGSAM samDesired,
  96. PHKEY phkResult
  97. );
  98. LONG
  99. WINAPI
  100. RegOpenHKCU(
  101. HKEY *phKeyCurrentUser
  102. );
  103. LONG
  104. WINAPI
  105. RegOpenHKCUEx(
  106. HKEY *phKeyCurrentUser,
  107. DWORD dwFlags
  108. );
  109. // Normally, HKEY_USERS\CurrentSid is opened as the HKCU. However, if
  110. // HKEY_USERS\CurrentSid doesn't exist, then, HKEY_USERS\.Default is
  111. // opened. Set the following flag to only open
  112. // HKEY_USERS\.Default if the current user is the LocalSystem SID.
  113. #define REG_HKCU_LOCAL_SYSTEM_ONLY_DEFAULT_FLAG 0x1
  114. LONG
  115. WINAPI
  116. RegCloseHKCU(
  117. HKEY hKeyCurrentUser
  118. );
  119. BOOL
  120. WINAPI
  121. GetUserTextualSidHKCU(
  122. IN LPWSTR wszTextualSid,
  123. IN OUT LPDWORD pcchTextualSid
  124. );
  125. #ifdef _M_IX86
  126. // Reg.cpp
  127. LONG WINAPI RegCreateKeyExU (
  128. HKEY hKey,
  129. LPCWSTR lpSubKey,
  130. DWORD Reserved,
  131. LPWSTR lpClass,
  132. DWORD dwOptions,
  133. REGSAM samDesired,
  134. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  135. PHKEY phkResult,
  136. LPDWORD lpdwDisposition
  137. );
  138. LONG WINAPI RegDeleteKeyU(
  139. HKEY hKey,
  140. LPCWSTR lpSubKey
  141. );
  142. LONG WINAPI RegEnumKeyExU (
  143. HKEY hKey,
  144. DWORD dwIndex,
  145. LPWSTR lpName,
  146. LPDWORD lpcbName,
  147. LPDWORD lpReserved,
  148. LPWSTR lpClass,
  149. LPDWORD lpcbClass,
  150. PFILETIME lpftLastWriteTime
  151. );
  152. LONG WINAPI RegEnumValueU (
  153. HKEY hKey,
  154. DWORD dwIndex,
  155. LPWSTR lpValueName,
  156. LPDWORD lpcbValueName,
  157. LPDWORD lpReserved,
  158. LPDWORD lpType,
  159. LPBYTE lpData,
  160. LPDWORD lpcbData
  161. );
  162. LONG RegQueryValueExU(
  163. HKEY hKey,
  164. LPCWSTR lpValueName,
  165. LPDWORD lpReserved,
  166. LPDWORD lpType,
  167. LPBYTE lpData,
  168. LPDWORD lpcbData
  169. );
  170. LONG WINAPI RegSetValueExU (
  171. HKEY hKey,
  172. LPCWSTR lpValueName,
  173. DWORD Reserved,
  174. DWORD dwType,
  175. CONST BYTE* lpData,
  176. DWORD cbData
  177. );
  178. LONG WINAPI RegDeleteValueU (
  179. HKEY hKey,
  180. LPCWSTR lpValueName
  181. );
  182. LONG WINAPI RegQueryInfoKeyU (
  183. HKEY hKey,
  184. LPWSTR lpClass,
  185. LPDWORD lpcbClass,
  186. LPDWORD lpReserved,
  187. LPDWORD lpcSubKeys,
  188. LPDWORD lpcbMaxSubKeyLen,
  189. LPDWORD lpcbMaxClassLen,
  190. LPDWORD lpcValues,
  191. LPDWORD lpcbMaxValueNameLen,
  192. LPDWORD lpcbMaxValueLen,
  193. LPDWORD lpcbSecurityDescriptor,
  194. PFILETIME lpftLastWriteTime
  195. );
  196. LONG WINAPI RegOpenKeyExU(
  197. HKEY hKey,
  198. LPCWSTR lpSubKey,
  199. DWORD ulOptions,
  200. REGSAM samDesired,
  201. PHKEY phkResult
  202. );
  203. LONG WINAPI RegConnectRegistryU (
  204. LPWSTR lpMachineName,
  205. HKEY hKey,
  206. PHKEY phkResult
  207. );
  208. // File.cpp
  209. HANDLE WINAPI CreateFileU (
  210. LPCWSTR lpFileName,
  211. DWORD dwDesiredAccess,
  212. DWORD dwShareMode,
  213. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  214. DWORD dwCreationDisposition,
  215. DWORD dwFlagsAndAttributes,
  216. HANDLE hTemplateFile
  217. );
  218. BOOL
  219. WINAPI
  220. DeleteFileU(
  221. LPCWSTR lpFileName
  222. );
  223. BOOL
  224. WINAPI
  225. CopyFileU(
  226. LPCWSTR lpwExistingFileName,
  227. LPCWSTR lpwNewFileName,
  228. BOOL bFailIfExists
  229. );
  230. BOOL
  231. WINAPI
  232. MoveFileExU(
  233. LPCWSTR lpExistingFileName,
  234. LPCWSTR lpNewFileName,
  235. DWORD dwFlags);
  236. DWORD
  237. WINAPI
  238. GetFileAttributesU(
  239. LPCWSTR lpFileName
  240. );
  241. BOOL
  242. WINAPI
  243. SetFileAttributesU(
  244. LPCWSTR lpFileName,
  245. DWORD dwFileAttributes
  246. );
  247. DWORD
  248. WINAPI
  249. GetCurrentDirectoryU(
  250. DWORD nBufferLength,
  251. LPWSTR lpBuffer);
  252. BOOL
  253. WINAPI
  254. CreateDirectoryU(
  255. LPCWSTR lpPathName,
  256. LPSECURITY_ATTRIBUTES lpSecurityAttributes
  257. );
  258. UINT
  259. WINAPI
  260. GetWindowsDirectoryU(
  261. LPWSTR lpBuffer,
  262. UINT uSize
  263. );
  264. HINSTANCE WINAPI LoadLibraryU(
  265. LPCWSTR lpLibFileName
  266. );
  267. HINSTANCE WINAPI LoadLibraryExU(
  268. LPCWSTR lpLibFileName,
  269. HANDLE hFile,
  270. DWORD dwFlags
  271. );
  272. DWORD
  273. WINAPI
  274. ExpandEnvironmentStringsU(
  275. LPCWSTR lpSrc,
  276. LPWSTR lpDst,
  277. DWORD nSize
  278. );
  279. // capi.cpp
  280. BOOL WINAPI CryptSignHashU(
  281. HCRYPTHASH hHash,
  282. DWORD dwKeySpec,
  283. LPCWSTR lpDescription,
  284. DWORD dwFlags,
  285. BYTE *pbSignature,
  286. DWORD *pdwSigLen
  287. );
  288. BOOL WINAPI CryptVerifySignatureU(
  289. HCRYPTHASH hHash,
  290. CONST BYTE *pbSignature,
  291. DWORD dwSigLen,
  292. HCRYPTKEY hPubKey,
  293. LPCWSTR lpDescription,
  294. DWORD dwFlags
  295. );
  296. BOOL WINAPI CryptSetProviderU(
  297. LPCWSTR lpProvName,
  298. DWORD dwProvType
  299. );
  300. // Ole.cpp
  301. RPC_STATUS RPC_ENTRY UuidToStringU(
  302. UUID * Uuid,
  303. WCHAR * * StringUuid
  304. );
  305. // nt.cpp
  306. BOOL WINAPI GetUserNameU(
  307. LPWSTR lpBuffer,
  308. LPDWORD nSize
  309. );
  310. BOOL WINAPI GetComputerNameU(
  311. LPWSTR lpBuffer,
  312. LPDWORD nSize
  313. );
  314. DWORD WINAPI GetModuleFileNameU(
  315. HMODULE hModule,
  316. LPWSTR lpFilename,
  317. DWORD nSize
  318. );
  319. HMODULE WINAPI GetModuleHandleU(
  320. LPCWSTR lpModuleName // address of module name to return handle for
  321. );
  322. // user.cpp
  323. int WINAPI LoadStringU(
  324. HINSTANCE hInstance,
  325. UINT uID,
  326. LPWSTR lpBuffer,
  327. int nBufferMax
  328. );
  329. DWORD WINAPI FormatMessageU(
  330. DWORD dwFlags,
  331. LPCVOID lpSource,
  332. DWORD dwMessageId,
  333. DWORD dwLanguageId,
  334. LPWSTR lpBuffer,
  335. DWORD nSize,
  336. va_list *Arguments
  337. );
  338. BOOL WINAPI SetWindowTextU(
  339. HWND hWnd,
  340. LPCWSTR lpString
  341. );
  342. int WINAPI DialogBoxParamU(
  343. HINSTANCE hInstance,
  344. LPCWSTR lpTemplateName,
  345. HWND hWndParent,
  346. DLGPROC lpDialogFunc,
  347. LPARAM dwInitParam
  348. );
  349. UINT WINAPI GetDlgItemTextU(
  350. HWND hDlg,
  351. int nIDDlgItem,
  352. LPWSTR lpString,
  353. int nMaxCount
  354. );
  355. BOOL WINAPI SetDlgItemTextU(
  356. HWND hDlg,
  357. int nIDDlgItem,
  358. LPCWSTR lpString
  359. );
  360. int WINAPI MessageBoxU(
  361. HWND hWnd ,
  362. LPCWSTR lpText,
  363. LPCWSTR lpCaption,
  364. UINT uType
  365. );
  366. int WINAPI LCMapStringU(
  367. LCID Locale,
  368. DWORD dwMapFlags,
  369. LPCWSTR lpSrcStr,
  370. int cchSrc,
  371. LPWSTR lpDestStr,
  372. int cchDest
  373. );
  374. int WINAPI GetDateFormatU(
  375. LCID Locale,
  376. DWORD dwFlags,
  377. CONST SYSTEMTIME *lpDate,
  378. LPCWSTR lpFormat,
  379. LPWSTR lpDateStr,
  380. int cchDate
  381. );
  382. int WINAPI GetTimeFormatU(
  383. LCID Locale,
  384. DWORD dwFlags,
  385. CONST SYSTEMTIME *lpTime,
  386. LPCWSTR lpFormat,
  387. LPWSTR lpTimeStr,
  388. int cchTime
  389. );
  390. BOOL WINAPI WinHelpU(
  391. HWND hWndMain,
  392. LPCWSTR lpszHelp,
  393. UINT uCommand,
  394. DWORD dwData
  395. );
  396. LRESULT WINAPI SendMessageU(
  397. HWND hWnd,
  398. UINT Msg,
  399. WPARAM wParam,
  400. LPARAM lParam
  401. );
  402. LONG WINAPI
  403. SendDlgItemMessageU(
  404. HWND hDlg,
  405. int nIDDlgItem,
  406. UINT Msg,
  407. WPARAM wParam,
  408. LPARAM lParam
  409. );
  410. LPWSTR
  411. WINAPI
  412. GetCommandLineU(void);
  413. BOOL
  414. WINAPI
  415. IsBadStringPtrU(IN LPWSTR lpsz, UINT ucchMax);
  416. void
  417. WINAPI
  418. OutputDebugStringU(IN LPWSTR lpwsz);
  419. int
  420. WINAPI
  421. DrawTextU(
  422. HDC hDC,
  423. LPCWSTR lpString,
  424. int nCount,
  425. LPRECT lpRect,
  426. UINT uFormat
  427. );
  428. // event.cpp
  429. HANDLE
  430. WINAPI
  431. CreateEventU(
  432. LPSECURITY_ATTRIBUTES lpEventAttributes,
  433. BOOL bManualReset,
  434. BOOL bInitialState,
  435. LPCWSTR lpName);
  436. HANDLE
  437. WINAPI
  438. RegisterEventSourceU(
  439. LPCWSTR lpUNCServerName,
  440. LPCWSTR lpSourceName);
  441. HANDLE
  442. WINAPI
  443. OpenEventU(
  444. DWORD dwDesiredAccess,
  445. BOOL bInheritHandle,
  446. LPCWSTR lpName);
  447. HANDLE
  448. WINAPI
  449. CreateMutexU(
  450. LPSECURITY_ATTRIBUTES lpMutexAttributes,
  451. BOOL bInitialOwner,
  452. LPCWSTR lpName);
  453. HANDLE
  454. WINAPI
  455. OpenMutexU(
  456. DWORD dwDesiredAccess,
  457. BOOL bInheritHandle,
  458. LPCWSTR lpName);
  459. HFONT
  460. WINAPI
  461. CreateFontIndirectU(CONST LOGFONTW *lplf);
  462. #else
  463. #define RegQueryValueExU RegQueryValueExW
  464. #define RegCreateKeyExU RegCreateKeyExW
  465. #define RegDeleteKeyU RegDeleteKeyW
  466. #define RegEnumKeyExU RegEnumKeyExW
  467. #define RegEnumValueU RegEnumValueW
  468. #define RegSetValueExU RegSetValueExW
  469. #define RegQueryInfoKeyU RegQueryInfoKeyW
  470. #define RegDeleteValueU RegDeleteValueW
  471. #define RegOpenKeyExU RegOpenKeyExW
  472. #define RegConnectRegistryU RegConnectRegistryW
  473. #define ExpandEnvironmentStringsU ExpandEnvironmentStringsW
  474. #define CreateFileU CreateFileW
  475. #define DeleteFileU DeleteFileW
  476. #define CopyFileU CopyFileW
  477. #define GetFileAttributesU GetFileAttributesW
  478. #define SetFileAttributesU SetFileAttributesW
  479. #define GetCurrentDirectoryU GetCurrentDirectoryW
  480. #define CreateDirectoryU CreateDirectoryW
  481. #define GetWindowsDirectoryU GetWindowsDirectoryW
  482. #define LoadLibraryU LoadLibraryW
  483. #define LoadLibraryExU LoadLibraryExW
  484. #define CryptSignHashU CryptSignHashW
  485. #define CryptVerifySignatureU CryptVerifySignatureW
  486. #define CryptSetProviderU CryptSetProviderW
  487. #define UuidToStringU UuidToStringW
  488. #define GetUserNameU GetUserNameW
  489. #define GetComputerNameU GetComputerNameW
  490. #define GetModuleFileNameU GetModuleFileNameW
  491. #define GetModuleHandleU GetModuleHandleW
  492. #define LoadStringU LoadStringW
  493. #define FormatMessageU FormatMessageW
  494. #define SetWindowTextU SetWindowTextW
  495. #define DialogBoxParamU DialogBoxParamW
  496. #define GetDlgItemTextU GetDlgItemTextW
  497. #define SetDlgItemTextU SetDlgItemTextW
  498. #define MessageBoxU MessageBoxW
  499. #define LCMapStringU LCMapStringW
  500. #define GetDateFormatU GetDateFormatW
  501. #define GetTimeFormatU GetTimeFormatW
  502. #define WinHelpU WinHelpW
  503. #define SendMessageU SendMessageW
  504. #define SendDlgItemMessageU SendDlgItemMessageW
  505. #define IsBadStringPtrU IsBadStringPtrW
  506. #define OutputDebugStringU OutputDebugStringW
  507. #define GetCommandLineU GetCommandLineW
  508. #define DrawTextU DrawTextW
  509. #define CreateEventU CreateEventW
  510. #define RegisterEventSourceU RegisterEventSourceW
  511. #define OpenEventU OpenEventW
  512. #define CreateMutexU CreateMutexW
  513. #define OpenMutexU OpenMutexW
  514. #define CreateFontIndirectU CreateFontIndirectW
  515. #endif // _M_IX86
  516. #ifdef __cplusplus
  517. } // Balance extern "C" above
  518. #endif
  519. #endif