Author: gedmurphy
Date: Mon Nov 5 19:29:20 2007
New Revision: 30185
URL:
http://svn.reactos.org/svn/reactos?rev=30185&view=rev
Log:
Check the registry for previous servers and fill the combobox with them.
Modified:
trunk/reactos/base/applications/mstsc/connectdialog.c
trunk/reactos/base/applications/mstsc/lang/en-US.rc
trunk/reactos/base/applications/mstsc/resource.h
Modified: trunk/reactos/base/applications/mstsc/connectdialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/co…
==============================================================================
--- trunk/reactos/base/applications/mstsc/connectdialog.c (original)
+++ trunk/reactos/base/applications/mstsc/connectdialog.c Mon Nov 5 19:29:20 2007
@@ -23,6 +23,8 @@
#include <stdio.h>
#include <tchar.h>
#include "resource.h"
+
+#define MAX_KEY_NAME 255
/* As slider control can't contain user data, we have to keep an
* array of RESOLUTION_INFO to have our own associated data.
@@ -96,6 +98,84 @@
}
}
+static VOID
+FillServerAddesssCombo(PINFO pInfo)
+{
+ HKEY hKey;
+ TCHAR KeyName[] = _T("Software\\Microsoft\\Terminal Server
Client\\Default");
+ TCHAR 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)
+ {
+ while (ret == ERROR_SUCCESS)
+ {
+ size = MAX_KEY_NAME;
+ ret = RegEnumValue(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)
+ {
+ LPTSTR lpAddress = HeapAlloc(GetProcessHeap(),
+ 0,
+ size);
+ if (lpAddress)
+ {
+ if (RegQueryValueEx(hKey,
+ Name,
+ 0,
+ NULL,
+ lpAddress,
+ &size) == ERROR_SUCCESS)
+ {
+ SendDlgItemMessage(pInfo->hGeneralPage,
+ IDC_SERVERCOMBO,
+ CB_ADDSTRING,
+ 0,
+ lpAddress);
+ }
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ lpAddress);
+ }
+ }
+ }
+
+ i++;
+ }
+ }
+
+ if (LoadString(hInst,
+ IDS_BROWSESERVER,
+ Name,
+ sizeof(Name) / sizeof(TCHAR)))
+ {
+ SendDlgItemMessage(pInfo->hGeneralPage, IDC_SERVERCOMBO, CB_ADDSTRING, 0,
Name);
+ }
+}
+
+
+
static VOID
GeneralOnInit(PINFO pInfo)
@@ -109,11 +189,11 @@
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
pInfo->hLogon = LoadImage(hInst,
- MAKEINTRESOURCE(IDI_LOGON),
- IMAGE_ICON,
- 32,
- 32,
- LR_DEFAULTCOLOR);
+ MAKEINTRESOURCE(IDI_LOGON),
+ IMAGE_ICON,
+ 32,
+ 32,
+ LR_DEFAULTCOLOR);
if (pInfo->hLogon)
{
SendDlgItemMessage(pInfo->hGeneralPage,
@@ -138,9 +218,7 @@
0);
}
- SetDlgItemText(pInfo->hGeneralPage,
- IDC_SERVERCOMBO,
- g_servername);
+ FillServerAddesssCombo(pInfo);
}
Modified: trunk/reactos/base/applications/mstsc/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/la…
==============================================================================
--- trunk/reactos/base/applications/mstsc/lang/en-US.rc (original)
+++ trunk/reactos/base/applications/mstsc/lang/en-US.rc Mon Nov 5 19:29:20 2007
@@ -12,7 +12,7 @@
LTEXT "Enter the server address",IDC_STATIC,47,24,81,8
LTEXT "Server:",IDC_STATIC,47,41,25,8
LTEXT "User name:",IDC_STATIC,47,58,38,8
- COMBOBOX IDC_SERVERCOMBO,79,39,141,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL |
WS_TABSTOP
+ COMBOBOX IDC_SERVERCOMBO,79,39,141,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Save",IDC_SAVE,67,139,50,14
PUSHBUTTON "SaveAs...",IDC_SAVEAS,123,139,50,14
PUSHBUTTON "Open...",IDC_OPEN,177,139,50,14
@@ -59,4 +59,5 @@
IDS_HIGHCOLOR24 "True Color (24 bit)"
IDS_PIXEL "%lux%lu Pixels"
IDS_FULLSCREEN "Full Screen"
+ IDS_BROWSESERVER "<Browse for more...>"
END
Modified: trunk/reactos/base/applications/mstsc/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/re…
==============================================================================
--- trunk/reactos/base/applications/mstsc/resource.h (original)
+++ trunk/reactos/base/applications/mstsc/resource.h Mon Nov 5 19:29:20 2007
@@ -32,6 +32,7 @@
#define IDS_TAB_GENERAL 3001
#define IDS_PIXEL 3006
#define IDS_FULLSCREEN 3007
+#define IDS_BROWSESERVER 3008
#define IDS_256COLORS 4000
#define IDS_HIGHCOLOR15 4001