ReactOS  0.4.14-dev-41-g31d7680
connectdialog.c File Reference
#include "precomp.h"
#include <winreg.h>
#include <commdlg.h>
Include dependency graph for connectdialog.c:

Go to the source code of this file.

Macros

#define MAX_KEY_NAME   255
 

Functions

static VOID ReLoadGeneralPage (PINFO pInfo)
 
static VOID ReLoadDisplayPage (PINFO pInfo)
 
static VOID DoOpenFile (PINFO pInfo)
 
static VOID DoSaveAs (PINFO pInfo)
 
static VOID OnTabWndSelChange (PINFO pInfo)
 
static VOID LoadUsernameHint (HWND hDlg, INT iCur)
 
static VOID FillServerAddressCombo (PINFO pInfo)
 
static VOID GeneralOnInit (HWND hwnd, PINFO pInfo)
 
INT_PTR CALLBACK GeneralDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
static PSETTINGS_ENTRY GetPossibleSettings (IN LPCWSTR lpDeviceName, OUT DWORD *pSettingsCount, OUT PSETTINGS_ENTRY *CurrentSettings)
 
static BOOL AddDisplayDevice (PINFO pInfo, PDISPLAY_DEVICEW DisplayDevice)
 
static VOID OnResolutionChanged (PINFO pInfo, INT position)
 
static VOID FillResolutionsAndColors (PINFO pInfo)
 
static VOID DisplayOnInit (HWND hwnd, PINFO pInfo)
 
INT_PTR CALLBACK DisplayDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
static BOOL OnMainCreate (HWND hwnd, PRDPSETTINGS pRdpSettings)
 
static void Cleanup (PINFO pInfo)
 
