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

#ifndef __ECM_UNICODE_H__
#define __ECM_UNICODE_H__
// necessary defns -- remove?
#include <rpc.h>
#include <rpcdce.h>
#include <wincrypt.h>
#include <shfusion.h>
#ifdef __cplusplus
extern "C" {
#endif
BOOL WINAPI FIsWinNT(void);
BOOL WINAPI FIsWinNT5(VOID);
BOOL WINAPI MkMBStrEx(PBYTE pbBuff, DWORD cbBuff, LPCWSTR wsz, int cchW, char ** pszMB, int *pcbConverted);
BOOL WINAPI MkMBStr(PBYTE pbBuff, DWORD cbBuff, LPCWSTR wsz, char ** pszMB);
void WINAPI FreeMBStr(PBYTE pbBuff, char * szMB);
LPWSTR WINAPI MkWStr(char * szMB);
void WINAPI FreeWStr(LPWSTR wsz);
BOOL WINAPI wstr2guid(const WCHAR *pwszIn, GUID *pgOut);
BOOL WINAPI guid2wstr(const GUID *pgIn, WCHAR *pwszOut);
// The following is also needed for non-x86 due to a bug in advapi32 for
// CryptAcquireContextW.
BOOL WINAPI CryptAcquireContextU(
HCRYPTPROV *phProv,
LPCWSTR lpContainer,
LPCWSTR lpProvider,
DWORD dwProvType,
DWORD dwFlags
);
BOOL WINAPI CryptEnumProvidersU(
DWORD dwIndex,
DWORD *pdwReserved,
DWORD dwFlags,
DWORD *pdwProvType,
LPWSTR pwszProvName,
DWORD *pcbProvName
);
// The following is also needed for non-x86 due to the fact that the
// A/W versions of the ListView_ functions do not exist.
// (these are implemented in ispu\common\unicode\commctrl.cpp)
int WINAPI ListView_InsertItemU(
HWND hwnd,
const LPLVITEMW pitem
);
void WINAPI ListView_SetItemTextU(
HWND hwnd,
int i,
int iSubItem,
LPCWSTR pszText
);
int WINAPI ListView_InsertColumnU(
HWND hwnd,
int i,
const LPLVCOLUMNW plvC);
BOOL WINAPI ListView_GetItemU(
HWND hwnd,
LPLVITEMW pitem
);
LONG WINAPI RegOpenHKCUKeyExA(
HKEY hKey, // handle of open key
LPCSTR lpSubKey, // address of name of subkey to open
DWORD ulOptions, // reserved
REGSAM samDesired, // security access mask
PHKEY phkResult // address of handle of open key
);
//
// the following api's handle the problem with impersinating another user
// and having the HKEY_CURRENT_USER opened to an incorrect user's SID.
//
LONG WINAPI RegCreateHKCUKeyExU (
HKEY hKey,
LPCWSTR lpSubKey,
DWORD Reserved,
LPWSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);
LONG WINAPI RegCreateHKCUKeyExA (
HKEY hKey,
LPCSTR lpSubKey,
DWORD Reserved,
LPSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);
LONG WINAPI RegOpenHKCUKeyExU(
HKEY hKey,
LPCWSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);
LONG
WINAPI
RegOpenHKCU(
HKEY *phKeyCurrentUser
);
LONG
WINAPI
RegOpenHKCUEx(
HKEY *phKeyCurrentUser,
DWORD dwFlags
);
// Normally, HKEY_USERS\CurrentSid is opened as the HKCU. However, if
// HKEY_USERS\CurrentSid doesn't exist, then, HKEY_USERS\.Default is
// opened. Set the following flag to only open
// HKEY_USERS\.Default if the current user is the LocalSystem SID.
#define REG_HKCU_LOCAL_SYSTEM_ONLY_DEFAULT_FLAG 0x1
LONG
WINAPI
RegCloseHKCU(
HKEY hKeyCurrentUser
);
BOOL
WINAPI
GetUserTextualSidHKCU(
IN LPWSTR wszTextualSid,
IN OUT LPDWORD pcchTextualSid
);
#ifdef _M_IX86
// Reg.cpp
LONG WINAPI RegCreateKeyExU (
HKEY hKey,
LPCWSTR lpSubKey,
DWORD Reserved,
LPWSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);
LONG WINAPI RegDeleteKeyU(
HKEY hKey,
LPCWSTR lpSubKey
);
LONG WINAPI RegEnumKeyExU (
HKEY hKey,
DWORD dwIndex,
LPWSTR lpName,
LPDWORD lpcbName,
LPDWORD lpReserved,
LPWSTR lpClass,
LPDWORD lpcbClass,
PFILETIME lpftLastWriteTime
);
LONG WINAPI RegEnumValueU (
HKEY hKey,
DWORD dwIndex,
LPWSTR lpValueName,
LPDWORD lpcbValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
LONG RegQueryValueExU(
HKEY hKey,
LPCWSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
LONG WINAPI RegSetValueExU (
HKEY hKey,
LPCWSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE* lpData,
DWORD cbData
);
LONG WINAPI RegDeleteValueU (
HKEY hKey,
LPCWSTR lpValueName
);
LONG WINAPI RegQueryInfoKeyU (
HKEY hKey,
LPWSTR lpClass,
LPDWORD lpcbClass,
LPDWORD lpReserved,
LPDWORD lpcSubKeys,
LPDWORD lpcbMaxSubKeyLen,
LPDWORD lpcbMaxClassLen,
LPDWORD lpcValues,
LPDWORD lpcbMaxValueNameLen,
LPDWORD lpcbMaxValueLen,
LPDWORD lpcbSecurityDescriptor,
PFILETIME lpftLastWriteTime
);
LONG WINAPI RegOpenKeyExU(
HKEY hKey,
LPCWSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);
LONG WINAPI RegConnectRegistryU (
LPWSTR lpMachineName,
HKEY hKey,
PHKEY phkResult
);
// File.cpp
HANDLE WINAPI CreateFileU (
LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
BOOL
WINAPI
DeleteFileU(
LPCWSTR lpFileName
);
BOOL
WINAPI
CopyFileU(
LPCWSTR lpwExistingFileName,
LPCWSTR lpwNewFileName,
BOOL bFailIfExists
);
BOOL
WINAPI
MoveFileExU(
LPCWSTR lpExistingFileName,
LPCWSTR lpNewFileName,
DWORD dwFlags);
DWORD
WINAPI
GetFileAttributesU(
LPCWSTR lpFileName
);
BOOL
WINAPI
SetFileAttributesU(
LPCWSTR lpFileName,
DWORD dwFileAttributes
);
DWORD
WINAPI
GetCurrentDirectoryU(
DWORD nBufferLength,
LPWSTR lpBuffer);
BOOL
WINAPI
CreateDirectoryU(
LPCWSTR lpPathName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
UINT
WINAPI
GetWindowsDirectoryU(
LPWSTR lpBuffer,
UINT uSize
);
HINSTANCE WINAPI LoadLibraryU(
LPCWSTR lpLibFileName
);
HINSTANCE WINAPI LoadLibraryExU(
LPCWSTR lpLibFileName,
HANDLE hFile,
DWORD dwFlags
);
DWORD
WINAPI
ExpandEnvironmentStringsU(
LPCWSTR lpSrc,
LPWSTR lpDst,
DWORD nSize
);
// capi.cpp
BOOL WINAPI CryptSignHashU(
HCRYPTHASH hHash,
DWORD dwKeySpec,
LPCWSTR lpDescription,
DWORD dwFlags,
BYTE *pbSignature,
DWORD *pdwSigLen
);
BOOL WINAPI CryptVerifySignatureU(
HCRYPTHASH hHash,
CONST BYTE *pbSignature,
DWORD dwSigLen,
HCRYPTKEY hPubKey,
LPCWSTR lpDescription,
DWORD dwFlags
);
BOOL WINAPI CryptSetProviderU(
LPCWSTR lpProvName,
DWORD dwProvType
);
// Ole.cpp
RPC_STATUS RPC_ENTRY UuidToStringU(
UUID * Uuid,
WCHAR * * StringUuid
);
// nt.cpp
BOOL WINAPI GetUserNameU(
LPWSTR lpBuffer,
LPDWORD nSize
);
BOOL WINAPI GetComputerNameU(
LPWSTR lpBuffer,
LPDWORD nSize
);
DWORD WINAPI GetModuleFileNameU(
HMODULE hModule,
LPWSTR lpFilename,
DWORD nSize
);
HMODULE WINAPI GetModuleHandleU(
LPCWSTR lpModuleName // address of module name to return handle for
);
// user.cpp
int WINAPI LoadStringU(
HINSTANCE hInstance,
UINT uID,
LPWSTR lpBuffer,
int nBufferMax
);
DWORD WINAPI FormatMessageU(
DWORD dwFlags,
LPCVOID lpSource,
DWORD dwMessageId,
DWORD dwLanguageId,
LPWSTR lpBuffer,
DWORD nSize,
va_list *Arguments
);
BOOL WINAPI SetWindowTextU(
HWND hWnd,
LPCWSTR lpString
);
int WINAPI DialogBoxParamU(
HINSTANCE hInstance,
LPCWSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam
);
UINT WINAPI GetDlgItemTextU(
HWND hDlg,
int nIDDlgItem,
LPWSTR lpString,
int nMaxCount
);
BOOL WINAPI SetDlgItemTextU(
HWND hDlg,
int nIDDlgItem,
LPCWSTR lpString
);
int WINAPI MessageBoxU(
HWND hWnd ,
LPCWSTR lpText,
LPCWSTR lpCaption,
UINT uType
);
int WINAPI LCMapStringU(
LCID Locale,
DWORD dwMapFlags,
LPCWSTR lpSrcStr,
int cchSrc,
LPWSTR lpDestStr,
int cchDest
);
int WINAPI GetDateFormatU(
LCID Locale,
DWORD dwFlags,
CONST SYSTEMTIME *lpDate,
LPCWSTR lpFormat,
LPWSTR lpDateStr,
int cchDate
);
int WINAPI GetTimeFormatU(
LCID Locale,
DWORD dwFlags,
CONST SYSTEMTIME *lpTime,
LPCWSTR lpFormat,
LPWSTR lpTimeStr,
int cchTime
);
BOOL WINAPI WinHelpU(
HWND hWndMain,
LPCWSTR lpszHelp,
UINT uCommand,
DWORD dwData
);
LRESULT WINAPI SendMessageU(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
LONG WINAPI
SendDlgItemMessageU(
HWND hDlg,
int nIDDlgItem,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
LPWSTR
WINAPI
GetCommandLineU(void);
BOOL
WINAPI
IsBadStringPtrU(IN LPWSTR lpsz, UINT ucchMax);
void
WINAPI
OutputDebugStringU(IN LPWSTR lpwsz);
int
WINAPI
DrawTextU(
HDC hDC,
LPCWSTR lpString,
int nCount,
LPRECT lpRect,
UINT uFormat
);
// event.cpp
HANDLE
WINAPI
CreateEventU(
LPSECURITY_ATTRIBUTES lpEventAttributes,
BOOL bManualReset,
BOOL bInitialState,
LPCWSTR lpName);
HANDLE
WINAPI
RegisterEventSourceU(
LPCWSTR lpUNCServerName,
LPCWSTR lpSourceName);
HANDLE
WINAPI
OpenEventU(
DWORD dwDesiredAccess,
BOOL bInheritHandle,
LPCWSTR lpName);
HANDLE
WINAPI
CreateMutexU(
LPSECURITY_ATTRIBUTES lpMutexAttributes,
BOOL bInitialOwner,
LPCWSTR lpName);
HANDLE
WINAPI
OpenMutexU(
DWORD dwDesiredAccess,
BOOL bInheritHandle,
LPCWSTR lpName);
HFONT
WINAPI
CreateFontIndirectU(CONST LOGFONTW *lplf);
#else
#define RegQueryValueExU RegQueryValueExW
#define RegCreateKeyExU RegCreateKeyExW
#define RegDeleteKeyU RegDeleteKeyW
#define RegEnumKeyExU RegEnumKeyExW
#define RegEnumValueU RegEnumValueW
#define RegSetValueExU RegSetValueExW
#define RegQueryInfoKeyU RegQueryInfoKeyW
#define RegDeleteValueU RegDeleteValueW
#define RegOpenKeyExU RegOpenKeyExW
#define RegConnectRegistryU RegConnectRegistryW
#define ExpandEnvironmentStringsU ExpandEnvironmentStringsW
#define CreateFileU CreateFileW
#define DeleteFileU DeleteFileW
#define CopyFileU CopyFileW
#define GetFileAttributesU GetFileAttributesW
#define SetFileAttributesU SetFileAttributesW
#define GetCurrentDirectoryU GetCurrentDirectoryW
#define CreateDirectoryU CreateDirectoryW
#define GetWindowsDirectoryU GetWindowsDirectoryW
#define LoadLibraryU LoadLibraryW
#define LoadLibraryExU LoadLibraryExW
#define CryptSignHashU CryptSignHashW
#define CryptVerifySignatureU CryptVerifySignatureW
#define CryptSetProviderU CryptSetProviderW
#define UuidToStringU UuidToStringW
#define GetUserNameU GetUserNameW
#define GetComputerNameU GetComputerNameW
#define GetModuleFileNameU GetModuleFileNameW
#define GetModuleHandleU GetModuleHandleW
#define LoadStringU LoadStringW
#define FormatMessageU FormatMessageW
#define SetWindowTextU SetWindowTextW
#define DialogBoxParamU DialogBoxParamW
#define GetDlgItemTextU GetDlgItemTextW
#define SetDlgItemTextU SetDlgItemTextW
#define MessageBoxU MessageBoxW
#define LCMapStringU LCMapStringW
#define GetDateFormatU GetDateFormatW
#define GetTimeFormatU GetTimeFormatW
#define WinHelpU WinHelpW
#define SendMessageU SendMessageW
#define SendDlgItemMessageU SendDlgItemMessageW
#define IsBadStringPtrU IsBadStringPtrW
#define OutputDebugStringU OutputDebugStringW
#define GetCommandLineU GetCommandLineW
#define DrawTextU DrawTextW
#define CreateEventU CreateEventW
#define RegisterEventSourceU RegisterEventSourceW
#define OpenEventU OpenEventW
#define CreateMutexU CreateMutexW
#define OpenMutexU OpenMutexW
#define CreateFontIndirectU CreateFontIndirectW
#endif // _M_IX86
#ifdef __cplusplus
} // Balance extern "C" above
#endif
#endif