Author: gedmurphy Date: Thu Nov 8 18:29:23 2007 New Revision: 30274
URL: http://svn.reactos.org/svn/reactos?rev=30274&view=rev Log: - save all settings to memory when the connect button is hit - add some slightly hackish code to get the thing working. - you should now be able to connect to Windows machines using your choice of IP address, resolution and bpp.
Modified: trunk/reactos/base/applications/mstsc/connectdialog.c trunk/reactos/base/applications/mstsc/mstsc.rbuild trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj trunk/reactos/base/applications/mstsc/precomp.h trunk/reactos/base/applications/mstsc/settings.c trunk/reactos/base/applications/mstsc/win32.c
Modified: trunk/reactos/base/applications/mstsc/connectdialog.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/con... ============================================================================== --- trunk/reactos/base/applications/mstsc/connectdialog.c (original) +++ trunk/reactos/base/applications/mstsc/connectdialog.c Thu Nov 8 18:29:23 2007 @@ -20,63 +20,7 @@
#include <precomp.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. - */ -typedef struct _RESOLUTION_INFO -{ - DWORD dmPelsWidth; - DWORD dmPelsHeight; -} RESOLUTION_INFO, *PRESOLUTION_INFO; - -typedef struct _SETTINGS_ENTRY -{ - struct _SETTINGS_ENTRY *Blink; - struct _SETTINGS_ENTRY *Flink; - DWORD dmBitsPerPel; - DWORD dmPelsWidth; - DWORD dmPelsHeight; -} SETTINGS_ENTRY, *PSETTINGS_ENTRY; - -typedef struct _DISPLAY_DEVICE_ENTRY -{ - struct _DISPLAY_DEVICE_ENTRY *Flink; - LPWSTR DeviceDescription; - LPWSTR DeviceName; - LPWSTR DeviceKey; - LPWSTR DeviceID; - DWORD DeviceStateFlags; - PSETTINGS_ENTRY Settings; /* sorted by increasing dmPelsHeight, BPP */ - DWORD SettingsCount; - PRESOLUTION_INFO Resolutions; - DWORD ResolutionsCount; - PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */ - SETTINGS_ENTRY InitialSettings; -} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY; - -typedef struct _INFO -{ - PRDPSETTINGS pRdpSettings; - PDISPLAY_DEVICE_ENTRY DisplayDeviceList; - PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice; - HWND hSelf; - HWND hTab; - HWND hGeneralPage; - HWND hDisplayPage; - HBITMAP hHeader; - BITMAP headerbitmap; - HICON hMstscSm; - HICON hMstscLg; - HICON hLogon; - HICON hConn; - HICON hRemote; - HICON hColor; - HBITMAP hSpectrum; - BITMAP bitmap; -} INFO, *PINFO;
HINSTANCE hInst;
@@ -560,15 +504,6 @@ WM_SETTEXT, 0, (LPARAM)Buffer); - - /* save new settings */ - SetIntegerToSettings(pInfo->pRdpSettings, - L"desktopwidth", - pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth); - SetIntegerToSettings(pInfo->pRdpSettings, - L"desktopheight", - pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight); - }
@@ -1039,6 +974,11 @@ { if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + if (LOWORD(wParam) == IDOK ) + { + SaveAllSettings(pInfo); + } + if (pInfo) { HeapFree(GetProcessHeap(),
Modified: trunk/reactos/base/applications/mstsc/mstsc.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/mst... ============================================================================== --- trunk/reactos/base/applications/mstsc/mstsc.rbuild (original) +++ trunk/reactos/base/applications/mstsc/mstsc.rbuild Thu Nov 8 18:29:23 2007 @@ -26,8 +26,8 @@ <file>pstcache.c</file> <file>rdp5.c</file> <file>rdp.c</file> - <file>rdpfile.c</file> <file>secure.c</file> + <file>settings.c</file> <file>ssl_calls.c</file> <file>tcp.c</file> <file>uimain.c</file>
Modified: trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/mst... ============================================================================== --- trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj (original) +++ trunk/reactos/base/applications/mstsc/mstsc_vc8_auto.vcproj Thu Nov 8 18:29:23 2007 @@ -48,7 +48,7 @@ BufferSecurityCheck="false" EnableFunctionLevelLinking="false" UsePrecompiledHeader="0" - WarningLevel="4" + WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="4" CallingConvention="0" @@ -605,11 +605,11 @@ > </File> <File - RelativePath=".\rdpfile.c" - > - </File> - <File RelativePath=".\secure.c" + > + </File> + <File + RelativePath=".\settings.c" > </File> <File @@ -633,10 +633,6 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl" > - <File - RelativePath=".\todo.h" - > - </File> </Filter> <Filter Name="Resource Files"
Modified: trunk/reactos/base/applications/mstsc/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/pre... ============================================================================== --- trunk/reactos/base/applications/mstsc/precomp.h (original) +++ trunk/reactos/base/applications/mstsc/precomp.h Thu Nov 8 18:29:23 2007 @@ -17,6 +17,8 @@ #define MAXKEY 256 #define MAXVALUE 256
+extern LPWSTR lpSettings[]; + typedef struct _SETTINGS { WCHAR Key[MAXKEY]; @@ -33,6 +35,61 @@ INT NumSettings; } RDPSETTINGS, *PRDPSETTINGS;
+/* As slider control can't contain user data, we have to keep an + * array of RESOLUTION_INFO to have our own associated data. + */ +typedef struct _RESOLUTION_INFO +{ + DWORD dmPelsWidth; + DWORD dmPelsHeight; +} RESOLUTION_INFO, *PRESOLUTION_INFO; + +typedef struct _SETTINGS_ENTRY +{ + struct _SETTINGS_ENTRY *Blink; + struct _SETTINGS_ENTRY *Flink; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; +} SETTINGS_ENTRY, *PSETTINGS_ENTRY; + +typedef struct _DISPLAY_DEVICE_ENTRY +{ + struct _DISPLAY_DEVICE_ENTRY *Flink; + LPWSTR DeviceDescription; + LPWSTR DeviceName; + LPWSTR DeviceKey; + LPWSTR DeviceID; + DWORD DeviceStateFlags; + PSETTINGS_ENTRY Settings; /* sorted by increasing dmPelsHeight, BPP */ + DWORD SettingsCount; + PRESOLUTION_INFO Resolutions; + DWORD ResolutionsCount; + PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */ + SETTINGS_ENTRY InitialSettings; +} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY; + +typedef struct _INFO +{ + PRDPSETTINGS pRdpSettings; + PDISPLAY_DEVICE_ENTRY DisplayDeviceList; + PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice; + HWND hSelf; + HWND hTab; + HWND hGeneralPage; + HWND hDisplayPage; + HBITMAP hHeader; + BITMAP headerbitmap; + HICON hMstscSm; + HICON hMstscLg; + HICON hLogon; + HICON hConn; + HICON hRemote; + HICON hColor; + HBITMAP hSpectrum; + BITMAP bitmap; +} INFO, *PINFO; + BOOL OpenRDPConnectDialog(HINSTANCE hInstance, PRDPSETTINGS pRdpSettings); PRDPSETTINGS LoadRdpSettingsFromFile(LPWSTR lpFile); BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings); @@ -40,6 +97,7 @@ LPWSTR GetStringFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue); BOOL SetIntegerToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, INT Value); BOOL SetStringToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, LPWSTR lpValue); +VOID SaveAllSettings(PINFO pInfo);
#endif /* __TODO_MSTSC_H */
Modified: trunk/reactos/base/applications/mstsc/settings.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/set... ============================================================================== --- trunk/reactos/base/applications/mstsc/settings.c (original) +++ trunk/reactos/base/applications/mstsc/settings.c Thu Nov 8 18:29:23 2007 @@ -2,7 +2,7 @@ #include <precomp.h>
#define NUM_SETTINGS 6 -LPWSTR lpSettings[NUM_SETTINGS] = +LPWSTR lpSettings[NUM_SETTINGS] = { L"screen mode id", L"desktopwidth", @@ -12,6 +12,61 @@ L"compression", };
+VOID +SaveAllSettings(PINFO pInfo) +{ + INT ret; + WCHAR szKey[MAXKEY]; + WCHAR szValue[MAXVALUE]; + + /* server */ + if (GetDlgItemText(pInfo->hGeneralPage, + IDC_SERVERCOMBO, + szValue, + MAXVALUE)) + { + SetStringToSettings(pInfo->pRdpSettings, + L"full address", + szValue); + } + + /* resolution */ + ret = SendDlgItemMessage(pInfo->hDisplayPage, + IDC_GEOSLIDER, + TBM_GETPOS, + 0, + 0); + if (ret != -1) + { + SetIntegerToSettings(pInfo->pRdpSettings, + L"desktopwidth", + pInfo->DisplayDeviceList->Resolutions[ret].dmPelsWidth); + SetIntegerToSettings(pInfo->pRdpSettings, + L"desktopheight", + pInfo->DisplayDeviceList->Resolutions[ret].dmPelsHeight); + } + + /* bpp */ + ret = SendDlgItemMessage(pInfo->hDisplayPage, + IDC_BPPCOMBO, + CB_GETCURSEL, + 0, + 0); + if (ret != CB_ERR) + { + ret = SendDlgItemMessage(pInfo->hDisplayPage, + IDC_BPPCOMBO, + CB_GETITEMDATA, + ret, + 0); + if (ret != CB_ERR) + { + SetIntegerToSettings(pInfo->pRdpSettings, + L"session bpp", + ret); + } + } +}
BOOL
Modified: trunk/reactos/base/applications/mstsc/win32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/win... ============================================================================== --- trunk/reactos/base/applications/mstsc/win32.c (original) +++ trunk/reactos/base/applications/mstsc/win32.c Thu Nov 8 18:29:23 2007 @@ -20,6 +20,10 @@
#include <winsock2.h> /* winsock2.h first */ #include <precomp.h> + +//FIXME: remove eventually +#define _UNICODE +#include <tchar.h>
extern char g_username[]; @@ -69,6 +73,21 @@ int i;
len = strlen(size1); + for (i = 0; i < len; i++) + { + sizex[i] = size1[i]; + } + sizex[len] = 0; +} + +/*****************************************************************************/ +static void +uni_to_str(char * sizex, TCHAR * size1) +{ + int len; + int i; + + len = _tcslen(size1); for (i = 0; i < len; i++) { sizex[i] = size1[i]; @@ -1290,13 +1309,18 @@ if (OpenRDPConnectDialog(hInstance, pRdpSettings)) { - strcpy(g_servername, "192.168.40.50"); + char szValue[MAXVALUE]; + + uni_to_str(szValue, GetStringFromSettings(pRdpSettings, L"full address")); + + strcpy(g_servername, szValue); //g_port = 3389; - strcpy(g_username, "buildbot"); - strcpy(g_password, "P4ssw0rd"); - g_server_depth = 16; - g_width = 800; - g_height = 600; + strcpy(g_username, ""); + strcpy(g_password, ""); + g_server_depth = GetIntegerFromSettings(pRdpSettings, L"session bpp"); + if (g_server_depth > 16) g_server_depth = 16; /* hack, we don't support 24bpp yet */ + g_width = GetIntegerFromSettings(pRdpSettings, L"desktopwidth"); + g_height = GetIntegerFromSettings(pRdpSettings, L"desktopheight"); g_screen_width = GetSystemMetrics(SM_CXSCREEN); g_screen_height = GetSystemMetrics(SM_CYSCREEN); g_xoff = GetSystemMetrics(SM_CXEDGE) * 2;