static INT_PTR CALLBACK DlgProc (HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
 
BOOL OpenRDPConnectDialog (HINSTANCE hInstance, PRDPSETTINGS pRdpSettings)
 

Variables

HINSTANCE hInst
 

Macro Definition Documentation

◆ MAX_KEY_NAME

#define MAX_KEY_NAME   255

Definition at line 26 of file connectdialog.c.

Function Documentation

◆ AddDisplayDevice()

static BOOL AddDisplayDevice ( PINFO  pInfo,
PDISPLAY_DEVICEW  DisplayDevice 
)
static

Definition at line 501 of file connectdialog.c.

502 {
503  PDISPLAY_DEVICE_ENTRY newEntry = NULL;
505  LPWSTR name = NULL;
506  LPWSTR key = NULL;
507  LPWSTR devid = NULL;
508  SIZE_T descriptionSize, nameSize, keySize, devidSize;
509  PSETTINGS_ENTRY Current;
510  DWORD ResolutionsCount = 1;
511  DWORD i;
512 
513  newEntry = HeapAlloc(GetProcessHeap(),
514  0,
515  sizeof(DISPLAY_DEVICE_ENTRY));
516  if (!newEntry) goto ByeBye;
517  ZeroMemory(newEntry, sizeof(DISPLAY_DEVICE_ENTRY));
518 
519  newEntry->Settings = GetPossibleSettings(DisplayDevice->DeviceName,
520  &newEntry->SettingsCount,
521  &newEntry->CurrentSettings);
522  if (!newEntry->Settings) goto ByeBye;
523 
527 
528  /* Count different resolutions */
529  for (Current = newEntry->Settings; Current != NULL; Current = Current->Flink)
530  {
531  if (Current->Flink != NULL &&
532  ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
533  (Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
534  {
535  ResolutionsCount++;
536  }
537  }
538 
539  newEntry->Resolutions = HeapAlloc(GetProcessHeap(),
540  0,
541  ResolutionsCount * (sizeof(RESOLUTION_INFO) + 1));
542  if (!newEntry->Resolutions) goto ByeBye;
543 
544  newEntry->ResolutionsCount = ResolutionsCount;
545 
546  /* Fill resolutions infos */
547  for (Current = newEntry->Settings, i = 0; Current != NULL; Current = Current->Flink)
548  {
549  if (Current->Flink == NULL ||
550  (Current->Flink != NULL &&
551  ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
552  (Current->dmPelsHeight != Current->Flink->dmPelsHeight))))
553  {
554  newEntry->Resolutions[i].dmPelsWidth = Current->dmPelsWidth;
555  newEntry->Resolutions[i].dmPelsHeight = Current->dmPelsHeight;
556  i++;
557  }
558  }
559 
560  /* fullscreen */
563 
564  descriptionSize = (wcslen(DisplayDevice->DeviceString) + 1) * sizeof(WCHAR);
565  description = HeapAlloc(GetProcessHeap(), 0, descriptionSize);
566  if (!description) goto ByeBye;
567 
568  nameSize = (wcslen(DisplayDevice->DeviceName) + 1) * sizeof(WCHAR);
569  name = HeapAlloc(GetProcessHeap(), 0, nameSize);
570  if (!name) goto ByeBye;
571 
572  keySize = (wcslen(DisplayDevice->DeviceKey) + 1) * sizeof(WCHAR);
573  key = HeapAlloc(GetProcessHeap(), 0, keySize);
574  if (!key) goto ByeBye;
575 
576  devidSize = (wcslen(DisplayDevice->DeviceID) + 1) * sizeof(WCHAR);
577  devid = HeapAlloc(GetProcessHeap(), 0, devidSize);
578  if (!devid) goto ByeBye;
579 
580  memcpy(description, DisplayDevice->DeviceString, descriptionSize);
581  memcpy(name, DisplayDevice->DeviceName, nameSize);
582  memcpy(key, DisplayDevice->DeviceKey, keySize);
583  memcpy(devid, DisplayDevice->DeviceID, devidSize);
584  newEntry->DeviceDescription = description;
585  newEntry->DeviceName = name;
586  newEntry->DeviceKey = key;
587  newEntry->DeviceID = devid;
588  newEntry->DeviceStateFlags = DisplayDevice->StateFlags;
589  newEntry->Flink = pInfo->DisplayDeviceList;
590  pInfo->DisplayDeviceList = newEntry;
591  return TRUE;
592 
593 ByeBye:
594  if (newEntry != NULL)
595  {
596  if (newEntry->Settings != NULL)
597  {
598  Current = newEntry->Settings;
599  while (Current != NULL)
600  {
601  PSETTINGS_ENTRY Next = Current->Flink;
602  HeapFree(GetProcessHeap(), 0, Current);
603  Current = Next;
604  }
605  }
606  if (newEntry->Resolutions != NULL)
607  HeapFree(GetProcessHeap(), 0, newEntry->Resolutions);
608  HeapFree(GetProcessHeap(), 0, newEntry);
609  }
610  if (description != NULL)
612  if (name != NULL)
614  if (key != NULL)
615  HeapFree(GetProcessHeap(), 0, key);
616  if (devid != NULL)
617  HeapFree(GetProcessHeap(), 0, devid);
618  return FALSE;
619 }
PSETTINGS_ENTRY CurrentSettings
Definition: precomp.h:79
#define TRUE
Definition: types.h:120
LPWSTR DeviceKey
Definition: precomp.h:72
SETTINGS_ENTRY InitialSettings
Definition: precomp.h:80
struct _DISPLAY_DEVICE_ENTRY * Flink
Definition: precomp.h:69
WCHAR DeviceString[128]
Definition: wingdi.h:2814
DWORD dmPelsWidth
Definition: precomp.h:63
Definition: precomp.h:67
#define ZeroMemory
Definition: winbase.h:1635
LPWSTR DeviceName
Definition: precomp.h:71
DWORD dmBitsPerPel
Definition: precomp.h:62
const char * description
Definition: directx.c:2497
PDISPLAY_DEVICE_ENTRY DisplayDeviceList
Definition: precomp.h:86
WCHAR DeviceName[32]
Definition: wingdi.h:2813
#define SM_CXSCREEN
Definition: winuser.h:949
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WCHAR DeviceID[128]
Definition: wingdi.h:2816
PSETTINGS_ENTRY Settings
Definition: precomp.h:75
smooth NULL
Definition: ftsmooth.c:416
#define SM_CYSCREEN
Definition: winuser.h:950
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD StateFlags
Definition: wingdi.h:2815
HKEY key
Definition: reg.c:42
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD DeviceStateFlags
Definition: precomp.h:74
WCHAR DeviceKey[128]
Definition: wingdi.h:2817
DWORD dmPelsWidth
Definition: precomp.h:54
LPWSTR DeviceID
Definition: precomp.h:73
PRESOLUTION_INFO Resolutions
Definition: precomp.h:77
DWORD dmPelsHeight
Definition: precomp.h:55
ULONG_PTR SIZE_T
Definition: typedefs.h:78
DWORD SettingsCount
Definition: precomp.h:76
DWORD ResolutionsCount
Definition: precomp.h:78
DWORD dmPelsHeight
Definition: precomp.h:64
Definition: name.c:36
static PSETTINGS_ENTRY GetPossibleSettings(IN LPCWSTR lpDeviceName, OUT DWORD *pSettingsCount, OUT PSETTINGS_ENTRY *CurrentSettings)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR DeviceDescription
Definition: precomp.h:70
Definition: precomp.h:58
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
struct _SETTINGS_ENTRY * Flink
Definition: precomp.h:61
Definition: path.c:42
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by DisplayOnInit().

◆ Cleanup()

static void Cleanup ( PINFO  pInfo)
static

Definition at line 1122 of file connectdialog.c.

1123 {
1124  if (pInfo)
1125  {
1126  if (pInfo->hMstscSm)
1127  DestroyIcon(pInfo->hMstscSm);
1128  if (pInfo->hMstscLg)
1129  DestroyIcon(pInfo->hMstscLg);
1130  if (pInfo->hHeader)
1131  DeleteObject(pInfo->hHeader);
1132  if (pInfo->hSpectrum)
1133  DeleteObject(pInfo->hSpectrum);
1134  if (pInfo->hRemote)
1135  DestroyIcon(pInfo->hRemote);
1136  if (pInfo->hLogon)
1137  DestroyIcon(pInfo->hLogon);
1138  if (pInfo->hConn)
1139  DestroyIcon(pInfo->hConn);
1140  if (pInfo->hColor)
1141  DestroyIcon(pInfo->hColor);
1143  0,
1144  pInfo);
1145  }
1146 }
HICON hMstscSm
Definition: precomp.h:94
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
HICON hLogon
Definition: precomp.h:96
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HICON hColor
Definition: precomp.h:99
HICON hRemote
Definition: precomp.h:98
HICON hMstscLg
Definition: precomp.h:95
HICON hConn
Definition: precomp.h:97
#define GetProcessHeap()
Definition: compat.h:395
HBITMAP hSpectrum
Definition: precomp.h:100
HBITMAP hHeader
Definition: precomp.h:92
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DlgProc().

◆ DisplayDlgProc()

INT_PTR CALLBACK DisplayDlgProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 930 of file connectdialog.c.

934 {
935  PINFO pInfo = (PINFO)GetWindowLongPtrW(hDlg,
936  GWLP_USERDATA);
937 
938  switch (message)
939  {
940  case WM_INITDIALOG:
941  DisplayOnInit(hDlg, (PINFO)lParam);
942  return TRUE;
943 
944  case WM_DRAWITEM:
945  {
946  LPDRAWITEMSTRUCT lpDrawItem;
947  lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
948  if(lpDrawItem->CtlID == IDC_COLORIMAGE)
949  {
950  HDC hdcMem;
951  HBITMAP hSpecOld;
952  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
953  if (hdcMem != NULL)
954  {
955  hSpecOld = SelectObject(hdcMem, pInfo->hSpectrum);
956  StretchBlt(lpDrawItem->hDC,
957  lpDrawItem->rcItem.left,
958  lpDrawItem->rcItem.top,
959  lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
960  lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
961  hdcMem,
962  0,
963  0,
964  pInfo->bitmap.bmWidth,
965  pInfo->bitmap.bmHeight,
966  SRCCOPY);
967  SelectObject(hdcMem, hSpecOld);
968  DeleteDC(hdcMem);
969  }
970  }
971  break;
972  }
973 
974  case WM_HSCROLL:
975  {
976  switch (LOWORD(wParam))
977  {
978  case TB_LINEUP:
979  case TB_LINEDOWN:
980  case TB_PAGEUP:
981  case TB_PAGEDOWN:
982  case TB_TOP:
983  case TB_BOTTOM:
984  case TB_ENDTRACK:
985  {
986  INT newPosition = (DWORD)SendDlgItemMessageW(hDlg, IDC_GEOSLIDER, TBM_GETPOS, 0, 0);
987  OnResolutionChanged(pInfo, newPosition);
988  break;
989  }
990 
991  case TB_THUMBTRACK:
993  break;
994  }
995  break;
996  }
997 
998  case WM_CLOSE:
999  {
1000  if (pInfo->hRemote)
1001  DestroyIcon(pInfo->hRemote);
1002 
1003  if (pInfo->hColor)
1004  DestroyIcon(pInfo->hColor);
1005 
1006  if (pInfo->hSpectrum)
1007  DeleteObject(pInfo->hSpectrum);
1008 
1009  break;
1010  }
1011 
1012  break;
1013  }
1014  return 0;
1015 }
#define TB_THUMBTRACK
Definition: commctrl.h:2050
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define TB_PAGEDOWN
Definition: commctrl.h:2048
struct _INFO * PINFO
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
WPARAM wParam
Definition: combotst.c:138
#define TB_PAGEUP
Definition: commctrl.h:2047
#define TB_LINEDOWN
Definition: commctrl.h:2046
#define TB_BOTTOM
Definition: commctrl.h:2052
HICON hColor
Definition: precomp.h:99
BITMAP bitmap
Definition: precomp.h:101
HICON hRemote
Definition: precomp.h:98
#define TBM_GETPOS
Definition: commctrl.h:2003
#define IDC_GEOSLIDER
Definition: resource.h:19
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hSpectrum
Definition: precomp.h:100
#define WM_CLOSE
Definition: winuser.h:1603
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TB_LINEUP
Definition: commctrl.h:2045
#define TB_ENDTRACK
Definition: commctrl.h:2053
#define TB_TOP
Definition: commctrl.h:2051
static VOID OnResolutionChanged(PINFO pInfo, INT position)
#define IDC_COLORIMAGE
Definition: resource.h:28
Definition: precomp.h:83
BOOL WINAPI DeleteDC(_In_ HDC)
#define WM_HSCROLL
Definition: winuser.h:1725
#define WM_DRAWITEM
Definition: winuser.h:1627
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:294
static HBITMAP
Definition: button.c:44
static VOID DisplayOnInit(HWND hwnd, PINFO pInfo)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104

Referenced by OnMainCreate().

◆ DisplayOnInit()

static VOID DisplayOnInit ( HWND  hwnd,
PINFO  pInfo 
)
static

Definition at line 845 of file connectdialog.c.

847 {
848  DISPLAY_DEVICEW displayDevice;
849  DWORD iDevNum = 0;
850  BOOL GotDev = FALSE;
851 
854  (LONG_PTR)pInfo);
855 
856  pInfo->hDisplayPage = hwnd;
857 
858  SetWindowPos(pInfo->hDisplayPage,
859  NULL,
860  2,
861  22,
862  0,
863  0,
865 
866  pInfo->hRemote = LoadImageW(hInst,
868  IMAGE_ICON,
869  32,
870  32,
872  if (pInfo->hRemote)
873  {
875  IDC_REMICON,
876  STM_SETICON,
877  (WPARAM)pInfo->hRemote,
878  0);
879  }
880 
881  pInfo->hColor = LoadImageW(hInst,
883  IMAGE_ICON,
884  32,
885  32,
887  if (pInfo->hColor)
888  {
891  STM_SETICON,
892  (WPARAM)pInfo->hColor,
893  0);
894  }
895 
896  pInfo->hSpectrum = LoadImageW(hInst,
898  IMAGE_BITMAP,
899  0,
900  0,
902  if (pInfo->hSpectrum)
903  {
904  GetObjectW(pInfo->hSpectrum,
905  sizeof(BITMAP),
906  &pInfo->bitmap);
907  }
908 
909  /* Get video cards list */
910  displayDevice.cb = (DWORD)sizeof(DISPLAY_DEVICE);
911  while (EnumDisplayDevicesW(NULL, iDevNum, &displayDevice, 0x1))
912  {
913  if ((displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) != 0)
914  {
915  if (AddDisplayDevice(pInfo, &displayDevice))
916  GotDev = TRUE;
917  }
918  iDevNum++;
919  }
920 
921  if (GotDev)
922  {
924  ReLoadDisplayPage(pInfo);
925  }
926 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDI_COLORS
Definition: resource.h:37
#define STM_SETICON
Definition: winuser.h:2074
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
#define IDB_SPECT
Definition: resource.h:31
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
UINT_PTR WPARAM
Definition: windef.h:207
#define SWP_NOZORDER
Definition: winuser.h:1232
#define DWORD
Definition: nt_native.h:44
HICON hColor
Definition: precomp.h:99
BITMAP bitmap
Definition: precomp.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
HICON hRemote
Definition: precomp.h:98
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1397
HBITMAP hSpectrum
Definition: precomp.h:100
#define SWP_NOACTIVATE
Definition: winuser.h:1227
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE hInst
Definition: connectdialog.c:28
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD StateFlags
Definition: wingdi.h:2815
static VOID ReLoadDisplayPage(PINFO pInfo)
static BOOL AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICEW DisplayDevice)
#define SWP_NOSIZE
Definition: winuser.h:1230
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IMAGE_BITMAP
Definition: winuser.h:211
HWND hDisplayPage
Definition: precomp.h:91
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDC_REMICON
Definition: resource.h:26
#define IDC_COLORSICON
Definition: resource.h:27
static VOID FillResolutionsAndColors(PINFO pInfo)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define IDI_REMOTE
Definition: resource.h:36
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by DisplayDlgProc().

◆ DlgProc()

static INT_PTR CALLBACK DlgProc ( HWND  hDlg,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1149 of file connectdialog.c.

1153 {
1154  PINFO pInfo;
1155 
1156  /* Get the window context */
1157  pInfo = (PINFO)GetWindowLongPtrW(hDlg,
1158  GWLP_USERDATA);
1159  if (pInfo == NULL && Message != WM_INITDIALOG)
1160  {
1161  goto HandleDefaultMessage;
1162  }
1163 
1164  switch(Message)
1165  {
1166  case WM_INITDIALOG:
1168  break;
1169 
1170  case WM_COMMAND:
1171  {
1172  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
1173  {
1174  if (LOWORD(wParam) == IDOK )
1175  {
1176  SaveAllSettings(pInfo);
1178  }
1179  Cleanup(pInfo);
1180  EndDialog(hDlg, LOWORD(wParam));
1181  }
1182 
1183  break;
1184  }
1185 
1186  case WM_NOTIFY:
1187  {
1188  //INT idctrl;
1189  LPNMHDR pnmh;
1190  //idctrl = (int)wParam;
1191  pnmh = (LPNMHDR)lParam;
1192  if (//(pnmh->hwndFrom == pInfo->hSelf) &&
1193  (pnmh->idFrom == IDC_TAB) &&
1194  (pnmh->code == TCN_SELCHANGE))
1195  {
1196  OnTabWndSelChange(pInfo);
1197  }
1198 
1199  break;
1200  }
1201 
1202  case WM_PAINT:
1203  {
1204  PAINTSTRUCT ps;
1205  HDC hdc;
1206 
1207  hdc = BeginPaint(hDlg, &ps);
1208  if (hdc != NULL)
1209  {
1211  if (hdcMem)
1212  {
1213  WCHAR szBuffer[32];
1214  RECT bmpRc, txtRc;
1215  LOGFONTW lf;
1216  HFONT hFont, hFontOld;
1217  HBITMAP hBmpOld;
1218 
1219  GetClientRect(pInfo->hSelf, &bmpRc);
1220 
1221  hBmpOld = SelectObject(hdcMem, pInfo->hHeader);
1222  StretchBlt(hdc,
1223  0,
1224  0,
1225  bmpRc.right,
1226  pInfo->headerbitmap.bmHeight,
1227  hdcMem,
1228  0,
1229  0,
1230  pInfo->headerbitmap.bmWidth,
1231  pInfo->headerbitmap.bmHeight,
1232  SRCCOPY);
1233 
1234  SelectObject(hdcMem, hBmpOld);
1235  txtRc.left = bmpRc.right / 4;
1236  txtRc.top = 10;
1237  txtRc.right = bmpRc.right * 3 / 4;
1238  txtRc.bottom = pInfo->headerbitmap.bmHeight / 2;
1239 
1240  ZeroMemory(&lf, sizeof(LOGFONTW));
1241 
1242  if (LoadStringW(hInst,
1244  szBuffer,
1245  sizeof(szBuffer) / sizeof(WCHAR)))
1246  {
1247  lf.lfHeight = 20;
1248  lf.lfCharSet = OEM_CHARSET;
1250  lf.lfWeight = FW_MEDIUM;
1251  wcscpy(lf.lfFaceName, L"Tahoma");
1252 
1253  hFont = CreateFontIndirectW(&lf);
1254  if (hFont)
1255  {
1256  hFontOld = SelectObject(hdc, hFont);
1257 
1258  DPtoLP(hdc, (PPOINT)&txtRc, 2);
1259  SetTextColor(hdc, RGB(255,255,255));
1261  DrawTextW(hdc,
1262  szBuffer,
1263  -1,
1264  &txtRc,
1265  DT_BOTTOM | DT_SINGLELINE | DT_NOCLIP | DT_CENTER); //DT_CENTER makes the text visible in RTL layouts...
1266  SelectObject(hdc, hFontOld);
1268  }
1269  }
1270 
1271  txtRc.left = bmpRc.right / 4;
1272  txtRc.top = txtRc.bottom - 5;
1273 #ifdef __REACTOS__
1274  txtRc.right = bmpRc.right * 4 / 5;
1275 #else
1276  txtRc.right = bmpRc.right * 3 / 4;
1277 #endif
1278  txtRc.bottom = pInfo->headerbitmap.bmHeight * 9 / 10;
1279 
1280  if (LoadStringW(hInst,
1282  szBuffer,
1283  sizeof(szBuffer) / sizeof(WCHAR)))
1284  {
1285  lf.lfHeight = 24;
1286  lf.lfCharSet = OEM_CHARSET;
1288  lf.lfWeight = FW_EXTRABOLD;
1289  wcscpy(lf.lfFaceName, L"Tahoma");
1290 
1291  hFont = CreateFontIndirectW(&lf);
1292  if (hFont)
1293  {
1294  hFontOld = SelectObject(hdc, hFont);
1295 
1296  DPtoLP(hdc, (PPOINT)&txtRc, 2);
1297  SetTextColor(hdc, RGB(255,255,255));
1299  DrawTextW(hdc,
1300  szBuffer,
1301  -1,
1302  &txtRc,
1303  DT_TOP | DT_SINGLELINE);
1304  SelectObject(hdc, hFontOld);
1306  }
1307  }
1308 
1309  DeleteDC(hdcMem);
1310  }
1311 
1312  EndPaint(hDlg, &ps);
1313  }
1314 
1315  break;
1316  }
1317 
1318  case WM_CLOSE:
1319  {
1320  Cleanup(pInfo);
1321  EndDialog(hDlg, 0);
1322  }
1323  break;
1324 
1325 HandleDefaultMessage:
1326  default:
1327  return FALSE;
1328  }
1329 
1330  return FALSE;
1331 }
#define IDOK
Definition: winuser.h:824
struct _INFO * PINFO
#define DEFAULT_QUALITY
Definition: wingdi.h:435
#define IDC_TAB
Definition: resource.h:12
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
static VOID OnTabWndSelChange(PINFO pInfo)
Definition: connectdialog.c:85
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:293
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
HFONT hFont
Definition: main.c:53
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings)
Definition: settings.c:371
UINT_PTR idFrom
Definition: winuser.h:3132
#define IDS_HEADERTEXT1
Definition: resource.h:44
#define TRANSPARENT
Definition: wingdi.h:949
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define TCN_SELCHANGE
Definition: commctrl.h:4104
#define FW_MEDIUM
Definition: wingdi.h:374
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_HEADERTEXT2
Definition: resource.h:45
#define WM_CLOSE
Definition: winuser.h:1603
#define RGB(r, g, b)
Definition: wingdi.h:2935
HINSTANCE hInst
Definition: connectdialog.c:28
#define WM_PAINT
Definition: winuser.h:1602
#define FW_EXTRABOLD
Definition: wingdi.h:378
VOID SaveAllSettings(PINFO pInfo)
Definition: settings.c:16
CHAR Message[80]
Definition: alive.c:5
#define OEM_CHARSET
Definition: wingdi.h:399
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BYTE lfQuality
Definition: dimm.idl:70
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define WM_COMMAND
Definition: winuser.h:1722
HWND hSelf
Definition: precomp.h:88
#define DT_NOCLIP
Definition: winuser.h:536
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_SINGLELINE
Definition: winuser.h:540
Definition: precomp.h:83
BOOL WINAPI DeleteDC(_In_ HDC)
#define DT_TOP
Definition: winuser.h:542
HBITMAP hHeader
Definition: precomp.h:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static void Cleanup(PINFO pInfo)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG bottom
Definition: windef.h:294
#define DT_CENTER
Definition: winuser.h:527
static HBITMAP
Definition: button.c:44
LONG lfWeight
Definition: dimm.idl:63
#define IDCANCEL
Definition: winuser.h:825
#define DT_BOTTOM
Definition: winuser.h:525
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
#define WM_NOTIFY
Definition: richedit.h:61
static BOOL OnMainCreate(HWND hwnd, PRDPSETTINGS pRdpSettings)
BITMAP headerbitmap
Definition: precomp.h:93
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by OpenRDPConnectDialog().

◆ DoOpenFile()

static VOID DoOpenFile ( PINFO  pInfo)
static

Definition at line 34 of file connectdialog.c.

35 {
37  WCHAR szFileName[MAX_PATH] = L"Default.rdp";
38  static WCHAR szFilter[] = L"Remote Desktop Files (*.RDP)\0*.rdp\0";
39 
40  ZeroMemory(&ofn, sizeof(ofn));
41  ofn.lStructSize = sizeof(OPENFILENAMEW);
42  ofn.hwndOwner = pInfo->hGeneralPage;
45  ofn.lpstrDefExt = L"RDP";
47  ofn.lpstrFile = szFileName;
49 
50  if (GetOpenFileNameW(&ofn))
51  {
52  LoadRdpSettingsFromFile(pInfo->pRdpSettings, szFileName);
53  ReLoadGeneralPage(pInfo);
54  ReLoadDisplayPage(pInfo);
55  }
56 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hGeneralPage
Definition: precomp.h:90
DWORD nMaxFile
Definition: commdlg.h:337
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4564
LPTSTR szFilter
Definition: mplay32.c:30
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
static VOID ReLoadGeneralPage(PINFO pInfo)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
static const WCHAR L[]
Definition: oid.c:1250
struct tagOFNW OPENFILENAMEW
static VOID ReLoadDisplayPage(PINFO pInfo)
BOOL LoadRdpSettingsFromFile(PRDPSETTINGS pRdpSettings, LPWSTR lpFile)
Definition: settings.c:419
LPSTR lpstrFile
Definition: commdlg.h:336
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFileTitle
Definition: commdlg.h:339
DWORD Flags
Definition: commdlg.h:342

Referenced by DoFileOpen(), GeneralDlgProc(), HandleCommandLine(), MainWndCommand(), and NOTEPAD_WndProc().

◆ DoSaveAs()

static VOID DoSaveAs ( PINFO  pInfo)
static

Definition at line 60 of file connectdialog.c.

61 {
63  WCHAR szFileName[MAX_PATH] = L"Default.rdp";
64  static WCHAR szFilter[] = L"Remote Desktop Files (*.RDP)\0*.rdp\0";
65 
66  ZeroMemory(&ofn, sizeof(ofn));
67  ofn.lStructSize = sizeof(OPENFILENAMEW);
68  ofn.hwndOwner = pInfo->hGeneralPage;
71  ofn.lpstrDefExt = L"RDP";
73  ofn.lpstrFile = szFileName;
75 
76  if (GetSaveFileNameW(&ofn))
77  {
78  SaveAllSettings(pInfo);
79  SaveRdpSettingsToFile(szFileName, pInfo->pRdpSettings);
80  }
81 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hGeneralPage
Definition: precomp.h:90
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4629
DWORD nMaxFile
Definition: commdlg.h:337
BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings)
Definition: settings.c:371
LPTSTR szFilter
Definition: mplay32.c:30
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
VOID SaveAllSettings(PINFO pInfo)
Definition: settings.c:16
static const WCHAR L[]
Definition: oid.c:1250
struct tagOFNW OPENFILENAMEW
LPSTR lpstrFile
Definition: commdlg.h:336
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFileTitle
Definition: commdlg.h:339
DWORD Flags
Definition: commdlg.h:342

Referenced by GeneralDlgProc().

◆ FillResolutionsAndColors()

static VOID FillResolutionsAndColors ( PINFO  pInfo)
static

Definition at line 667 of file connectdialog.c.

668 {
669  PSETTINGS_ENTRY Current;
670  DWORD index, i, num;
671  DWORD MaxBpp = 0;
672  UINT types[5];
673 
674  pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */
675 
676  /* find max bpp */
678  IDC_BPPCOMBO,
680  0,
681  0);
682  for (Current = pInfo->DisplayDeviceList->Settings; Current != NULL; Current = Current->Flink)
683  {
684  if (Current->dmBitsPerPel > MaxBpp)
685  MaxBpp = Current->dmBitsPerPel;
686  }
687  switch (MaxBpp)
688  {
689  case 32: num = 4; break;
690  case 24: num = 3; break;
691  case 16: num = 2; break;
692  case 15: num = 1; break;
693  case 8: num = 0; break;
694  default: num = 0; break;
695  }
696 
697  types[0] = IDS_256COLORS;
698  types[1] = IDS_HIGHCOLOR15;
699  types[2] = IDS_HIGHCOLOR16;
700  types[3] = IDS_HIGHCOLOR24;
701  types[4] = IDS_HIGHCOLOR32;
702 
703  /* Fill color depths combo box */
705  IDC_BPPCOMBO,
707  0,
708  0);
709 
710  for (i = 0, Current = pInfo->DisplayDeviceList->Settings;
711  i <= num && Current != NULL;
712  i++, Current = Current->Flink)
713  {
714  WCHAR Buffer[64];
715  if (LoadStringW(hInst,
716  types[i],
717  Buffer,
718  sizeof(Buffer) / sizeof(WCHAR)))
719  {
721  IDC_BPPCOMBO,
723  (WPARAM)-1,
724  (LPARAM)Buffer);
725  if (index == (DWORD)CB_ERR)
726  {
728  IDC_BPPCOMBO,
729  CB_ADDSTRING,
730  0,
731  (LPARAM)Buffer);
733  IDC_BPPCOMBO,
735  index,
736  types[i]);
737  }
738  }
739  }
740 
741  /* Fill resolutions slider */
745  TRUE,
746  0);
749  TBM_SETRANGE,
750  TRUE,
751  MAKELONG(0, pInfo->DisplayDeviceList->ResolutionsCount)); //extra 1 for full screen
752 
753 
754 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define TRUE
Definition: types.h:120
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice
Definition: precomp.h:87
#define IDS_HIGHCOLOR15
Definition: resource.h:6
#define IDS_HIGHCOLOR16
Definition: resource.h:7
#define TBM_SETRANGE
Definition: commctrl.h:2009
UINT_PTR WPARAM
Definition: windef.h:207
DWORD dmBitsPerPel
Definition: precomp.h:62
PDISPLAY_DEVICE_ENTRY DisplayDeviceList
Definition: precomp.h:86
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDC_GEOSLIDER
Definition: resource.h:19
#define CB_ADDSTRING
Definition: winuser.h:1918
#define MAKELONG(a, b)
Definition: typedefs.h:248
PSETTINGS_ENTRY Settings
Definition: precomp.h:75
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: bufpool.h:45
GLuint index
Definition: glext.h:6031
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
Definition: cmds.c:130
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
HINSTANCE hInst
Definition: connectdialog.c:28
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define index(s, c)
Definition: various.h:29
#define IDS_256COLORS
Definition: resource.h:5
#define IDC_BPPCOMBO
Definition: resource.h:20
unsigned int UINT
Definition: ndis.h:50
DWORD ResolutionsCount
Definition: precomp.h:78
HWND hDisplayPage
Definition: precomp.h:91
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
Definition: precomp.h:58
#define TBM_CLEARTICS
Definition: commctrl.h:2012
#define IDS_HIGHCOLOR24
Definition: resource.h:8
struct _SETTINGS_ENTRY * Flink
Definition: precomp.h:61
#define IDS_HIGHCOLOR32
Definition: resource.h:9
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by DisplayOnInit().

