mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 00:13:57 +00:00
- 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. svn path=/trunk/; revision=30274
This commit is contained in:
parent
d5b90c8416
commit
78cf4e67ec
|
@ -20,64 +20,8 @@
|
|||
|
||||
#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;
|
||||
|
||||
static VOID
|
||||
|
@ -560,15 +504,6 @@ OnResolutionChanged(PINFO pInfo, INT position)
|
|||
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 @@ DlgProc(HWND hDlg,
|
|||
{
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
if (LOWORD(wParam) == IDOK )
|
||||
{
|
||||
SaveAllSettings(pInfo);
|
||||
}
|
||||
|
||||
if (pInfo)
|
||||
{
|
||||
HeapFree(GetProcessHeap(),
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
RelativePath=".\secure.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\secure.c"
|
||||
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"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#define MAXKEY 256
|
||||
#define MAXVALUE 256
|
||||
|
||||
extern LPWSTR lpSettings[];
|
||||
|
||||
typedef struct _SETTINGS
|
||||
{
|
||||
WCHAR Key[MAXKEY];
|
||||
|
@ -33,6 +35,61 @@ typedef struct _RDPSETTINGS
|
|||
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 @@ INT GetIntegerFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue);
|
|||
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 */
|
||||
|
|
|
@ -12,6 +12,61 @@ LPWSTR lpSettings[NUM_SETTINGS] =
|
|||
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
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#include <winsock2.h> /* winsock2.h first */
|
||||
#include <precomp.h>
|
||||
|
||||
//FIXME: remove eventually
|
||||
#define _UNICODE
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
extern char g_username[];
|
||||
extern char g_hostname[];
|
||||
|
@ -76,6 +80,21 @@ str_to_uni(TCHAR * sizex, char * size1)
|
|||
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];
|
||||
}
|
||||
sizex[len] = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns non zero if it processed something */
|
||||
static int
|
||||
|
@ -1290,13 +1309,18 @@ wWinMain(HINSTANCE hInstance,
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue