[ros-diffs] [gedmurphy] 30254: - convert dialog to unicode - fix /W4 warnings

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Nov 8 01:23:55 CET 2007


Author: gedmurphy
Date: Thu Nov  8 03:23:55 2007
New Revision: 30254

URL: http://svn.reactos.org/svn/reactos?rev=30254&view=rev
Log:
- convert dialog to unicode
- fix /W4 warnings

Modified:
    trunk/reactos/base/applications/mstsc/connectdialog.c
    trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj
    trunk/reactos/base/applications/mstsc/rdpfile.c

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

Modified: trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj?rev=30254&r1=30253&r2=30254&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj (original)
+++ trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj Thu Nov  8 03:23:55 2007
@@ -41,14 +41,14 @@
 				Optimization="0"
 				WholeProgramOptimization="false"
 				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"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="1"
 				BufferSecurityCheck="false"
 				EnableFunctionLevelLinking="false"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="4"
 				CallingConvention="0"

Modified: trunk/reactos/base/applications/mstsc/rdpfile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/rdpfile.c?rev=30254&r1=30253&r2=30254&view=diff
==============================================================================
--- trunk/reactos/base/applications/mstsc/rdpfile.c (original)
+++ trunk/reactos/base/applications/mstsc/rdpfile.c Thu Nov  8 03:23:55 2007
@@ -1,6 +1,5 @@
 #include <windows.h>
 #include <stdio.h>
-#include <tchar.h>
 #include <shlobj.h>
 #include <todo.h>
 #include "resource.h"
@@ -64,7 +63,7 @@
             {
                 if (pRdpSettings->pSettings[i].Type == L's')
                 {
-                    wcscpy(pRdpSettings->pSettings[i].Value.i, lpValue);
+                    wcscpy(pRdpSettings->pSettings[i].Value.s, lpValue);
                     bRet = TRUE;
                     break;
                 }
@@ -184,7 +183,7 @@
     WCHAR lpKey[MAXKEY];
     WCHAR lpValue[MAXVALUE];
     INT NumSettings = 0;
-    INT s, structsize;
+    INT s;
 
     if (lpStr)
     {
@@ -213,7 +212,7 @@
 
             for (s = 0; s < NumSettings; s++)
             {
-                INT i = 0, k, temp;
+                INT i = 0, k;
 
                 /* get a key */
                 while (*lpStr != L':')
@@ -271,7 +270,7 @@
 static LPWSTR
 ReadRdpFile(HANDLE hFile)
 {
-    LPWSTR lpBuffer;
+    LPWSTR lpBuffer = NULL;
     DWORD BytesToRead, BytesRead;
     BOOL bRes;
 
@@ -313,7 +312,7 @@
 static HANDLE
 OpenRdpFile(LPWSTR path, BOOL bWrite)
 {
-    HANDLE hFile;
+    HANDLE hFile = NULL;
 
     if (path)
     {
@@ -389,7 +388,7 @@
 PRDPSETTINGS
 LoadRdpSettingsFromFile(LPWSTR lpFile)
 {
-    PRDPSETTINGS pRdpSettings;
+    PRDPSETTINGS pRdpSettings = NULL;
     WCHAR pszPath[MAX_PATH];
     HANDLE hFile;
 




More information about the Ros-diffs mailing list