◆ FillServerAddressCombo()

static VOID FillServerAddressCombo ( PINFO  pInfo)
static

Definition at line 159 of file connectdialog.c.

160 {
161  HKEY hKey;
162  WCHAR KeyName[] = L"Software\\Microsoft\\Terminal Server Client\\Default";
165  DWORD size;
166  INT i = 0;
167  BOOL found = FALSE;
168 
170  KeyName,
171  0,
172  KEY_READ,
173  &hKey) == ERROR_SUCCESS)
174  {
175  while (ret == ERROR_SUCCESS)
176  {
177  size = MAX_KEY_NAME;
178  ret = RegEnumValueW(hKey,
179  i,
180  Name,
181  &size,
182  NULL,
183  NULL,
184  NULL,
185  NULL);
186  if (ret == ERROR_SUCCESS)
187  {
188  size = sizeof(Name);
189  if (RegQueryValueExW(hKey,
190  Name,
191  0,
192  NULL,
193  NULL,
194  &size) == ERROR_SUCCESS)
195  {
196  LPWSTR lpAddress = HeapAlloc(GetProcessHeap(),
197  0,
198  size);
199  if (lpAddress)
200  {
201  if (RegQueryValueExW(hKey,
202  Name,
203  0,
204  NULL,
205  (LPBYTE)lpAddress,
206  &size) == ERROR_SUCCESS)
207  {
210  CB_ADDSTRING,
211  0,
212  (LPARAM)lpAddress);
213  found = TRUE;
214  }
215 
217  0,
218  lpAddress);
219  }
220  }
221  }
222 
223  i++;
224  }
225  RegCloseKey(hKey);
226  }
227 
228  if (LoadStringW(hInst,
230  Name,
231  sizeof(Name) / sizeof(WCHAR)))
232  {
235  CB_ADDSTRING,
236  0,
237  (LPARAM)Name);
238  }
239 
240  if(found)
241  {
244  CB_SETCURSEL,
245  0,
246  0);
247  LoadUsernameHint(pInfo->hGeneralPage, 0);
248  }
249 
250 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
HWND hGeneralPage
Definition: precomp.h:90
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct NameRec_ * Name
Definition: cdprocs.h:464
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MAX_KEY_NAME
Definition: connectdialog.c:26
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE hInst
Definition: connectdialog.c:28
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_SERVERCOMBO
Definition: resource.h:15
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define CB_SETCURSEL
Definition: winuser.h:1943
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static VOID LoadUsernameHint(HWND hDlg, INT iCur)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDS_BROWSESERVER
Definition: resource.h:43

