Author: hpoussin Date: Sat Jul 22 02:15:21 2006 New Revision: 23219
URL: http://svn.reactos.org/svn/reactos?rev=23219&view=rev Log: Get rid of TCHAR variables. Use WCHAR instead.
Modified: trunk/reactos/dll/win32/newdev/newdev.c trunk/reactos/dll/win32/newdev/newdev.rbuild trunk/reactos/dll/win32/newdev/newdev_private.h trunk/reactos/dll/win32/newdev/wizard.c
Modified: trunk/reactos/dll/win32/newdev/newdev.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev.c?r... ============================================================================== --- trunk/reactos/dll/win32/newdev/newdev.c (original) +++ trunk/reactos/dll/win32/newdev/newdev.c Sat Jul 22 02:15:21 2006 @@ -30,8 +30,8 @@ static BOOL SearchDriver( IN PDEVINSTDATA DevInstData, - IN LPCTSTR Directory OPTIONAL, - IN LPCTSTR InfFile OPTIONAL); + IN LPCWSTR Directory OPTIONAL, + IN LPCWSTR InfFile OPTIONAL);
/* * @implemented @@ -250,14 +250,14 @@ static BOOL SearchDriver( IN PDEVINSTDATA DevInstData, - IN LPCTSTR Directory OPTIONAL, - IN LPCTSTR InfFile OPTIONAL) -{ - SP_DEVINSTALL_PARAMS DevInstallParams = {0,}; + IN LPCWSTR Directory OPTIONAL, + IN LPCWSTR InfFile OPTIONAL) +{ + SP_DEVINSTALL_PARAMS_W DevInstallParams = {0,}; BOOL ret;
- DevInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); - if (!SetupDiGetDeviceInstallParams(DevInstData->hDevInfo, &DevInstData->devInfoData, &DevInstallParams)) + DevInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); + if (!SetupDiGetDeviceInstallParamsW(DevInstData->hDevInfo, &DevInstData->devInfoData, &DevInstallParams)) { TRACE("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", GetLastError()); return FALSE; @@ -267,20 +267,20 @@ if (InfFile) { DevInstallParams.Flags |= DI_ENUMSINGLEINF; - _tcsncpy(DevInstallParams.DriverPath, InfFile, MAX_PATH); + wcsncpy(DevInstallParams.DriverPath, InfFile, MAX_PATH); } else if (Directory) { DevInstallParams.Flags &= ~DI_ENUMSINGLEINF; - _tcsncpy(DevInstallParams.DriverPath, Directory, MAX_PATH); + wcsncpy(DevInstallParams.DriverPath, Directory, MAX_PATH); } else { DevInstallParams.Flags &= ~DI_ENUMSINGLEINF; - *DevInstallParams.DriverPath = _T('\0'); - } - - ret = SetupDiSetDeviceInstallParams( + *DevInstallParams.DriverPath = '\0'; + } + + ret = SetupDiSetDeviceInstallParamsW( DevInstData->hDevInfo, &DevInstData->devInfoData, &DevInstallParams); @@ -319,20 +319,20 @@ }
static BOOL -IsDots(IN LPCTSTR str) -{ - if(_tcscmp(str, _T(".")) && _tcscmp(str, _T(".."))) return FALSE; +IsDots(IN LPCWSTR str) +{ + if(wcscmp(str, L".") && wcscmp(str, L"..")) return FALSE; return TRUE; }
-static LPCTSTR -GetFileExt(IN LPTSTR FileName) -{ - LPCTSTR Dot; - - Dot = _tcsrchr(FileName, _T('.')); +static LPCWSTR +GetFileExt(IN LPWSTR FileName) +{ + LPCWSTR Dot; + + Dot = wcsrchr(FileName, '.'); if (!Dot) - return _T(""); + return L"";
return Dot; } @@ -340,40 +340,40 @@ static BOOL SearchDriverRecursive( IN PDEVINSTDATA DevInstData, - IN LPCTSTR Path) -{ - WIN32_FIND_DATA wfd; - TCHAR DirPath[MAX_PATH]; - TCHAR FileName[MAX_PATH]; - TCHAR FullPath[MAX_PATH]; - TCHAR LastDirPath[MAX_PATH] = _T(""); - TCHAR PathWithPattern[MAX_PATH]; + IN LPCWSTR Path) +{ + WIN32_FIND_DATAW wfd; + WCHAR DirPath[MAX_PATH]; + WCHAR FileName[MAX_PATH]; + WCHAR FullPath[MAX_PATH]; + WCHAR LastDirPath[MAX_PATH] = L""; + WCHAR PathWithPattern[MAX_PATH]; BOOL ok = TRUE; BOOL retval = FALSE; HANDLE hFindFile = INVALID_HANDLE_VALUE;
- _tcscpy(DirPath, Path); - - if (DirPath[_tcsclen(DirPath) - 1] != '\') - _tcscat(DirPath, _T("\")); - - _tcscpy(PathWithPattern, DirPath); - _tcscat(PathWithPattern, _T("\*")); - - for (hFindFile = FindFirstFile(PathWithPattern, &wfd); + wcscpy(DirPath, Path); + + if (DirPath[wcslen(DirPath) - 1] != '\') + wcscat(DirPath, L"\"); + + wcscpy(PathWithPattern, DirPath); + wcscat(PathWithPattern, L"\*"); + + for (hFindFile = FindFirstFileW(PathWithPattern, &wfd); ok && hFindFile != INVALID_HANDLE_VALUE; - ok = FindNextFile(hFindFile, &wfd)) - { - - _tcscpy(FileName, wfd.cFileName); + ok = FindNextFileW(hFindFile, &wfd)) + { + + wcscpy(FileName, wfd.cFileName); if (IsDots(FileName)) continue;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { /* Recursive search */ - _tcscpy(FullPath, DirPath); - _tcscat(FullPath, FileName); + wcscpy(FullPath, DirPath); + wcscat(FullPath, FileName); if (SearchDriverRecursive(DevInstData, FullPath)) { retval = TRUE; @@ -382,13 +382,13 @@ } else { - LPCTSTR pszExtension = GetFileExt(FileName); - - if ((_tcsicmp(pszExtension, _T(".inf")) == 0) && (_tcscmp(LastDirPath, DirPath) != 0)) - { - _tcscpy(LastDirPath, DirPath); - - if (_tcsclen(DirPath) > MAX_PATH) + LPCWSTR pszExtension = GetFileExt(FileName); + + if ((wcsicmp(pszExtension, L".inf") == 0) && (wcscmp(LastDirPath, DirPath) != 0)) + { + wcscpy(LastDirPath, DirPath); + + if (wcslen(DirPath) > MAX_PATH) /* Path is too long to be searched */ continue;
@@ -422,11 +422,11 @@ /* We need to check all specified directories to be * sure to find the best driver for the device. */ - LPCTSTR Path; - for (Path = DevInstData->CustomSearchPath; *Path != '\0'; Path += _tcslen(Path) + 1) + LPCWSTR Path; + for (Path = DevInstData->CustomSearchPath; *Path != '\0'; Path += wcslen(Path) + 1) { TRACE("Search driver in %S\n", Path); - if (_tcslen(Path) == 2 && Path[1] == ':') + if (wcslen(Path) == 2 && Path[1] == ':') { if (SearchDriverRecursive(DevInstData, Path)) result = TRUE; @@ -449,13 +449,13 @@ IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL) { - TCHAR drive[] = {'?',':',0}; + WCHAR drive[] = {'?',':',0}; DWORD dwDrives = 0; DWORD i; UINT nType; DWORD CustomTextLength = 0; DWORD LengthNeeded = 0; - LPTSTR Buffer; + LPWSTR Buffer;
/* Calculate length needed to store the search paths */ if (IncludeRemovableDevices) @@ -465,7 +465,7 @@ { if (dwDrives & i) { - nType = GetDriveType(drive); + nType = GetDriveTypeW(drive); if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM) { LengthNeeded += 3; @@ -484,7 +484,7 @@ DevInstData->CustomSearchPath = Buffer = HeapAlloc( GetProcessHeap(), 0, - (LengthNeeded + 1) * sizeof(TCHAR)); + (LengthNeeded + 1) * sizeof(WCHAR)); if (!Buffer) { TRACE("HeapAlloc() failed\n"); @@ -499,19 +499,19 @@ { if (dwDrives & i) { - nType = GetDriveType(drive); + nType = GetDriveTypeW(drive); if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM) { - Buffer += 1 + _stprintf(Buffer, drive); + Buffer += 1 + swprintf(Buffer, drive); } } } } if (IncludeCustomPath) { - Buffer += 1 + ComboBox_GetText(hwndCombo, Buffer, CustomTextLength); - } - *Buffer = _T('\0'); + Buffer += 1 + GetWindowTextW(hwndCombo, Buffer, CustomTextLength); + } + *Buffer = '\0';
return TRUE; } @@ -522,7 +522,7 @@ { BOOL ret;
- TRACE("Installing driver %S: %S\n", DevInstData->drvInfoData.MfgName, DevInstData->drvInfoData.Description); + TRACE("Installing driver %s: %s\n", DevInstData->drvInfoData.MfgName, DevInstData->drvInfoData.Description);
ret = SetupDiCallClassInstaller( DIF_SELECTBESTCOMPATDRV, @@ -733,7 +733,7 @@ } }
- TRACE("Installing %S (%S)\n", DevInstData->buffer, InstanceId); + TRACE("Installing %s (%S)\n", DevInstData->buffer, InstanceId);
/* Search driver in default location and removable devices */ if (!PrepareFoldersToScan(DevInstData, FALSE, FALSE, NULL))
Modified: trunk/reactos/dll/win32/newdev/newdev.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev.rbu... ============================================================================== --- trunk/reactos/dll/win32/newdev/newdev.rbuild (original) +++ trunk/reactos/dll/win32/newdev/newdev.rbuild Sat Jul 22 02:15:21 2006 @@ -1,7 +1,5 @@ <module name="newdev" type="win32dll" installbase="system32" installname="newdev.dll"> <include base="newdev">.</include> - <define name="UNICODE" /> - <define name="_UNICODE" /> <importlibrary definition="newdev.spec.def" /> <define name="_WIN32_IE">0x0600</define> <define name="_WIN32_WINNT">0x0501</define>
Modified: trunk/reactos/dll/win32/newdev/newdev_private.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev_pri... ============================================================================== --- trunk/reactos/dll/win32/newdev/newdev_private.h (original) +++ trunk/reactos/dll/win32/newdev/newdev_private.h Sat Jul 22 02:15:21 2006 @@ -1,6 +1,7 @@ #ifndef __NEWDEV_PRIVATE_H #define __NEWDEV_PRIVATE_H
+#define COBJMACROS #include <windows.h> #include <windowsx.h> #include <commctrl.h> @@ -9,7 +10,6 @@ #include <setupapi.h> #include <cfgmgr32.h> #include <shlobj.h> -#include <tchar.h> #include <wine/debug.h>
#include <stdio.h> @@ -29,7 +29,7 @@ SP_DEVINFO_DATA devInfoData; SP_DRVINFO_DATA drvInfoData;
- LPTSTR CustomSearchPath; /* MULTI_SZ string */ + LPWSTR CustomSearchPath; /* MULTI_SZ string */ } DEVINSTDATA, *PDEVINSTDATA;
#define WM_SEARCH_FINISHED (WM_USER + 10)
Modified: trunk/reactos/dll/win32/newdev/wizard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/wizard.c?r... ============================================================================== --- trunk/reactos/dll/win32/newdev/wizard.c (original) +++ trunk/reactos/dll/win32/newdev/wizard.c Sat Jul 22 02:15:21 2006 @@ -237,8 +237,8 @@ HKEY hKey = NULL; DWORD dwRegType; DWORD dwPathLength; - LPTSTR Buffer = NULL; - LPCTSTR Path; + LPWSTR Buffer = NULL; + LPCWSTR Path; LONG rc;
(void)ComboBox_ResetContent(hwndCombo); @@ -255,9 +255,9 @@ TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc); goto cleanup; } - rc = RegQueryValueEx( + rc = RegQueryValueExW( hKey, - _T("Installation Sources"), + L"Installation Sources", NULL, &dwRegType, NULL, @@ -269,15 +269,15 @@ }
/* Allocate enough space to add 2 NULL chars at the end of the string */ - Buffer = HeapAlloc(GetProcessHeap(), 0, dwPathLength + 2 * sizeof(TCHAR)); + Buffer = HeapAlloc(GetProcessHeap(), 0, dwPathLength + 2 * sizeof(WCHAR)); if (!Buffer) { TRACE("HeapAlloc() failed\n"); goto cleanup; } - rc = RegQueryValueEx( + rc = RegQueryValueExW( hKey, - _T("Installation Sources"), + L"Installation Sources", NULL, NULL, (LPBYTE)Buffer, @@ -290,7 +290,7 @@ Buffer[dwPathLength] = Buffer[dwPathLength + 1] = '\0';
/* Populate combo box */ - for (Path = Buffer; *Path; Path += _tcslen(Path) + 1) + for (Path = Buffer; *Path; Path += wcslen(Path) + 1) { (void)ComboBox_AddString(hwndCombo, Path); if (Path == Buffer) @@ -307,10 +307,10 @@ SaveCustomPath( IN HWND hwndCombo) { - LPTSTR CustomPath = NULL; + LPWSTR CustomPath = NULL; DWORD CustomPathLength; - LPTSTR Buffer = NULL; - LPTSTR pBuffer; /* Pointer into Buffer */ + LPWSTR Buffer = NULL; + LPWSTR pBuffer; /* Pointer into Buffer */ int ItemsCount, Length; DWORD i; DWORD TotalLength = 0; @@ -320,13 +320,13 @@
/* Get custom path */ Length = ComboBox_GetTextLength(hwndCombo) + 1; - CustomPath = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(TCHAR)); + CustomPath = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR)); if (!CustomPath) { TRACE("HeapAlloc() failed\n"); goto cleanup; } - CustomPathLength = ComboBox_GetText(hwndCombo, CustomPath, Length) + 1; + CustomPathLength = GetWindowTextW(hwndCombo, CustomPath, Length) + 1;
/* Calculate length of the buffer */ ItemsCount = ComboBox_GetCount(hwndCombo); @@ -348,7 +348,7 @@ TotalLength++; /* Final NULL char */
/* Allocate buffer */ - Buffer = HeapAlloc(GetProcessHeap(), 0, (CustomPathLength + TotalLength + 1) * sizeof(TCHAR)); + Buffer = HeapAlloc(GetProcessHeap(), 0, (CustomPathLength + TotalLength + 1) * sizeof(WCHAR)); if (!Buffer) { TRACE("HeapAlloc() failed\n"); @@ -365,7 +365,7 @@ TRACE("ComboBox_GetLBText() failed\n"); goto cleanup; } - else if (UseCustomPath && _tcsicmp(CustomPath, pBuffer) == 0) + else if (UseCustomPath && wcsicmp(CustomPath, pBuffer) == 0) UseCustomPath = FALSE; pBuffer += 1 + Length; } @@ -378,7 +378,7 @@ }
TotalLength += CustomPathLength; - _tcscpy(Buffer, CustomPath); + wcscpy(Buffer, CustomPath);
/* Save the buffer */ /* RegSetKeyValue would have been better... */ @@ -393,13 +393,13 @@ TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc); goto cleanup; } - rc = RegSetValueEx( + rc = RegSetValueExW( hKey, - _T("Installation Sources"), + L"Installation Sources", 0, REG_MULTI_SZ, (const BYTE*)Buffer, - TotalLength * sizeof(TCHAR)); + TotalLength * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { TRACE("RegSetValueEx() failed with error 0x%lx\n", rc); @@ -595,21 +595,20 @@ pidl = SHBrowseForFolder(&bi); if (pidl) { - TCHAR Directory[MAX_PATH]; + WCHAR Directory[MAX_PATH]; IMalloc* malloc;
- if (SHGetPathFromIDList(pidl, Directory)) + if (SHGetPathFromIDListW(pidl, Directory)) { /* Set the IDC_COMBO_PATH text */ - ComboBox_SetText(GetDlgItem(hwndDlg, IDC_COMBO_PATH), Directory); + SetWindowTextW(GetDlgItem(hwndDlg, IDC_COMBO_PATH), Directory); }
/* Free memory, if possible */ if (SUCCEEDED(SHGetMalloc(&malloc))) { - FIXME("Memory leak!\n"); - //malloc->Free(pidl); - //malloc->Release(); + IMalloc_Free(malloc, pidl); + IMalloc_Release(malloc); } return TRUE; } @@ -1223,23 +1222,23 @@ static HFONT CreateTitleFont(VOID) { - NONCLIENTMETRICS ncm; - LOGFONT LogFont; + NONCLIENTMETRICSW ncm; + LOGFONTW LogFont; HDC hdc; INT FontSize; HFONT hFont;
- ncm.cbSize = sizeof(NONCLIENTMETRICS); + ncm.cbSize = sizeof(NONCLIENTMETRICSW); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
LogFont = ncm.lfMessageFont; LogFont.lfWeight = FW_BOLD; - _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); + wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
hdc = GetDC(NULL); FontSize = 12; LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; - hFont = CreateFontIndirect(&LogFont); + hFont = CreateFontIndirectW(&LogFont); ReleaseDC(NULL, hdc);
return hFont;