Author: gedmurphy
Date: Wed Nov 7 17:59:43 2007
New Revision: 30242
URL:
http://svn.reactos.org/svn/reactos?rev=30242&view=rev
Log:
initialize the main settings settings struct earlier as we'll need it to outside of
the dialog
Modified:
trunk/reactos/base/applications/mstsc/connectdialog.c
trunk/reactos/base/applications/mstsc/todo.h
trunk/reactos/base/applications/mstsc/uimain.h
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/co…
==============================================================================
--- trunk/reactos/base/applications/mstsc/connectdialog.c (original)
+++ trunk/reactos/base/applications/mstsc/connectdialog.c Wed Nov 7 17:59:43 2007
@@ -900,7 +900,8 @@
static BOOL
-OnMainCreate(HWND hwnd)
+OnMainCreate(HWND hwnd,
+ PRDPSETTINGS pRdpSettings)
{
PINFO pInfo;
TCITEM item;
@@ -915,10 +916,8 @@
GWLP_USERDATA,
(LONG_PTR)pInfo);
- /* read the default .rdp file */
- pInfo->pRdpSettings = LoadRdpSettingsFromFile(NULL);
- if (!pInfo->pRdpSettings)
- return FALSE;
+ /* add main settings pointer */
+ pInfo->pRdpSettings = pRdpSettings;
pInfo->hHeader = (HBITMAP)LoadImage(hInst,
MAKEINTRESOURCE(IDB_HEADER),
@@ -989,7 +988,7 @@
switch(Message)
{
case WM_INITDIALOG:
- OnMainCreate(hDlg);
+ OnMainCreate(hDlg, (PRDPSETTINGS)lParam);
break;
case WM_COMMAND:
@@ -1064,20 +1063,6 @@
{
if (pInfo)
{
- if (pInfo->pRdpSettings)
- {
- if (pInfo->pRdpSettings->pSettings)
- {
- HeapFree(GetProcessHeap(),
- 0,
- pInfo->pRdpSettings->pSettings);
- }
-
- HeapFree(GetProcessHeap(),
- 0,
- pInfo->pRdpSettings);
- }
-
HeapFree(GetProcessHeap(),
0,
pInfo);
@@ -1096,7 +1081,8 @@
}
BOOL
-OpenRDPConnectDialog(HINSTANCE hInstance)
+OpenRDPConnectDialog(HINSTANCE hInstance,
+ PRDPSETTINGS pRdpSettings)
{
INITCOMMONCONTROLSEX iccx;
@@ -1106,8 +1092,9 @@
iccx.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&iccx);
- return (DialogBox(hInst,
- MAKEINTRESOURCE(IDD_CONNECTDIALOG),
- NULL,
- (DLGPROC)DlgProc) == IDOK);
-}
+ return (DialogBoxParam(hInst,
+ MAKEINTRESOURCE(IDD_CONNECTDIALOG),
+ NULL,
+ (DLGPROC)DlgProc,
+ pRdpSettings) == IDOK);
+}
Modified: trunk/reactos/base/applications/mstsc/todo.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/to…
==============================================================================
--- trunk/reactos/base/applications/mstsc/todo.h (original)
+++ trunk/reactos/base/applications/mstsc/todo.h Wed Nov 7 17:59:43 2007
@@ -17,7 +17,7 @@
INT NumSettings;
} RDPSETTINGS, *PRDPSETTINGS;
-
+BOOL OpenRDPConnectDialog(HINSTANCE hInstance, PRDPSETTINGS pRdpSettings);
PRDPSETTINGS LoadRdpSettingsFromFile(LPWSTR lpFile);
BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings);
INT GetIntegerFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue);
Modified: trunk/reactos/base/applications/mstsc/uimain.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/ui…
==============================================================================
--- trunk/reactos/base/applications/mstsc/uimain.h (original)
+++ trunk/reactos/base/applications/mstsc/uimain.h Wed Nov 7 17:59:43 2007
@@ -74,7 +74,3 @@
#define UI_MAX(a, b) (((a) > (b)) ? (a) : (b))
#undef UI_MIN
#define UI_MIN(a, b) (((a) < (b)) ? (a) : (b))
-
-/* in connectdialog.c */
-BOOL OpenRDPConnectDialog();
-
Modified: trunk/reactos/base/applications/mstsc/win32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/wi…
==============================================================================
--- trunk/reactos/base/applications/mstsc/win32.c (original)
+++ trunk/reactos/base/applications/mstsc/win32.c Wed Nov 7 17:59:43 2007
@@ -23,6 +23,7 @@
#include <winuser.h>
#include <stdio.h>
#include "uimain.h"
+#include "todo.h"
#include "resource.h"
extern char g_username[];
@@ -1290,24 +1291,40 @@
#else /* WITH_DEBUG */
/*****************************************************************************/
int WINAPI
-WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPTSTR lpCmdLine, int nCmdShow)
-{
- WSADATA d;
- int ret = 1;
-
- WSAStartup(MAKEWORD(2, 0), &d);
-
- //if (mi_process_cl(lpCmdLine))
- //{
- if (OpenRDPConnectDialog(hInstance))
- {
- ui_main();
- ret = 0;
- }
- //}
-
- WSACleanup();
+WinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPTSTR lpCmdLine,
+ int nCmdShow)
+{
+ PRDPSETTINGS pRdpSettings;
+ WSADATA d;
+ int ret = 1;
+
+ if (WSAStartup(MAKEWORD(2, 0), &d) == 0)
+ {
+ pRdpSettings = LoadRdpSettingsFromFile(NULL);
+
+ if (pRdpSettings)
+ {
+ //mi_process_cl(lpCmdLine)
+ if (OpenRDPConnectDialog(hInstance,
+ pRdpSettings))
+ {
+ ui_main();
+ ret = 0;
+ }
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ pRdpSettings->pSettings);
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ pRdpSettings);
+ }
+
+ WSACleanup();
+ }
return ret;
}