Referenced by GeneralOnInit().

◆ GeneralDlgProc()

INT_PTR CALLBACK GeneralDlgProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 334 of file connectdialog.c.

338 {
339  PINFO pInfo = (PINFO)GetWindowLongPtrW(hDlg,
340  GWLP_USERDATA);
341 
342  switch (message)
343  {
344  case WM_INITDIALOG:
345  GeneralOnInit(hDlg, (PINFO)lParam);
346  return TRUE;
347 
348  case WM_COMMAND:
349  {
350  switch(LOWORD(wParam))
351  {
352  case IDC_SERVERCOMBO:
353  if (HIWORD(wParam) == CBN_SELCHANGE)
354  {
355  INT last, cur;
356 
357  cur = SendDlgItemMessageW(hDlg,
359  CB_GETCURSEL,
360  0,
361  0);
362 
363  last = SendDlgItemMessageW(hDlg,
365  CB_GETCOUNT,
366  0,
367  0);
368  if ((cur + 1) == last)
369  MessageBoxW(hDlg, L"SMB is not yet supported", L"RDP error", MB_ICONERROR);
370  else
371  {
372  LoadUsernameHint(hDlg, cur);
373  }
374  }
375  break;
376 
377  case IDC_SAVE:
378  SaveAllSettings(pInfo);
380  break;
381 
382  case IDC_SAVEAS:
383  DoSaveAs(pInfo);
384  break;
385 
386  case IDC_OPEN:
387  DoOpenFile(pInfo);
388  break;
389  }
390 
391  break;
392  }
393 
394  case WM_CLOSE:
395  {
396  if (pInfo->hLogon)
397  DestroyIcon(pInfo->hLogon);
398 
399  if (pInfo->hConn)
400  DestroyIcon(pInfo->hConn);
401 
402  break;
403  }
404  }
405 
406  return 0;
407 }
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
struct _INFO * PINFO
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
POINT last
Definition: font.c:46
static VOID DoSaveAs(PINFO pInfo)
Definition: connectdialog.c:60
HICON hLogon
Definition: precomp.h:96
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define IDC_SAVE
Definition: resource.h:16
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
static VOID GeneralOnInit(HWND hwnd, PINFO pInfo)
static VOID DoOpenFile(PINFO pInfo)
Definition: connectdialog.c:34
BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings)
Definition: settings.c:371
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
HICON hConn
Definition: precomp.h:97
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define IDC_SAVEAS
Definition: resource.h:17
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define WM_CLOSE
Definition: winuser.h:1603
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_SERVERCOMBO
Definition: resource.h:15
VOID SaveAllSettings(PINFO pInfo)
Definition: settings.c:16
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_OPEN
Definition: resource.h:18
Definition: precomp.h:83
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define HIWORD(l)
Definition: typedefs.h:246
#define CB_GETCOUNT
Definition: winuser.h:1924
static VOID LoadUsernameHint(HWND hDlg, INT iCur)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by OnMainCreate().

