ReactOS  0.4.15-dev-5463-g138eb58
console.c File Reference
#include "precomp.h"
#include <shellapi.h>
#include <stdlib.h>
#include <strsafe.h>
#include "resource.h"
#include <debug.h>
Include dependency graph for console.c:

Go to the source code of this file.

Classes

struct  _CONSOLE_MAINFRAME_WND
 
struct  _CONSOLE_CHILDFRM_WND
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _CONSOLE_MAINFRAME_WND CONSOLE_MAINFRAME_WND
 
typedef struct _CONSOLE_MAINFRAME_WNDPCONSOLE_MAINFRAME_WND
 
typedef struct _CONSOLE_CHILDFRM_WND CONSOLE_CHILDFRM_WND
 
typedef struct _CONSOLE_CHILDFRM_WNDPCONSOLE_CHILDFRM_WND
 

Functions

PCONSOLE_CHILDFRM_WND GetActiveChildInfo (VOID)
 
static LPTSTR CreateNewConsoleTitle (VOID)
 
HWND CreateNewMDIChild (PCONSOLE_MAINFRAME_WND Info, HWND hwndMDIClient)
 
static LRESULT FrameOnCreate (HWND hwnd, LPARAM lParam)
 
static VOID SetFileName (PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
 
static BOOL DoSaveFileAs (HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
 
static BOOL DoSaveFile (HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
 
static BOOL FrameOnSave (HWND hWnd)
 
static BOOL FrameOnSaveAs (HWND hWnd)
 
static VOID FrameOnCommand (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID FrameOnSize (HWND hMainWnd, WORD cx, WORD cy)
 
static LRESULT CALLBACK ConsoleMainFrameWndProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static LRESULT CALLBACK ConsoleChildFrmProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL RegisterMMCWndClasses (VOID)
 
VOID UnregisterMMCWndClasses (VOID)
 
HWND CreateConsoleWindow (IN LPCTSTR lpFileName OPTIONAL, int nCmdShow)
 

Variables

static const TCHAR szMMCMainFrame [] = TEXT("MMCMainFrame")
 
static const TCHAR szMMCChildFrm [] = TEXT("MMCChildFrm")
 
static ULONG NewConsoleCount = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 27 of file console.c.

Typedef Documentation

◆ CONSOLE_CHILDFRM_WND

◆ CONSOLE_MAINFRAME_WND

◆ PCONSOLE_CHILDFRM_WND

◆ PCONSOLE_MAINFRAME_WND

Function Documentation

◆ ConsoleChildFrmProc()

static LRESULT CALLBACK ConsoleChildFrmProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 479 of file console.c.

483 {
485 
487  0);
488 
489  switch (uMsg)
490  {
491  case WM_CREATE:
494  sizeof(CONSOLE_CHILDFRM_WND));
495  if (Info != NULL)
496  {
497  Info->hwnd = hwnd;
498 
500  0,
501  (LONG_PTR)Info);
502  }
503  break;
504 
505  case WM_DESTROY:
506  if (Info != NULL)
507  {
508  if (Info->pFileName)
509  HeapFree(hAppHeap, 0, Info->pFileName);
510 
511  HeapFree(hAppHeap, 0, Info);
512  }
513 
515  break;
516 
517  default:
518  return DefMDIChildProc(hwnd, uMsg, wParam, lParam);
519  }
520 
521  return 0;
522 }
#define WM_USER_CLOSE_CHILD
Definition: precomp.h:14
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
#define DefMDIChildProc
Definition: ros2win.h:33
#define WM_DESTROY
Definition: winuser.h:1599
#define PostMessage
Definition: winuser.h:5822
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE hAppHeap
Definition: mmc.c:24
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define WM_CREATE
Definition: winuser.h:1598
#define GetWindowLongPtr
Definition: treelist.c:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
HWND hwndMainConsole
Definition: mmc.c:25
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by RegisterMMCWndClasses().

◆ ConsoleMainFrameWndProc()

static LRESULT CALLBACK ConsoleMainFrameWndProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 398 of file console.c.

402 {
404 
406  0);
407 
408  switch (uMsg)
409  {
410  case WM_CREATE:
411  return FrameOnCreate(hwnd,
412  lParam);
413 
414  case WM_COMMAND:
416  uMsg,
417  wParam,
418  lParam);
419  break;
420 
421  case WM_SIZE:
423  LOWORD(lParam),
424  HIWORD(lParam));
425  break;
426 
427  case WM_CLOSE:
429  break;
430 
431  case WM_DESTROY:
432  if (Info != NULL)
433  {
434  SetMenu(Info->hwnd,
435  NULL);
436 
437  if (Info->hMenuConsoleSmall != NULL)
438  {
439  DestroyMenu(Info->hMenuConsoleSmall);
440  Info->hMenuConsoleSmall = NULL;
441  }
442 
443  if (Info->hMenuConsoleLarge != NULL)
444  {
445  DestroyMenu(Info->hMenuConsoleLarge);
446  Info->hMenuConsoleLarge = NULL;
447  }
448 
450  0,
451  Info);
452  }
453 
454  PostQuitMessage(0);
455  break;
456 
457  case WM_USER_CLOSE_CHILD:
458  Info->nConsoleCount--;
459  if (Info->nConsoleCount == 0)
460  {
461  SetMenu(Info->hwnd,
462  Info->hMenuConsoleSmall);
463  }
464  break;
465 
466  default:
467  return DefFrameProc(hwnd,
469  uMsg,
470  wParam,
471  lParam);
472  }
473 
474  return 0;
475 }
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HWND hwndMDIClient
Definition: mmc.c:26
#define WM_USER_CLOSE_CHILD
Definition: precomp.h:14
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
#define DefFrameProc
Definition: ros2win.h:32
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define WM_DESTROY
Definition: winuser.h:1599
#define WM_SIZE
Definition: winuser.h:1601
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define WM_CLOSE
Definition: winuser.h:1611
static LRESULT FrameOnCreate(HWND hwnd, LPARAM lParam)
Definition: console.c:114
HANDLE hAppHeap
Definition: mmc.c:24
#define WM_COMMAND
Definition: winuser.h:1730
BOOL WINAPI DestroyMenu(_In_ HMENU)
static VOID FrameOnSize(HWND hMainWnd, WORD cx, WORD cy)
Definition: console.c:367
#define NULL
Definition: types.h:112
static VOID FrameOnCommand(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: console.c:308
#define WM_CREATE
Definition: winuser.h:1598
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:735
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by RegisterMMCWndClasses().

◆ CreateConsoleWindow()

HWND CreateConsoleWindow ( IN LPCTSTR lpFileName  OPTIONAL,
int  nCmdShow 
)

Definition at line 585 of file console.c.

587 {
588  HWND hWndConsole;
590 
591  hWndConsole = CreateWindowEx(WS_EX_WINDOWEDGE,
593  NULL,
599  NULL,
600  NULL,
601  hAppInstance,
602  (PVOID)FileName);
603 
604  if (hWndConsole != NULL)
605  {
606  ShowWindow(hWndConsole, nCmdShow);
607  }
608 
609  return hWndConsole;
610 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define LONG_PTR
Definition: treelist.c:79
static const TCHAR szMMCMainFrame[]
Definition: console.c:55
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define CreateWindowEx
Definition: winuser.h:5745
#define CW_USEDEFAULT
Definition: winuser.h:225
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
_In_ LPCSTR lpFileName
Definition: winbase.h:3058
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by _tWinMain().

◆ CreateNewConsoleTitle()

static LPTSTR CreateNewConsoleTitle ( VOID  )
static

Definition at line 74 of file console.c.

75 {
77 
80  &lpTitle,
81  ++NewConsoleCount) == 0)
82  {
83  lpTitle = NULL;
84  }
85 
86  return lpTitle;
87 }
#define IDS_CONSOLETITLE
Definition: resource.h:4
CHAR * LPTSTR
Definition: xmlstorage.h:192
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
Definition: misc.c:85
static ULONG NewConsoleCount
Definition: console.c:58
#define NULL
Definition: types.h:112
TCHAR lpTitle[80]
Definition: ctm.c:69
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by CreateNewMDIChild().

