- convert dialog to unicode

- fix /W4 warnings

svn path=/trunk/; revision=30254
This commit is contained in:
Ged Murphy 2007-11-08 00:23:55 +00:00
parent 5c34d25309
commit 3eca2d9ddf
3 changed files with 271 additions and 277 deletions

View file

@ -21,7 +21,6 @@
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdio.h> #include <stdio.h>
#include <tchar.h>
#include <todo.h> #include <todo.h>
#include "resource.h" #include "resource.h"
@ -49,10 +48,10 @@ typedef struct _SETTINGS_ENTRY
typedef struct _DISPLAY_DEVICE_ENTRY typedef struct _DISPLAY_DEVICE_ENTRY
{ {
struct _DISPLAY_DEVICE_ENTRY *Flink; struct _DISPLAY_DEVICE_ENTRY *Flink;
LPTSTR DeviceDescription; LPWSTR DeviceDescription;
LPTSTR DeviceName; LPWSTR DeviceName;
LPTSTR DeviceKey; LPWSTR DeviceKey;
LPTSTR DeviceID; LPWSTR DeviceID;
DWORD DeviceStateFlags; DWORD DeviceStateFlags;
PSETTINGS_ENTRY Settings; /* sorted by increasing dmPelsHeight, BPP */ PSETTINGS_ENTRY Settings; /* sorted by increasing dmPelsHeight, BPP */
DWORD SettingsCount; DWORD SettingsCount;
@ -82,7 +81,6 @@ typedef struct _INFO
} INFO, *PINFO; } INFO, *PINFO;
HINSTANCE hInst; HINSTANCE hInst;
extern char g_servername[];
static VOID static VOID
OnTabWndSelChange(PINFO pInfo) OnTabWndSelChange(PINFO pInfo)
@ -107,56 +105,56 @@ static VOID
FillServerAddesssCombo(PINFO pInfo) FillServerAddesssCombo(PINFO pInfo)
{ {
HKEY hKey; HKEY hKey;
TCHAR KeyName[] = _T("Software\\Microsoft\\Terminal Server Client\\Default"); WCHAR KeyName[] = L"Software\\Microsoft\\Terminal Server Client\\Default";
TCHAR Name[MAX_KEY_NAME]; WCHAR Name[MAX_KEY_NAME];
LONG ret = ERROR_SUCCESS; LONG ret = ERROR_SUCCESS;
DWORD size; DWORD size;
INT i = 0; INT i = 0;
if (RegOpenKeyEx(HKEY_CURRENT_USER, if (RegOpenKeyExW(HKEY_CURRENT_USER,
KeyName, KeyName,
0, 0,
KEY_READ, KEY_READ,
&hKey) == ERROR_SUCCESS) &hKey) == ERROR_SUCCESS)
{ {
while (ret == ERROR_SUCCESS) while (ret == ERROR_SUCCESS)
{ {
size = MAX_KEY_NAME; size = MAX_KEY_NAME;
ret = RegEnumValue(hKey, ret = RegEnumValueW(hKey,
i, i,
Name, Name,
&size, &size,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL); NULL);
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {
size = MAX_KEY_NAME; size = MAX_KEY_NAME;
if (RegQueryValueEx(hKey, if (RegQueryValueExW(hKey,
Name, Name,
0, 0,
NULL, NULL,
NULL, NULL,
&size) == ERROR_SUCCESS) &size) == ERROR_SUCCESS)
{ {
LPTSTR lpAddress = HeapAlloc(GetProcessHeap(), LPWSTR lpAddress = HeapAlloc(GetProcessHeap(),
0, 0,
size); size);
if (lpAddress) if (lpAddress)
{ {
if (RegQueryValueEx(hKey, if (RegQueryValueExW(hKey,
Name, Name,
0, 0,
NULL, NULL,
lpAddress, (LPBYTE)lpAddress,
&size) == ERROR_SUCCESS) &size) == ERROR_SUCCESS)
{ {
SendDlgItemMessage(pInfo->hGeneralPage, SendDlgItemMessageW(pInfo->hGeneralPage,
IDC_SERVERCOMBO, IDC_SERVERCOMBO,
CB_ADDSTRING, CB_ADDSTRING,
0, 0,
(LPARAM)lpAddress); (LPARAM)lpAddress);
} }
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
@ -170,16 +168,16 @@ FillServerAddesssCombo(PINFO pInfo)
} }
} }
if (LoadString(hInst, if (LoadStringW(hInst,
IDS_BROWSESERVER, IDS_BROWSESERVER,
Name, Name,
sizeof(Name) / sizeof(TCHAR))) sizeof(Name) / sizeof(WCHAR)))
{ {
SendDlgItemMessage(pInfo->hGeneralPage, SendDlgItemMessageW(pInfo->hGeneralPage,
IDC_SERVERCOMBO, IDC_SERVERCOMBO,
CB_ADDSTRING, CB_ADDSTRING,
0, 0,
(LPARAM)Name); (LPARAM)Name);
} }
} }
@ -197,34 +195,34 @@ GeneralOnInit(PINFO pInfo)
0, 0,
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
pInfo->hLogon = LoadImage(hInst, pInfo->hLogon = LoadImageW(hInst,
MAKEINTRESOURCE(IDI_LOGON), MAKEINTRESOURCEW(IDI_LOGON),
IMAGE_ICON,
32,
32,
LR_DEFAULTCOLOR);
if (pInfo->hLogon)
{
SendDlgItemMessageW(pInfo->hGeneralPage,
IDC_LOGONICON,
STM_SETICON,
(WPARAM)pInfo->hLogon,
0);
}
pInfo->hConn = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_CONN),
IMAGE_ICON, IMAGE_ICON,
32, 32,
32, 32,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (pInfo->hLogon)
{
SendDlgItemMessage(pInfo->hGeneralPage,
IDC_LOGONICON,
STM_SETICON,
(WPARAM)pInfo->hLogon,
0);
}
pInfo->hConn = LoadImage(hInst,
MAKEINTRESOURCE(IDI_CONN),
IMAGE_ICON,
32,
32,
LR_DEFAULTCOLOR);
if (pInfo->hConn) if (pInfo->hConn)
{ {
SendDlgItemMessage(pInfo->hGeneralPage, SendDlgItemMessageW(pInfo->hGeneralPage,
IDC_CONNICON, IDC_CONNICON,
STM_SETICON, STM_SETICON,
(WPARAM)pInfo->hConn, (WPARAM)pInfo->hConn,
0); 0);
} }
FillServerAddesssCombo(pInfo); FillServerAddesssCombo(pInfo);
@ -248,8 +246,8 @@ GeneralDlgProc(HWND hDlg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
PINFO pInfo = (PINFO)GetWindowLongPtr(GetParent(hDlg), PINFO pInfo = (PINFO)GetWindowLongPtrW(GetParent(hDlg),
GWLP_USERDATA); GWLP_USERDATA);
switch (message) switch (message)
{ {
@ -267,20 +265,20 @@ GeneralDlgProc(HWND hDlg,
{ {
INT last, cur; INT last, cur;
cur = SendDlgItemMessage(hDlg, cur = SendDlgItemMessageW(hDlg,
IDC_SERVERCOMBO,
CB_GETCURSEL,
0,
0);
cur++;
last = SendDlgItemMessage(hDlg,
IDC_SERVERCOMBO, IDC_SERVERCOMBO,
CB_GETCOUNT, CB_GETCURSEL,
0, 0,
0); 0);
cur++;
last = SendDlgItemMessageW(hDlg,
IDC_SERVERCOMBO,
CB_GETCOUNT,
0,
0);
if (cur == last) if (cur == last)
MessageBox(hDlg, _T("SMB is not yet supported"), _T("RDP error"), MB_ICONERROR); MessageBoxW(hDlg, L"SMB is not yet supported", L"RDP error", MB_ICONERROR);
} }
break; break;
@ -309,11 +307,11 @@ GeneralDlgProc(HWND hDlg,
static PSETTINGS_ENTRY static PSETTINGS_ENTRY
GetPossibleSettings(IN LPCTSTR DeviceName, GetPossibleSettings(IN LPCWSTR lpDeviceName,
OUT DWORD* pSettingsCount, OUT DWORD* pSettingsCount,
OUT PSETTINGS_ENTRY* CurrentSettings) OUT PSETTINGS_ENTRY* CurrentSettings)
{ {
DEVMODE devmode; DEVMODEW devmode;
DWORD NbSettings = 0; DWORD NbSettings = 0;
DWORD iMode = 0; DWORD iMode = 0;
DWORD dwFlags = 0; DWORD dwFlags = 0;
@ -324,7 +322,7 @@ GetPossibleSettings(IN LPCTSTR DeviceName,
/* Get current settings */ /* Get current settings */
*CurrentSettings = NULL; *CurrentSettings = NULL;
hDC = CreateIC(NULL, DeviceName, NULL, NULL); hDC = CreateICW(NULL, lpDeviceName, NULL, NULL);
bpp = GetDeviceCaps(hDC, PLANES); bpp = GetDeviceCaps(hDC, PLANES);
bpp *= GetDeviceCaps(hDC, BITSPIXEL); bpp *= GetDeviceCaps(hDC, BITSPIXEL);
xres = GetDeviceCaps(hDC, HORZRES); xres = GetDeviceCaps(hDC, HORZRES);
@ -335,10 +333,10 @@ GetPossibleSettings(IN LPCTSTR DeviceName,
devmode.dmSize = (WORD)sizeof(DEVMODE); devmode.dmSize = (WORD)sizeof(DEVMODE);
devmode.dmDriverExtra = 0; devmode.dmDriverExtra = 0;
if (!EnumDisplaySettingsEx(DeviceName, ENUM_CURRENT_SETTINGS, &devmode, dwFlags)) if (!EnumDisplaySettingsExW(lpDeviceName, ENUM_CURRENT_SETTINGS, &devmode, dwFlags))
return NULL; return NULL;
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags)) while (EnumDisplaySettingsExW(lpDeviceName, iMode, &devmode, dwFlags))
{ {
if (devmode.dmBitsPerPel==8 || if (devmode.dmBitsPerPel==8 ||
devmode.dmBitsPerPel==16 || devmode.dmBitsPerPel==16 ||
@ -399,13 +397,13 @@ GetPossibleSettings(IN LPCTSTR DeviceName,
static BOOL static BOOL
AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICE DisplayDevice) AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICEW DisplayDevice)
{ {
PDISPLAY_DEVICE_ENTRY newEntry = NULL; PDISPLAY_DEVICE_ENTRY newEntry = NULL;
LPTSTR description = NULL; LPWSTR description = NULL;
LPTSTR name = NULL; LPWSTR name = NULL;
LPTSTR key = NULL; LPWSTR key = NULL;
LPTSTR devid = NULL; LPWSTR devid = NULL;
DWORD descriptionSize, nameSize, keySize, devidSize; DWORD descriptionSize, nameSize, keySize, devidSize;
PSETTINGS_ENTRY Current; PSETTINGS_ENTRY Current;
DWORD ResolutionsCount = 1; DWORD ResolutionsCount = 1;
@ -457,19 +455,19 @@ AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICE DisplayDevice)
i++; i++;
} }
} }
descriptionSize = (_tcslen(DisplayDevice->DeviceString) + 1) * sizeof(TCHAR); descriptionSize = (wcslen(DisplayDevice->DeviceString) + 1) * sizeof(WCHAR);
description = HeapAlloc(GetProcessHeap(), 0, descriptionSize); description = HeapAlloc(GetProcessHeap(), 0, descriptionSize);
if (!description) goto ByeBye; if (!description) goto ByeBye;
nameSize = (_tcslen(DisplayDevice->DeviceName) + 1) * sizeof(TCHAR); nameSize = (wcslen(DisplayDevice->DeviceName) + 1) * sizeof(WCHAR);
name = HeapAlloc(GetProcessHeap(), 0, nameSize); name = HeapAlloc(GetProcessHeap(), 0, nameSize);
if (!name) goto ByeBye; if (!name) goto ByeBye;
keySize = (_tcslen(DisplayDevice->DeviceKey) + 1) * sizeof(TCHAR); keySize = (wcslen(DisplayDevice->DeviceKey) + 1) * sizeof(WCHAR);
key = HeapAlloc(GetProcessHeap(), 0, keySize); key = HeapAlloc(GetProcessHeap(), 0, keySize);
if (!key) goto ByeBye; if (!key) goto ByeBye;
devidSize = (_tcslen(DisplayDevice->DeviceID) + 1) * sizeof(TCHAR); devidSize = (wcslen(DisplayDevice->DeviceID) + 1) * sizeof(WCHAR);
devid = HeapAlloc(GetProcessHeap(), 0, devidSize); devid = HeapAlloc(GetProcessHeap(), 0, devidSize);
if (!devid) goto ByeBye; if (!devid) goto ByeBye;
@ -516,9 +514,9 @@ ByeBye:
static VOID static VOID
OnResolutionChanged(PINFO pInfo, DWORD position) OnResolutionChanged(PINFO pInfo, INT position)
{ {
TCHAR Buffer[64]; WCHAR Buffer[64];
INT MaxSlider; INT MaxSlider;
MaxSlider = SendDlgItemMessageW(pInfo->hDisplayPage, MaxSlider = SendDlgItemMessageW(pInfo->hDisplayPage,
@ -529,33 +527,33 @@ OnResolutionChanged(PINFO pInfo, DWORD position)
if (position == MaxSlider) if (position == MaxSlider)
{ {
LoadString(hInst, LoadStringW(hInst,
IDS_FULLSCREEN, IDS_FULLSCREEN,
Buffer, Buffer,
sizeof(Buffer) / sizeof(TCHAR)); sizeof(Buffer) / sizeof(WCHAR));
} }
else else
{ {
TCHAR Pixel[64]; WCHAR Pixel[64];
if (LoadString(hInst, if (LoadStringW(hInst,
IDS_PIXEL, IDS_PIXEL,
Pixel, Pixel,
sizeof(Pixel) / sizeof(TCHAR))) sizeof(Pixel) / sizeof(WCHAR)))
{ {
_stprintf(Buffer, _swprintf(Buffer,
Pixel, Pixel,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth, pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight, pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight,
Pixel); Pixel);
} }
} }
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_SETTINGS_RESOLUTION_TEXT, IDC_SETTINGS_RESOLUTION_TEXT,
WM_SETTEXT, WM_SETTEXT,
0, 0,
(LPARAM)Buffer); (LPARAM)Buffer);
/* save new settings */ /* save new settings */
SetIntegerToSettings(pInfo->pRdpSettings, SetIntegerToSettings(pInfo->pRdpSettings,
@ -572,8 +570,8 @@ static VOID
FillResolutionsAndColors(PINFO pInfo) FillResolutionsAndColors(PINFO pInfo)
{ {
PSETTINGS_ENTRY Current; PSETTINGS_ENTRY Current;
TCHAR Buffer[64]; WCHAR Buffer[64];
TCHAR Pixel[64]; WCHAR Pixel[64];
DWORD index, i, num; DWORD index, i, num;
DWORD MaxBpp = 0; DWORD MaxBpp = 0;
DWORD width, height; DWORD width, height;
@ -582,11 +580,11 @@ FillResolutionsAndColors(PINFO pInfo)
pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */ pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */
/* find max bpp */ /* find max bpp */
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_RESETCONTENT, CB_RESETCONTENT,
0, 0,
0); 0);
for (Current = pInfo->DisplayDeviceList->Settings; Current != NULL; Current = Current->Flink) for (Current = pInfo->DisplayDeviceList->Settings; Current != NULL; Current = Current->Flink)
{ {
if (Current->dmBitsPerPel > MaxBpp) if (Current->dmBitsPerPel > MaxBpp)
@ -598,6 +596,7 @@ FillResolutionsAndColors(PINFO pInfo)
case 24: num = 4; break; case 24: num = 4; break;
case 16: num = 3; break; case 16: num = 3; break;
case 8: num = 1; break; case 8: num = 1; break;
default: num = 0; break;
} }
types[0] = IDS_256COLORS; types[0] = IDS_256COLORS;
@ -606,54 +605,54 @@ FillResolutionsAndColors(PINFO pInfo)
types[3] = IDS_HIGHCOLOR24; types[3] = IDS_HIGHCOLOR24;
/* Fill color depths combo box */ /* Fill color depths combo box */
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_RESETCONTENT, CB_RESETCONTENT,
0, 0,
0); 0);
for (i = 0, Current = pInfo->DisplayDeviceList->Settings; for (i = 0, Current = pInfo->DisplayDeviceList->Settings;
i <= num && Current != NULL; i <= num && Current != NULL;
i++, Current = Current->Flink) i++, Current = Current->Flink)
{ {
TCHAR Buffer[64]; WCHAR Buffer[64];
if (LoadString(hInst, if (LoadStringW(hInst,
types[i], types[i],
Buffer, Buffer,
sizeof(Buffer) / sizeof(TCHAR))) sizeof(Buffer) / sizeof(WCHAR)))
{ {
index = (DWORD)SendDlgItemMessage(pInfo->hDisplayPage, index = (DWORD)SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_FINDSTRINGEXACT, CB_FINDSTRINGEXACT,
-1, (WPARAM)-1,
(LPARAM)Buffer); (LPARAM)Buffer);
if (index == (DWORD)CB_ERR) if (index == (DWORD)CB_ERR)
{ {
index = (DWORD)SendDlgItemMessage(pInfo->hDisplayPage, index = (DWORD)SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_ADDSTRING, CB_ADDSTRING,
0, 0,
(LPARAM)Buffer); (LPARAM)Buffer);
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_SETITEMDATA, CB_SETITEMDATA,
index, index,
types[i]); types[i]);
} }
} }
} }
/* Fill resolutions slider */ /* Fill resolutions slider */
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_GEOSLIDER, IDC_GEOSLIDER,
TBM_CLEARTICS, TBM_CLEARTICS,
TRUE, TRUE,
0); 0);
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_GEOSLIDER, IDC_GEOSLIDER,
TBM_SETRANGE, TBM_SETRANGE,
TRUE, TRUE,
MAKELONG(0, pInfo->DisplayDeviceList->ResolutionsCount)); //extra 1 for full screen MAKELONG(0, pInfo->DisplayDeviceList->ResolutionsCount)); //extra 1 for full screen
width = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopwidth"); width = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopwidth");
height = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopheight"); height = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopheight");
@ -665,30 +664,30 @@ FillResolutionsAndColors(PINFO pInfo)
if (pInfo->CurrentDisplayDevice->Resolutions[index].dmPelsWidth == width && if (pInfo->CurrentDisplayDevice->Resolutions[index].dmPelsWidth == width &&
pInfo->CurrentDisplayDevice->Resolutions[index].dmPelsHeight == height) pInfo->CurrentDisplayDevice->Resolutions[index].dmPelsHeight == height)
{ {
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_GEOSLIDER, IDC_GEOSLIDER,
TBM_SETPOS, TBM_SETPOS,
TRUE, TRUE,
index); index);
break; break;
} }
} }
if (LoadString(hInst, if (LoadStringW(hInst,
IDS_PIXEL, IDS_PIXEL,
Pixel, Pixel,
sizeof(Pixel) / sizeof(TCHAR))) sizeof(Pixel) / sizeof(WCHAR)))
{ {
_stprintf(Buffer, _swprintf(Buffer,
Pixel, Pixel,
width, width,
height, height,
Pixel); Pixel);
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_SETTINGS_RESOLUTION_TEXT, IDC_SETTINGS_RESOLUTION_TEXT,
WM_SETTEXT, WM_SETTEXT,
0, 0,
(LPARAM)Buffer); (LPARAM)Buffer);
} }
} }
} }
@ -697,7 +696,7 @@ FillResolutionsAndColors(PINFO pInfo)
static VOID static VOID
DisplayOnInit(PINFO pInfo) DisplayOnInit(PINFO pInfo)
{ {
DISPLAY_DEVICE displayDevice; DISPLAY_DEVICEW displayDevice;
DWORD iDevNum = 0; DWORD iDevNum = 0;
BOOL GotDev = FALSE; BOOL GotDev = FALSE;
@ -709,52 +708,52 @@ DisplayOnInit(PINFO pInfo)
0, 0,
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
pInfo->hRemote = LoadImage(hInst, pInfo->hRemote = LoadImageW(hInst,
MAKEINTRESOURCE(IDI_REMOTE), MAKEINTRESOURCEW(IDI_REMOTE),
IMAGE_ICON,
32,
32,
LR_DEFAULTCOLOR);
if (pInfo->hRemote)
{
SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_REMICON,
STM_SETICON,
(WPARAM)pInfo->hRemote,
0);
}
pInfo->hColor = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_COLORS),
IMAGE_ICON, IMAGE_ICON,
32, 32,
32, 32,
LR_DEFAULTCOLOR);
if (pInfo->hRemote)
{
SendDlgItemMessage(pInfo->hDisplayPage,
IDC_REMICON,
STM_SETICON,
(WPARAM)pInfo->hRemote,
0);
}
pInfo->hColor = LoadImage(hInst,
MAKEINTRESOURCE(IDI_COLORS),
IMAGE_ICON,
32,
32,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (pInfo->hColor) if (pInfo->hColor)
{ {
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_COLORSICON, IDC_COLORSICON,
STM_SETICON, STM_SETICON,
(WPARAM)pInfo->hColor, (WPARAM)pInfo->hColor,
0); 0);
} }
pInfo->hSpectrum = LoadImage(hInst, pInfo->hSpectrum = LoadImageW(hInst,
MAKEINTRESOURCE(IDB_SPECT), MAKEINTRESOURCEW(IDB_SPECT),
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0,
0, 0,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (pInfo->hSpectrum) if (pInfo->hSpectrum)
{ {
GetObject(pInfo->hSpectrum, GetObjectW(pInfo->hSpectrum,
sizeof(BITMAP), sizeof(BITMAP),
&pInfo->bitmap); &pInfo->bitmap);
} }
/* Get video cards list */ /* Get video cards list */
displayDevice.cb = (DWORD)sizeof(DISPLAY_DEVICE); displayDevice.cb = (DWORD)sizeof(DISPLAY_DEVICE);
while (EnumDisplayDevices(NULL, iDevNum, &displayDevice, 0x1)) while (EnumDisplayDevicesW(NULL, iDevNum, &displayDevice, 0x1))
{ {
if ((displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) != 0) if ((displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) != 0)
{ {
@ -774,25 +773,25 @@ DisplayOnInit(PINFO pInfo)
/* set color combo */ /* set color combo */
bpp = GetIntegerFromSettings(pInfo->pRdpSettings, L"session bpp"); bpp = GetIntegerFromSettings(pInfo->pRdpSettings, L"session bpp");
num = SendDlgItemMessage(pInfo->hDisplayPage, num = SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_GETCOUNT, CB_GETCOUNT,
0, 0,
0); 0);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
INT data = SendDlgItemMessage(pInfo->hDisplayPage, INT data = SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_GETITEMDATA, CB_GETITEMDATA,
i, i,
0); 0);
if (data == bpp) if (data == bpp)
{ {
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_SETCURSEL, CB_SETCURSEL,
i, i,
0); 0);
bSet = TRUE; bSet = TRUE;
break; break;
} }
@ -800,11 +799,11 @@ DisplayOnInit(PINFO pInfo)
if (!bSet) if (!bSet)
{ {
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_SETCURSEL, CB_SETCURSEL,
num - 1, num - 1,
0); 0);
} }
} }
} }
@ -816,8 +815,8 @@ DisplayDlgProc(HWND hDlg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
PINFO pInfo = (PINFO)GetWindowLongPtr(GetParent(hDlg), PINFO pInfo = (PINFO)GetWindowLongPtrW(GetParent(hDlg),
GWLP_USERDATA); GWLP_USERDATA);
switch (message) switch (message)
{ {
@ -866,7 +865,7 @@ DisplayDlgProc(HWND hDlg,
case TB_BOTTOM: case TB_BOTTOM:
case TB_ENDTRACK: case TB_ENDTRACK:
{ {
DWORD newPosition = (DWORD)SendDlgItemMessage(hDlg, IDC_GEOSLIDER, TBM_GETPOS, 0, 0); INT newPosition = (DWORD)SendDlgItemMessageW(hDlg, IDC_GEOSLIDER, TBM_GETPOS, 0, 0);
OnResolutionChanged(pInfo, newPosition); OnResolutionChanged(pInfo, newPosition);
break; break;
} }
@ -904,7 +903,7 @@ OnMainCreate(HWND hwnd,
PRDPSETTINGS pRdpSettings) PRDPSETTINGS pRdpSettings)
{ {
PINFO pInfo; PINFO pInfo;
TCITEM item; TCITEMW item;
BOOL bRet = FALSE; BOOL bRet = FALSE;
pInfo = HeapAlloc(GetProcessHeap(), pInfo = HeapAlloc(GetProcessHeap(),
@ -912,34 +911,36 @@ OnMainCreate(HWND hwnd,
sizeof(INFO)); sizeof(INFO));
if (pInfo) if (pInfo)
{ {
SetWindowLongPtr(hwnd, SetWindowLongPtrW(hwnd,
GWLP_USERDATA, GWLP_USERDATA,
(LONG_PTR)pInfo); (LONG_PTR)pInfo);
/* add main settings pointer */ /* add main settings pointer */
pInfo->pRdpSettings = pRdpSettings; pInfo->pRdpSettings = pRdpSettings;
pInfo->hHeader = (HBITMAP)LoadImage(hInst, pInfo->hHeader = (HBITMAP)LoadImageW(hInst,
MAKEINTRESOURCE(IDB_HEADER), MAKEINTRESOURCEW(IDB_HEADER),
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0,
0, 0,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (pInfo->hHeader) if (pInfo->hHeader)
{ {
GetObject(pInfo->hHeader, sizeof(BITMAP), &pInfo->headerbitmap); GetObjectW(pInfo->hHeader,
sizeof(BITMAP),
&pInfo->headerbitmap);
} }
pInfo->hTab = GetDlgItem(hwnd, IDC_TAB); pInfo->hTab = GetDlgItem(hwnd, IDC_TAB);
if (pInfo->hTab) if (pInfo->hTab)
{ {
if (CreateDialog(hInst, if (CreateDialogW(hInst,
MAKEINTRESOURCE(IDD_GENERAL), MAKEINTRESOURCEW(IDD_GENERAL),
hwnd, hwnd,
(DLGPROC)GeneralDlgProc)) (DLGPROC)GeneralDlgProc))
{ {
char str[256]; WCHAR str[256];
LoadString(hInst, IDS_TAB_GENERAL, str, 256); LoadStringW(hInst, IDS_TAB_GENERAL, str, 256);
ZeroMemory(&item, sizeof(TCITEM)); ZeroMemory(&item, sizeof(TCITEM));
item.mask = TCIF_TEXT; item.mask = TCIF_TEXT;
item.pszText = str; item.pszText = str;
@ -947,13 +948,13 @@ OnMainCreate(HWND hwnd,
(void)TabCtrl_InsertItem(pInfo->hTab, 0, &item); (void)TabCtrl_InsertItem(pInfo->hTab, 0, &item);
} }
if (CreateDialog(hInst, if (CreateDialogW(hInst,
MAKEINTRESOURCE(IDD_DISPLAY), MAKEINTRESOURCEW(IDD_DISPLAY),
hwnd, hwnd,
(DLGPROC)DisplayDlgProc)) (DLGPROC)DisplayDlgProc))
{ {
char str[256]; WCHAR str[256];
LoadString(hInst, IDS_TAB_DISPLAY, str, 256); LoadStringW(hInst, IDS_TAB_DISPLAY, str, 256);
ZeroMemory(&item, sizeof(TCITEM)); ZeroMemory(&item, sizeof(TCITEM));
item.mask = TCIF_TEXT; item.mask = TCIF_TEXT;
item.pszText = str; item.pszText = str;
@ -978,8 +979,8 @@ DlgProc(HWND hDlg,
PINFO pInfo; PINFO pInfo;
/* Get the window context */ /* Get the window context */
pInfo = (PINFO)GetWindowLongPtr(hDlg, pInfo = (PINFO)GetWindowLongPtrW(hDlg,
GWLP_USERDATA); GWLP_USERDATA);
if (pInfo == NULL && Message != WM_INITDIALOG) if (pInfo == NULL && Message != WM_INITDIALOG)
{ {
goto HandleDefaultMessage; goto HandleDefaultMessage;
@ -1004,13 +1005,6 @@ DlgProc(HWND hDlg,
EndDialog(hDlg, LOWORD(wParam)); EndDialog(hDlg, LOWORD(wParam));
} }
switch(LOWORD(wParam))
{
}
break;
} }
case WM_NOTIFY: case WM_NOTIFY:
@ -1032,7 +1026,7 @@ DlgProc(HWND hDlg,
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc, hdcMem; HDC hdc;
hdc = BeginPaint(hDlg, &ps); hdc = BeginPaint(hDlg, &ps);
if (hdc != NULL) if (hdc != NULL)
@ -1080,6 +1074,7 @@ HandleDefaultMessage:
return FALSE; return FALSE;
} }
BOOL BOOL
OpenRDPConnectDialog(HINSTANCE hInstance, OpenRDPConnectDialog(HINSTANCE hInstance,
PRDPSETTINGS pRdpSettings) PRDPSETTINGS pRdpSettings)
@ -1092,9 +1087,9 @@ OpenRDPConnectDialog(HINSTANCE hInstance,
iccx.dwICC = ICC_TAB_CLASSES; iccx.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&iccx); InitCommonControlsEx(&iccx);
return (DialogBoxParam(hInst, return (DialogBoxParamW(hInst,
MAKEINTRESOURCE(IDD_CONNECTDIALOG), MAKEINTRESOURCEW(IDD_CONNECTDIALOG),
NULL, NULL,
(DLGPROC)DlgProc, (DLGPROC)DlgProc,
pRdpSettings) == IDOK); (LPARAM)pRdpSettings) == IDOK);
} }

View file

@ -41,14 +41,14 @@
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="./;../../../.;../../../include;../../../include;../../../include/dxsdk;../../../include/ndk;../../../include/reactos;../../../include/reactos;../../../include/reactos/libs;..\..\..\obj-i386\include\reactos" AdditionalIncludeDirectories="./;../../../.;../../../include;../../../include;../../../include/dxsdk;../../../include/ndk;../../../include/reactos;../../../include/reactos;../../../include/reactos/libs;..\..\..\obj-i386\include\reactos"
PreprocessorDefinitions=";DBG=1;KDBG=1;STDCALL=__stdcall;_DEBUG;_LIB;_M_IX86;_SEH_ENABLE_TRACE;_WIN32_IE=0x600;_WIN32_WINNT=0x501;_X86_;__REACTOS__;__i386__" PreprocessorDefinitions="DBG=1;KDBG=1;STDCALL=__stdcall;_DEBUG;_LIB;_M_IX86;_SEH_ENABLE_TRACE;_WIN32_IE=0x600;_WIN32_WINNT=0x501;_X86_;__REACTOS__;__i386__;_CRT_SECURE_NO_DEPRECATE;UNICODE"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
RuntimeLibrary="1" RuntimeLibrary="1"
BufferSecurityCheck="false" BufferSecurityCheck="false"
EnableFunctionLevelLinking="false" EnableFunctionLevelLinking="false"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="4"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="4" DebugInformationFormat="4"
CallingConvention="0" CallingConvention="0"

View file

@ -1,6 +1,5 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <tchar.h>
#include <shlobj.h> #include <shlobj.h>
#include <todo.h> #include <todo.h>
#include "resource.h" #include "resource.h"
@ -64,7 +63,7 @@ SetStringToSettings(PRDPSETTINGS pRdpSettings,
{ {
if (pRdpSettings->pSettings[i].Type == L's') if (pRdpSettings->pSettings[i].Type == L's')
{ {
wcscpy(pRdpSettings->pSettings[i].Value.i, lpValue); wcscpy(pRdpSettings->pSettings[i].Value.s, lpValue);
bRet = TRUE; bRet = TRUE;
break; break;
} }
@ -184,7 +183,7 @@ ParseSettings(PRDPSETTINGS pRdpSettings,
WCHAR lpKey[MAXKEY]; WCHAR lpKey[MAXKEY];
WCHAR lpValue[MAXVALUE]; WCHAR lpValue[MAXVALUE];
INT NumSettings = 0; INT NumSettings = 0;
INT s, structsize; INT s;
if (lpStr) if (lpStr)
{ {
@ -213,7 +212,7 @@ ParseSettings(PRDPSETTINGS pRdpSettings,
for (s = 0; s < NumSettings; s++) for (s = 0; s < NumSettings; s++)
{ {
INT i = 0, k, temp; INT i = 0, k;
/* get a key */ /* get a key */
while (*lpStr != L':') while (*lpStr != L':')
@ -271,7 +270,7 @@ ParseSettings(PRDPSETTINGS pRdpSettings,
static LPWSTR static LPWSTR
ReadRdpFile(HANDLE hFile) ReadRdpFile(HANDLE hFile)
{ {
LPWSTR lpBuffer; LPWSTR lpBuffer = NULL;
DWORD BytesToRead, BytesRead; DWORD BytesToRead, BytesRead;
BOOL bRes; BOOL bRes;
@ -313,7 +312,7 @@ ReadRdpFile(HANDLE hFile)
static HANDLE static HANDLE
OpenRdpFile(LPWSTR path, BOOL bWrite) OpenRdpFile(LPWSTR path, BOOL bWrite)
{ {
HANDLE hFile; HANDLE hFile = NULL;
if (path) if (path)
{ {
@ -389,7 +388,7 @@ SaveRdpSettingsToFile(LPWSTR lpFile,
PRDPSETTINGS PRDPSETTINGS
LoadRdpSettingsFromFile(LPWSTR lpFile) LoadRdpSettingsFromFile(LPWSTR lpFile)
{ {
PRDPSETTINGS pRdpSettings; PRDPSETTINGS pRdpSettings = NULL;
WCHAR pszPath[MAX_PATH]; WCHAR pszPath[MAX_PATH];
HANDLE hFile; HANDLE hFile;