◆ GeneralOnInit()

static VOID GeneralOnInit ( HWND  hwnd,
PINFO  pInfo 
)
static

Definition at line 281 of file connectdialog.c.

283 {
286  (LONG_PTR)pInfo);
287 
288  pInfo->hGeneralPage = hwnd;
289 
290  SetWindowPos(pInfo->hGeneralPage,
291  NULL,
292  2,
293  22,
294  0,
295  0,
297 
298  pInfo->hLogon = LoadImageW(hInst,
300  IMAGE_ICON,
301  32,
302  32,
304  if (pInfo->hLogon)
305  {
308  STM_SETICON,
309  (WPARAM)pInfo->hLogon,
310  0);
311  }
312 
313  pInfo->hConn = LoadImageW(hInst,
315  IMAGE_ICON,
316  32,
317  32,
319  if (pInfo->hConn)
320  {
322  IDC_CONNICON,
323  STM_SETICON,
324  (WPARAM)pInfo->hConn,
325  0);
326  }
327 
328  FillServerAddressCombo(pInfo);
329  ReLoadGeneralPage(pInfo);
330 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define STM_SETICON
Definition: winuser.h:2074
#define IDC_CONNICON
Definition: resource.h:25
#define IMAGE_ICON
Definition: winuser.h:212
static VOID FillServerAddressCombo(PINFO pInfo)
HICON hLogon
Definition: precomp.h:96
UINT_PTR WPARAM
Definition: windef.h:207
#define SWP_NOZORDER
Definition: winuser.h:1232
HWND hGeneralPage
Definition: precomp.h:90
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDI_CONN
Definition: resource.h:35
smooth NULL
Definition: ftsmooth.c:416
HICON hConn
Definition: precomp.h:97
static VOID ReLoadGeneralPage(PINFO pInfo)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
HINSTANCE hInst
Definition: connectdialog.c:28
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SWP_NOSIZE
Definition: winuser.h:1230
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDC_LOGONICON
Definition: resource.h:24
#define IDI_LOGON
Definition: resource.h:34
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by GeneralDlgProc().

◆ GetPossibleSettings()

static PSETTINGS_ENTRY GetPossibleSettings ( IN LPCWSTR  lpDeviceName,
OUT DWORD pSettingsCount,
OUT PSETTINGS_ENTRY CurrentSettings 
)
static

Definition at line 411 of file connectdialog.c.

414 {
416  DWORD NbSettings = 0;
417  DWORD iMode = 0;
418  DWORD dwFlags = 0;
420  HDC hDC;
421  PSETTINGS_ENTRY Current;
422  DWORD bpp, xres, yres, checkbpp;
423 
424  /* Get current settings */
425  *CurrentSettings = NULL;
426  hDC = CreateICW(NULL, lpDeviceName, NULL, NULL);
429  xres = GetDeviceCaps(hDC, HORZRES);
430  yres = GetDeviceCaps(hDC, VERTRES);
431  DeleteDC(hDC);
432 
433  /* List all settings */
434  devmode.dmSize = (WORD)sizeof(DEVMODE);
436 
438  return NULL;
439 
440  while (EnumDisplaySettingsExW(lpDeviceName, iMode, &devmode, dwFlags))
441  {
442  if (devmode.dmBitsPerPel==8 ||
443  devmode.dmBitsPerPel==16 ||
444  devmode.dmBitsPerPel==24 ||
445  devmode.dmBitsPerPel==32)
446  {
447  checkbpp=1;
448  }
449  else
450  checkbpp=0;
451 
452  if (devmode.dmPelsWidth < 640 ||
453  devmode.dmPelsHeight < 480 || checkbpp == 0)
454  {
455  iMode++;
456  continue;
457  }
458 
459  Current = HeapAlloc(GetProcessHeap(), 0, sizeof(SETTINGS_ENTRY));
460  if (Current != NULL)
461  {
462  /* Sort resolutions by increasing height, and BPP */
463  PSETTINGS_ENTRY Previous = NULL;
464  PSETTINGS_ENTRY Next = Settings;
465  Current->dmPelsWidth = devmode.dmPelsWidth;
466  Current->dmPelsHeight = devmode.dmPelsHeight;
467  Current->dmBitsPerPel = devmode.dmBitsPerPel;
468  while (Next != NULL &&
469  (Next->dmPelsWidth < Current->dmPelsWidth ||
470  (Next->dmPelsWidth == Current->dmPelsWidth && Next->dmPelsHeight < Current->dmPelsHeight) ||
471  (Next->dmPelsHeight == Current->dmPelsHeight &&
472  Next->dmPelsWidth == Current->dmPelsWidth &&
473  Next->dmBitsPerPel < Current->dmBitsPerPel )))
474  {
475  Previous = Next;
476  Next = Next->Flink;
477  }
478  Current->Blink = Previous;
479  Current->Flink = Next;
480  if (Previous == NULL)
481  Settings = Current;
482  else
483  Previous->Flink = Current;
484  if (Next != NULL)
485  Next->Blink = Current;
486  if (devmode.dmPelsWidth == xres && devmode.dmPelsHeight == yres && devmode.dmBitsPerPel == bpp)
487  {
488  *CurrentSettings = Current;
489  }
490  NbSettings++;
491  }
492  iMode++;
493  }
494 
495  *pSettingsCount = NbSettings;
496  return Settings;
497 }
#define BITSPIXEL
Definition: wingdi.h:719
#define HORZRES
Definition: wingdi.h:715
struct _SETTINGS_ENTRY * Blink
Definition: precomp.h:60
_In_ ULONG iMode
Definition: winddi.h:3520
DWORD dmPelsWidth
Definition: precomp.h:63
static HDC
Definition: imagelist.c:92
WORD dmDriverExtra
Definition: wingdi.h:1616
DWORD dmBitsPerPel
Definition: precomp.h:62
DWORD dmBitsPerPel
Definition: wingdi.h:1642
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DEVMODEW devmode
WORD dmSize
Definition: wingdi.h:1615
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
SETTINGS Settings
Definition: charmap.c:26
DWORD dmPelsWidth
Definition: wingdi.h:1643
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode, DWORD dwFlags)
Definition: display.c:330
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)
#define VERTRES
Definition: wingdi.h:716
HDC WINAPI CreateICW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ const DEVMODEW *)
DWORD dmPelsHeight
Definition: wingdi.h:1644
DWORD dmPelsHeight
Definition: precomp.h:64
DWORD bpp
Definition: surface.c:181
Definition: precomp.h:58
struct _SETTINGS_ENTRY * Flink
Definition: precomp.h:61
#define PLANES
Definition: wingdi.h:720