◆ CreateNewMDIChild()

HWND CreateNewMDIChild ( PCONSOLE_MAINFRAME_WND  Info,
HWND  hwndMDIClient 
)

Definition at line 90 of file console.c.

92 {
94  HWND hChild;
95 
96  mcs.szTitle = CreateNewConsoleTitle();
97  mcs.szClass = szMMCChildFrm;
98  mcs.hOwner = GetModuleHandle(NULL);
99  mcs.x = mcs.cx = CW_USEDEFAULT;
100  mcs.y = mcs.cy = CW_USEDEFAULT;
101  mcs.style = MDIS_ALLCHILDSTYLES;
102 
104  if (hChild)
105  {
106  Info->nConsoleCount++;
107  }
108 
109  return hChild;
110 }
static LPTSTR CreateNewConsoleTitle(VOID)
Definition: console.c:74
HWND hwndMDIClient
Definition: mmc.c:26
static HTREEITEM hChild
Definition: treeview.c:381
HANDLE HWND
Definition: compat.h:19
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define CW_USEDEFAULT
Definition: winuser.h:225
LONG_PTR LPARAM
Definition: windef.h:208
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define GetModuleHandle
Definition: winbase.h:3698
static const TCHAR szMMCChildFrm[]
Definition: console.c:56
#define NULL
Definition: types.h:112
#define WM_MDICREATE
Definition: winuser.h:1802
#define SendMessage
Definition: winuser.h:5833
static struct myctx * mcs
Definition: adnstest.c:53