Referenced by AddDisplayDevice().

◆ LoadUsernameHint()

static VOID LoadUsernameHint ( HWND  hDlg,
INT  iCur 
)
static

Definition at line 104 of file connectdialog.c.

105 {
106  WCHAR szValue[MAXVALUE+1000];
108  WCHAR szKeyName[] = L"Software\\Microsoft\\Terminal Server Client\\Servers";
109  PWCHAR lpAddress;
110  HKEY hKey;
111  HKEY hSubKey;
112  LONG lRet = ERROR_SUCCESS;
113  INT iIndex = 0;
115 
117 
118  /* remove possible port number */
119  lpAddress = wcstok(szValue, L":");
120 
121  if (lpAddress == NULL)
122  return;
123 
125  szKeyName,
126  0,
127  KEY_READ,
128  &hKey) == ERROR_SUCCESS)
129  {
130  while (lRet == ERROR_SUCCESS)
131  {
133 
134  lRet = RegEnumKeyExW(hKey, iIndex, szName, &dwSize, NULL, NULL, NULL, NULL);
135 
136  if(lRet == ERROR_SUCCESS && wcscmp(szName, lpAddress) == 0)
137  {
138  if(RegOpenKeyExW(hKey, szName, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
139  break;
140 
141  dwSize = MAXVALUE * sizeof(WCHAR);
142 
143  if(RegQueryValueExW(hKey, L"UsernameHint", 0, NULL, (LPBYTE)szValue, &dwSize) == ERROR_SUCCESS)
144  {
145  SetDlgItemTextW(hDlg, IDC_NAMEEDIT, szValue);
146  }
147 
148  RegCloseKey(hSubKey);
149  break;
150  }
151  iIndex++;
152  }
153  RegCloseKey(hKey);
154  }
155 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_Check_return_ _CRTIMP wchar_t *__cdecl wcstok(_Inout_opt_z_ wchar_t *_Str, _In_z_ const wchar_t *_Delim)
#define IDC_NAMEEDIT
Definition: resource.h:22
UINT_PTR WPARAM
Definition: windef.h:207
uint16_t * PWCHAR
Definition: typedefs.h:54
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MAX_KEY_NAME
Definition: connectdialog.c:26
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_SERVERCOMBO
Definition: resource.h:15
static const WCHAR L[]
Definition: oid.c:1250
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define MAXVALUE
Definition: precomp.h:29
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by FillServerAddressCombo(), and GeneralDlgProc().

◆ OnMainCreate()

static BOOL OnMainCreate ( HWND  hwnd,
PRDPSETTINGS  pRdpSettings 
)
static

Definition at line 1019 of file connectdialog.c.

1021 {
1022  PINFO pInfo;
1023  TCITEMW item;
1024  BOOL bRet = FALSE;
1025 
1026  pInfo = HeapAlloc(GetProcessHeap(),
1028  sizeof(INFO));
1029  if (pInfo)
1030  {
1032  GWLP_USERDATA,
1033  (LONG_PTR)pInfo);
1034 
1035  pInfo->hSelf = hwnd;
1036 
1037  /* add main settings pointer */
1038  pInfo->pRdpSettings = pRdpSettings;
1039 
1040  /* set the dialog icons */
1041  pInfo->hMstscSm = LoadImageW(hInst,
1043  IMAGE_ICON,
1044  16,
1045  16,
1046  LR_DEFAULTCOLOR);
1047  if (pInfo->hMstscSm)
1048  {
1050  WM_SETICON,
1051  ICON_SMALL,
1052  (WPARAM)pInfo->hMstscSm);
1053  }
1054  pInfo->hMstscLg = LoadImageW(hInst,
1056  IMAGE_ICON,
1057  32,
1058  32,
1059  LR_DEFAULTCOLOR);
1060  if (pInfo->hMstscLg)
1061  {
1063  WM_SETICON,
1064  ICON_BIG,
1065  (WPARAM)pInfo->hMstscLg);
1066  }
1067 
1068  pInfo->hHeader = (HBITMAP)LoadImageW(hInst,
1070  IMAGE_BITMAP,
1071  0,
1072  0,
1073  LR_DEFAULTCOLOR);
1074  if (pInfo->hHeader)
1075  {
1076  GetObjectW(pInfo->hHeader,
1077  sizeof(BITMAP),
1078  &pInfo->headerbitmap);
1079  }
1080 
1081  /* setup the tabs */
1082  pInfo->hTab = GetDlgItem(hwnd, IDC_TAB);
1083  if (pInfo->hTab)
1084  {
1087  pInfo->hTab,
1089  (LPARAM)pInfo))
1090  {
1091  WCHAR str[256];
1092  ZeroMemory(&item, sizeof(TCITEM));
1093  item.mask = TCIF_TEXT;
1094  if (LoadStringW(hInst, IDS_TAB_GENERAL, str, 256))
1095  item.pszText = str;
1096  item.cchTextMax = 256;
1097  (void)TabCtrl_InsertItem(pInfo->hTab, 0, &item);
1098  }
1099 
1102  pInfo->hTab,
1104  (LPARAM)pInfo))
1105  {
1106  WCHAR str[256];
1107  ZeroMemory(&item, sizeof(TCITEM));
1108  item.mask = TCIF_TEXT;
1109  if (LoadStringW(hInst, IDS_TAB_DISPLAY, str, 256))
1110  item.pszText = str;
1111  item.cchTextMax = 256;
1112  (void)TabCtrl_InsertItem(pInfo->hTab, 1, &item);
1113  }
1114 
1115  OnTabWndSelChange(pInfo);
1116  }
1117  }
1118 
1119  return bRet;
1120 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define IDC_TAB
Definition: resource.h:12
HICON hMstscSm
Definition: precomp.h:94
HWND hTab
Definition: precomp.h:89
#define IDD_GENERAL
Definition: resource.h:12
#define IDI_MSTSC
Definition: resource.h:33
static VOID OnTabWndSelChange(PINFO pInfo)
Definition: connectdialog.c:85
#define ZeroMemory
Definition: winbase.h:1635
INT_PTR CALLBACK GeneralDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
UINT_PTR WPARAM
Definition: windef.h:207
#define TCIF_TEXT
Definition: commctrl.h:3943
#define IDB_HEADER
Definition: resource.h:30
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define ICON_SMALL
Definition: tnclass.cpp:48
#define IDS_TAB_GENERAL
Definition: resource.h:77
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define GWLP_USERDATA
Definition: treelist.c:63
const WCHAR * str
LONG_PTR LPARAM
Definition: windef.h:208
HICON hMstscLg
Definition: precomp.h:95
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
HINSTANCE hInst
Definition: connectdialog.c:28
#define IDD_DISPLAY
Definition: resource.h:13
INT_PTR CALLBACK DisplayDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
HWND hSelf
Definition: precomp.h:88
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: precomp.h:83
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: bl.h:1331
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HBITMAP hHeader
Definition: precomp.h:92
#define IMAGE_BITMAP
Definition: winuser.h:211
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define TabCtrl_InsertItem(hwnd, iItem, pitem)
Definition: commctrl.h:4023
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5247
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define TCITEM
Definition: commctrl.h:4001
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define IDS_TAB_DISPLAY
Definition: resource.h:39
BITMAP headerbitmap
Definition: precomp.h:93
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by DlgProc().

◆ OnResolutionChanged()

static VOID OnResolutionChanged ( PINFO  pInfo,
INT  position 
)
static

Definition at line 623 of file connectdialog.c.

624 {
625  WCHAR Buffer[64];
626  INT MaxSlider;
627 
628  MaxSlider = SendDlgItemMessageW(pInfo->hDisplayPage,
631  0,
632  0);
633 
634  if (position == MaxSlider)
635  {
638  Buffer,
639  sizeof(Buffer) / sizeof(WCHAR));
640  }
641  else
642  {
643  WCHAR Pixel[64];
644 
645  if (LoadStringW(hInst,
646  IDS_PIXEL,
647  Pixel,
648  sizeof(Pixel) / sizeof(WCHAR)))
649  {
651  Pixel,
652  pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth,
653  pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight,
654  Pixel);
655  }
656  }
657 
660  WM_SETTEXT,
661  0,
662  (LPARAM)Buffer);
663 }
#define IDC_SETTINGS_RESOLUTION_TEXT
Definition: resource.h:21
#define TBM_GETRANGEMAX
Definition: commctrl.h:2005
PDISPLAY_DEVICE_ENTRY DisplayDeviceList
Definition: precomp.h:86
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define IDC_GEOSLIDER
Definition: resource.h:19
#define IDS_PIXEL
Definition: resource.h:41
LONG_PTR LPARAM
Definition: windef.h:208
Definition: bufpool.h:45
#define WM_SETTEXT
Definition: winuser.h:1599
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
HINSTANCE hInst
Definition: connectdialog.c:28
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_FULLSCREEN
Definition: resource.h:42
DWORD dmPelsWidth
Definition: precomp.h:54
PRESOLUTION_INFO Resolutions
Definition: precomp.h:77
DWORD dmPelsHeight
Definition: precomp.h:55
HWND hDisplayPage
Definition: precomp.h:91