Referenced by FrameOnCommand().

◆ DoSaveFile()

static BOOL DoSaveFile ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 208 of file console.c.

211 {
212  DPRINT1("pChildInfo %p\n", pChildInfo);
213 
214  DPRINT1("FileName %S\n", pChildInfo->pFileName);
215 
216  if (pChildInfo->pFileName == NULL)
217  return DoSaveFileAs(hWnd, pChildInfo);
218 
219  /* FIXME: Save the console here! */
220 
221  return TRUE;
222 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
static BOOL DoSaveFileAs(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:225
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8

Referenced by DoFileSave(), DoSaveFileAs(), and FrameOnSave().

◆ DoSaveFileAs()

static BOOL DoSaveFileAs ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 225 of file console.c.

228 {
229  OPENFILENAME saveas;
231 
232  DPRINT1("pChildInfo %p\n", pChildInfo);
233  DPRINT1("FileName %S\n", pChildInfo->pFileName);
234 
235  ZeroMemory(&saveas, sizeof(saveas));
236 
237  if (pChildInfo->pFileName != NULL)
238  {
239  StringCbCopy(szPath, sizeof(szPath), pChildInfo->pFileName);
240  }
241  else
242  {
243  GetWindowText(pChildInfo->hwnd, szPath, _countof(szPath));
244  StringCbCat(szPath, sizeof(szPath), TEXT(".msc"));
245  }
246 
247  saveas.lStructSize = sizeof(OPENFILENAME);
248  saveas.hwndOwner = hWnd;
249  saveas.hInstance = hAppInstance;
250  saveas.lpstrFilter = L"MSC Files\0*.msc\0";
251  saveas.lpstrFile = szPath;
252  saveas.nMaxFile = MAX_PATH;
254  saveas.lpstrDefExt = L"msc";
255 
256  if (GetSaveFileName(&saveas))
257  {
258  /* HACK: Because in ROS, Save-As boxes don't check the validity
259  * of file names and thus, here, szPath can be invalid !! We only
260  * see its validity when we call DoSaveFile()... */
261  SetFileName(pChildInfo, szPath);
262 
263  if (DoSaveFile(hWnd, pChildInfo))
264  {
265 // UpdateWindowCaption();
266  return TRUE;
267  }
268  else
269  {
270  SetFileName(pChildInfo, NULL);
271  return FALSE;
272  }
273  }
274  else
275  {
276  return FALSE;
277  }
278 }
#define OFN_EXPLORER
Definition: commdlg.h:104
HWND hwndOwner
Definition: commdlg.h:330
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define ZeroMemory
Definition: winbase.h:1670
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define GetWindowText
Definition: winuser.h:5788
DWORD nMaxFile
Definition: commdlg.h:337
#define GetSaveFileName
Definition: commdlg.h:666
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
HINSTANCE hInstance
Definition: commdlg.h:331
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:180
char TCHAR
Definition: xmlstorage.h:189
#define StringCbCat
Definition: strsafe.h:334
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
#define StringCbCopy
Definition: strsafe.h:155
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:208
#define TEXT(s)
Definition: k32.h:26
LPSTR lpstrFile
Definition: commdlg.h:336
LPCWSTR szPath
Definition: env.c:37
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
HINSTANCE hAppInstance
Definition: mmc.c:23
DWORD Flags
Definition: commdlg.h:342

Referenced by DoSaveFile(), and FrameOnSaveAs().

◆ FrameOnCommand()

static VOID FrameOnCommand ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 308 of file console.c.

312 {
314  HWND hChild;
315  LPTSTR lpTitle;
316 
318 
319  switch (LOWORD(wParam))
320  {
321  case IDM_FILE_NEW:
323  SetMenu(Info->hwnd,
324  Info->hMenuConsoleLarge);
325  break;
326 
327  case IDM_FILE_SAVE:
328  FrameOnSave(hwnd);
329  break;
330 
331  case IDM_FILE_SAVEAS:
333  break;
334 
335  case IDM_FILE_EXIT:
336  PostMessage(hwnd, WM_CLOSE, 0, 0);
337  break;
338 
339  case IDM_HELP_ABOUT:
341  {
345  }
346  break;
347 
348  default:
350  {
352  }
353  else
354  {
356  if (hChild)
357  {
359  }
360  }
361  break;
362  }
363 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HWND hwndMDIClient
Definition: mmc.c:26
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
#define IDS_APPTITLE
Definition: resource.h:3
static HTREEITEM hChild
Definition: treeview.c:381
static BOOL FrameOnSaveAs(HWND hWnd)
Definition: console.c:295
HANDLE HWND
Definition: compat.h:19
#define IDM_HELP_ABOUT
Definition: resource.h:385
#define IDM_FILE_NEW
Definition: resource.h:11
static BOOL FrameOnSave(HWND hWnd)
Definition: console.c:281
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define DefFrameProc
Definition: ros2win.h:32
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define PostMessage
Definition: winuser.h:5822
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define WM_CLOSE
Definition: winuser.h:1611
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define ShellAbout
Definition: shellapi.h:690
#define WM_MDIGETACTIVE
Definition: winuser.h:1811
#define WM_COMMAND
Definition: winuser.h:1730
#define IDM_FILE_SAVEAS
Definition: resource.h:14
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5833
TCHAR lpTitle[80]
Definition: ctm.c:69
#define LoadIcon
Definition: winuser.h:5803
#define GetWindowLongPtr
Definition: treelist.c:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
HWND CreateNewMDIChild(PCONSOLE_MAINFRAME_WND Info, HWND hwndMDIClient)
Definition: console.c:90
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDM_FILE_EXIT
Definition: resource.h:15
HINSTANCE hAppInstance
Definition: mmc.c:23
#define IDI_MAINAPP
Definition: resource.h:6
#define IDM_FILE_SAVE
Definition: resource.h:13

Referenced by ConsoleMainFrameWndProc().

◆ FrameOnCreate()

static LRESULT FrameOnCreate ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 114 of file console.c.

116 {
118  CLIENTCREATESTRUCT ccs;
119  LPCTSTR lpFileName = (LPCTSTR)(((LPCREATESTRUCT)lParam)->lpCreateParams);
120 
123  sizeof(CONSOLE_MAINFRAME_WND));
124  if (Info == NULL)
125  return -1;
126 
127  Info->hwnd = hwnd;
128 
130  0,
131  (LONG_PTR)Info);
132 
133  Info->hMenuConsoleSmall = LoadMenu(hAppInstance,
135 
136  Info->hMenuConsoleLarge = LoadMenu(hAppInstance,
138 
139  if (lpFileName == NULL)
140  {
141  /* FIXME */
142  Info->AppAuthorMode = TRUE;
143 // Info->lpConsoleTitle = TEXT("ReactOS Management Console");
144  }
145  else
146  {
147  Info->AppAuthorMode = TRUE;
148 // Info->lpConsoleTitle = CreateNewConsoleTitle();
149  }
150 
151  SetMenu(Info->hwnd,
152  Info->hMenuConsoleSmall);
153 
154  SetWindowText(Info->hwnd, TEXT("ReactOS Management Console"));
155 
156  ccs.hWindowMenu = GetSubMenu(Info->hMenuConsoleLarge, 1);
158 
159  /* Create the MDI client window */
161  L"MDICLIENT",
162  (LPCTSTR)NULL,
168  hwnd,
169  (HMENU)0xCAC,
170  hAppInstance,
171  (LPVOID)&ccs);
172 
173  ShowWindow(Info->hwndMDIClient, SW_SHOW);
174 
175  return 0;
176 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
HWND hwndMDIClient
Definition: mmc.c:26
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define SetWindowLongPtr
Definition: treelist.c:70
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define L(x)
Definition: ntvdm.h:50
#define CreateWindowEx
Definition: winuser.h:5745
#define CW_USEDEFAULT
Definition: winuser.h:225
#define IDM_CONSOLE_LARGE
Definition: resource.h:9
#define SW_SHOW
Definition: winuser.h:769
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define WS_HSCROLL
Definition: pedump.c:628
HANDLE hAppHeap
Definition: mmc.c:24
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define TEXT(s)
Definition: k32.h:26
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define LoadMenu
Definition: winuser.h:5807
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowText
Definition: winuser.h:5847
#define NULL
Definition: types.h:112
#define WS_VSCROLL
Definition: pedump.c:627
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDM_CONSOLE_SMALL
Definition: resource.h:8
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
_In_ LPCSTR lpFileName
Definition: winbase.h:3058
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by ConsoleMainFrameWndProc().

◆ FrameOnSave()

static BOOL FrameOnSave ( HWND  hWnd)
static

Definition at line 281 of file console.c.

283 {
284  PCONSOLE_CHILDFRM_WND pChildInfo;
285 
286  pChildInfo = GetActiveChildInfo();
287  if (pChildInfo == NULL)
288  return FALSE;
289 
290  return DoSaveFile(hWnd, pChildInfo);
291 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:61
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:208
#define NULL
Definition: types.h:112

Referenced by FrameOnCommand().

◆ FrameOnSaveAs()

static BOOL FrameOnSaveAs ( HWND  hWnd)
static

Definition at line 295 of file console.c.

297 {
298  PCONSOLE_CHILDFRM_WND pChildInfo;
299 
300  pChildInfo = GetActiveChildInfo();
301  if (pChildInfo == NULL)
302  return FALSE;
303 
304  return DoSaveFileAs(hWnd, pChildInfo);
305 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:61
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
static BOOL DoSaveFileAs(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:225
#define NULL
Definition: types.h:112

Referenced by FrameOnCommand().

◆ FrameOnSize()

static VOID FrameOnSize ( HWND  hMainWnd,
WORD  cx,
WORD  cy 
)
static

Definition at line 367 of file console.c.

370 {
371  RECT rcClient; //, rcTool, rcStatus;
372 // int lvHeight, iToolHeight, iStatusHeight;
373 
374  /* Size toolbar and get height */
375 // SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
376 // GetWindowRect(Info->hTool, &rcTool);
377 // iToolHeight = rcTool.bottom - rcTool.top;
378 
379  /* Size status bar and get height */
380 // SendMessage(Info->hStatus, WM_SIZE, 0, 0);
381 // GetWindowRect(Info->hStatus, &rcStatus);
382 // iStatusHeight = rcStatus.bottom - rcStatus.top;
383 
384  /* Calculate remaining height and size list view */
385  GetClientRect(hMainWnd, &rcClient);
386 // lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
387  SetWindowPos(hwndMDIClient, //Info->hTreeView,
388  NULL,
389  0,
390  0, //iToolHeight,
391  rcClient.right,
392  rcClient.bottom, //lvHeight,
393  SWP_NOZORDER);
394 }
HWND hwndMDIClient
Definition: mmc.c:26
#define SWP_NOZORDER
Definition: winuser.h:1237
LONG right
Definition: windef.h:308
HWND hMainWnd
Definition: magnifier.c:32
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

Referenced by ConsoleMainFrameWndProc().

◆ GetActiveChildInfo()

PCONSOLE_CHILDFRM_WND GetActiveChildInfo ( VOID  )

Definition at line 61 of file console.c.

62 {
63  HWND hWndMDIChild;
64 
65  hWndMDIChild = (HWND)SendMessageW(hwndMDIClient, WM_MDIGETACTIVE, 0, 0);
66  if (hWndMDIChild == NULL)
67  return NULL;
68 
69  return (PCONSOLE_CHILDFRM_WND)GetWindowLongPtr(hWndMDIChild, 0);
70 }
HWND hwndMDIClient
Definition: mmc.c:26
HANDLE HWND
Definition: compat.h:19
#define WM_MDIGETACTIVE
Definition: winuser.h:1811
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by FrameOnSave(), and FrameOnSaveAs().

◆ RegisterMMCWndClasses()

BOOL RegisterMMCWndClasses ( VOID  )

Definition at line 526 of file console.c.

527 {
528  WNDCLASSEX wc = {0};
529  BOOL Ret;
530 
531  /* Register the MMCMainFrame window class */
532  wc.cbSize = sizeof(WNDCLASSEX);
533  wc.style = 0;
535  wc.cbClsExtra = 0;
536  wc.cbWndExtra = sizeof(PCONSOLE_MAINFRAME_WND);
537  wc.hInstance = hAppInstance;
540  wc.hCursor = LoadCursor(NULL,
542  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
543  wc.lpszMenuName = NULL;
545 
546  Ret = (RegisterClassEx(&wc) != (ATOM)0);
547 
548  if (Ret)
549  {
550  /* Register the MMCChildFrm window class */
551  wc.cbSize = sizeof(WNDCLASSEX);
552  wc.style = CS_HREDRAW | CS_VREDRAW;
554  wc.cbClsExtra = 0;
555  wc.cbWndExtra = sizeof(PCONSOLE_CHILDFRM_WND);
556  wc.hInstance = hAppInstance;
559  wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
560  wc.lpszMenuName = NULL;
563 
564  Ret = (RegisterClassEx(&wc) != (ATOM)0);
565  if (!Ret)
566  {
568  hAppInstance);
569  }
570  }
571 
572  return Ret;
573 }
UINT style
Definition: winuser.h:3192
#define MAKEINTRESOURCE
Definition: winuser.h:591
LPCSTR lpszMenuName
Definition: winuser.h:3200
#define RegisterClassEx
Definition: winuser.h:5827
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HCURSOR hCursor
Definition: winuser.h:3198
WNDPROC lpfnWndProc
Definition: winuser.h:3193
LPCSTR lpszClassName
Definition: winuser.h:3201
WORD ATOM
Definition: dimm.idl:113
static const TCHAR szMMCMainFrame[]
Definition: console.c:55
static LRESULT CALLBACK ConsoleChildFrmProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:479
#define CS_HREDRAW
Definition: winuser.h:648
#define IDI_APPLICATION
Definition: winuser.h:699
HICON hIconSm
Definition: winuser.h:3202
static LRESULT CALLBACK ConsoleMainFrameWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:398
#define COLOR_3DFACE
Definition: winuser.h:923
HINSTANCE hInstance
Definition: winuser.h:3196
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT cbSize
Definition: winuser.h:3191
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
HBRUSH hbrBackground
Definition: winuser.h:3199
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3195
HICON hIcon
Definition: winuser.h:3197
#define COLOR_BTNFACE
Definition: winuser.h:922
#define LoadCursor
Definition: winuser.h:5802
int cbClsExtra
Definition: winuser.h:3194
static const TCHAR szMMCChildFrm[]
Definition: console.c:56
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5709
#define LoadIcon
Definition: winuser.h:5803
#define UnregisterClass
Definition: winuser.h:5851
HINSTANCE hAppInstance
Definition: mmc.c:23
#define IDI_MAINAPP
Definition: resource.h:6

Referenced by _tWinMain().

◆ SetFileName()

static VOID SetFileName ( PCONSOLE_CHILDFRM_WND  Info,
PWSTR  pFileName 
)
static

Definition at line 180 of file console.c.

183 {
184  DPRINT1("SetFileName(&p \'%S\')\n", Info, pFileName);
185 
186  if (Info->pFileName != NULL)
187  {
188  HeapFree(GetProcessHeap(), 0, Info->pFileName);
189  Info->pFileName = NULL;
190  }
191 
192  if (pFileName != NULL)
193  {
194  Info->pFileName = HeapAlloc(GetProcessHeap(),
195  0,
196  (_tcslen(pFileName) + 1) * sizeof(TCHAR));
197  if (Info->pFileName != NULL)
198  _tcscpy(Info->pFileName, pFileName);
199  }
200 }
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by DIALOG_FileSaveAs(), DoCloseFile(), DoOpenFile(), DoSaveFile(), and DoSaveFileAs().

◆ UnregisterMMCWndClasses()

VOID UnregisterMMCWndClasses ( VOID  )

Definition at line 576 of file console.c.

577 {
579  hAppInstance);
581  hAppInstance);
582 }
static const TCHAR szMMCMainFrame[]
Definition: console.c:55
static const TCHAR szMMCChildFrm[]
Definition: console.c:56
#define UnregisterClass
Definition: winuser.h:5851
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by _tWinMain().

Variable Documentation

◆ NewConsoleCount

ULONG NewConsoleCount = 0
static

Definition at line 58 of file console.c.

Referenced by CreateNewConsoleTitle().

◆ szMMCChildFrm

const TCHAR szMMCChildFrm[] = TEXT("MMCChildFrm")
static

Definition at line 56 of file console.c.

Referenced by CreateNewMDIChild(), RegisterMMCWndClasses(), and UnregisterMMCWndClasses().

◆ szMMCMainFrame

const TCHAR szMMCMainFrame[] = TEXT("MMCMainFrame")
static

Definition at line 55 of file console.c.

Referenced by CreateConsoleWindow(), RegisterMMCWndClasses(), and UnregisterMMCWndClasses().