Referenced by DisplayDlgProc(), and ReLoadDisplayPage().

◆ OnTabWndSelChange()

static VOID OnTabWndSelChange ( PINFO  pInfo)
static

Definition at line 85 of file connectdialog.c.

86 {
87  switch (TabCtrl_GetCurSel(pInfo->hTab))
88  {
89  case 0: //General
93  break;
94  case 1: //Display
98  break;
99  }
100 }
HWND hTab
Definition: precomp.h:89
#define SW_HIDE
Definition: winuser.h:762
#define TabCtrl_GetCurSel(hwnd)
Definition: commctrl.h:4035
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND hGeneralPage
Definition: precomp.h:90
BOOL WINAPI BringWindowToTop(_In_ HWND)
#define SW_SHOW
Definition: winuser.h:769
HWND hDisplayPage
Definition: precomp.h:91

Referenced by DlgProc(), and OnMainCreate().

◆ OpenRDPConnectDialog()

BOOL OpenRDPConnectDialog ( HINSTANCE  hInstance,
PRDPSETTINGS  pRdpSettings 
)

Definition at line 1335 of file connectdialog.c.

1337 {
1338  INITCOMMONCONTROLSEX iccx;
1339 
1340  hInst = hInstance;
1341 
1342  iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
1343  iccx.dwICC = ICC_TAB_CLASSES;
1344  InitCommonControlsEx(&iccx);
1345 
1346  return (DialogBoxParamW(hInst,
1348  NULL,
1349  DlgProc,
1350  (LPARAM)pRdpSettings) == IDOK);
1351 }
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hInst
Definition: connectdialog.c:28
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDD_CONNECTDIALOG
Definition: resource.h:11
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
#define ICC_TAB_CLASSES
Definition: commctrl.h:61

Referenced by wWinMain().

◆ ReLoadDisplayPage()

static VOID ReLoadDisplayPage ( PINFO  pInfo)
static

Definition at line 758 of file connectdialog.c.

759 {
760  DWORD index;
761  INT width, height, pos = 0;
762  INT bpp, num, i, screenmode;
763  BOOL bSet = FALSE;
764 
765  /* get fullscreen info */
766  screenmode = GetIntegerFromSettings(pInfo->pRdpSettings, L"screen mode id");
767 
768  /* set trackbar position */
769  width = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopwidth");
770  height = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopheight");
771 
772  if (width != -1 && height != -1)
773  {
774  if(screenmode == 2)
775  {
779  0,
780  0);
781  }
782  else
783  {
784  for (index = 0; index < pInfo->CurrentDisplayDevice->ResolutionsCount; index++)
785  {
788  {
789  pos = index;
790  break;
791  }
792  }
793  }
794  }
795 
796  /* set slider position */
799  TBM_SETPOS,
800  TRUE,
801  pos);
802 
803  OnResolutionChanged(pInfo, pos);
804 
805 
806  /* set color combo */
807  bpp = GetIntegerFromSettings(pInfo->pRdpSettings, L"session bpp");
808 
810  IDC_BPPCOMBO,
811  CB_GETCOUNT,
812  0,
813  0);
814  for (i = 0; i < num; i++)
815  {
817  IDC_BPPCOMBO,
819  i,
820  0);
821  if (data == bpp)
822  {
824  IDC_BPPCOMBO,
825  CB_SETCURSEL,
826  i,
827  0);
828  bSet = TRUE;
829  break;
830  }
831  }
832 
833  if (!bSet)
834  {
836  IDC_BPPCOMBO,
837  CB_SETCURSEL,
838  num - 1,
839  0);
840  }
841 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice
Definition: precomp.h:87
#define CB_GETITEMDATA
Definition: winuser.h:1932
#define TBM_GETRANGEMAX
Definition: commctrl.h:2005
#define TBM_SETPOS
Definition: commctrl.h:2008
INT GetIntegerFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue)
Definition: settings.c:144
int32_t INT
Definition: typedefs.h:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_GEOSLIDER
Definition: resource.h:19
GLuint index
Definition: glext.h:6031
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
static VOID OnResolutionChanged(PINFO pInfo, INT position)
#define IDC_BPPCOMBO
Definition: resource.h:20
#define CB_SETCURSEL
Definition: winuser.h:1943
DWORD dmPelsWidth
Definition: precomp.h:54
PRESOLUTION_INFO Resolutions
Definition: precomp.h:77
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
DWORD dmPelsHeight
Definition: precomp.h:55
DWORD ResolutionsCount
Definition: precomp.h:78
HWND hDisplayPage
Definition: precomp.h:91
DWORD bpp
Definition: surface.c:181
#define CB_GETCOUNT
Definition: winuser.h:1924

Referenced by DisplayOnInit(), and DoOpenFile().

◆ ReLoadGeneralPage()

static VOID ReLoadGeneralPage ( PINFO  pInfo)
static

Definition at line 254 of file connectdialog.c.

255 {
256  LPWSTR lpText;
257 
258  /* add file address */
259  lpText = GetStringFromSettings(pInfo->pRdpSettings,
260  L"full address");
261  if (lpText)
262  {
265  lpText);
266  }
267 
268  /* set user name */
269  lpText = GetStringFromSettings(pInfo->pRdpSettings,
270  L"username");
271  if (lpText)
272  {
274  IDC_NAMEEDIT,
275  lpText);
276  }
277 }
LPWSTR GetStringFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue)
Definition: settings.c:171
#define IDC_NAMEEDIT
Definition: resource.h:22
HWND hGeneralPage
Definition: precomp.h:90
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
PRDPSETTINGS pRdpSettings
Definition: precomp.h:85
#define IDC_SERVERCOMBO
Definition: resource.h:15
static const WCHAR L[]
Definition: oid.c:1250
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DoOpenFile(), and GeneralOnInit().

Variable Documentation

◆ hInst