ReactOS 0.4.17-dev-1183-g3b30a2a
CMainWnd.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Management Console
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Main window class
5 * COPYRIGHT: Copyright 2006-2007 Thomas Weidenmueller
6 * Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
7 * Copyright 2026 Eric Kohl (eric.kohl@reactos.org)
8 */
9
10#include "precomp.h"
11
13{
14 { BTN_UNDO, IDM_TB_UNDO, 0, BTNS_BUTTON, {0}, 0, 0 },
15 { BTN_REDO, IDM_TB_REDO, 0, BTNS_BUTTON, {0}, 0, 0 },
16 { 4, IDC_STATIC, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0 },
19 { 4, IDC_STATIC, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0 },
21 { 4, IDC_STATIC, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0 },
24};
25
27 : m_ConsoleNumber(0)
28 , m_DocumentMode(DocumentMode_Author)
29 , m_LogicalReadOnly(FALSE)
30 , m_PreventViewCustomization(FALSE)
31 , m_bToolBarVisible(true)
32 , m_NextViewId(1)
33 , m_RootNode(NULL)
34 , m_NextNodeId(1)
35 , m_TempNodeMap(NULL)
36{
38 m_pfnSuperWindowProc = m_FrameThunk.GetWNDPROC();
40 m_hMenuConsoleSmall = LoadMenu(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDM_CONSOLE_SMALL));
41 m_hMenuConsoleLarge = LoadMenu(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDM_CONSOLE_LARGE));
45 0,
46 4);
47
51 0,
52 4);
53
54 HBITMAP hToolBarBitmap = LoadBitmapW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDB_TOOLBAR));
56 hToolBarBitmap,
57 RGB(0,0,0));
58 DeleteObject(hToolBarBitmap);
59
62}
63
65{
71}
72
75{
77 LPCTSTR lpFileName = (LPCTSTR)(((LPCREATESTRUCT)lParam)->lpCreateParams);
78 RECT rect;
79
81
82 /* Create and initialize the Toolbar */
84 m_ToolBar.Create(m_hWnd,
86 0);
87
88 m_ToolBar.SendMessageW(TB_SETBITMAPSIZE, 0, MAKELONG(16, 16));
89 m_ToolBar.SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
90
93
94 m_ToolBar.GetClientRect(&rect);
96
99
100 /* Create the MDI client window */
103
107
108 if (lpFileName == NULL)
109 {
111 }
112 return 0;
113}
114
117{
118 UpdateLayout();
119 return 0;
120}
121
124{
125 UpdateLayout();
126 UpdateTitle();
127 UpdateMenu();
128 return 0;
129}
130
133{
135 SetMenu(NULL);
136 return 0;
137}
138
141{
143 return 0;
144}
145
148{
149 NMHDR *phdr = (NMHDR *)lParam;
150 switch (phdr->code)
151 {
152 case TBN_GETINFOTIP:
153 {
155
156 CAtlString toolTipText(MAKEINTRESOURCE(lptbgit->iItem));
157 wcscpy(lptbgit->pszText, toolTipText.GetString());
158 }
159 break;
160 }
161
162 return 0;
163}
164
167{
169 if (child == NULL)
170 return 0;
171
172 UINT menuItem = LOWORD(wParam);
173// UINT flags = HIWORD(wParam);
174// HMENU hMenu = (HMENU)lParam;
175 CAtlString menuText(MAKEINTRESOURCE(menuItem));
176 child->SetStatusBarText(menuText.GetString());
177 return 0;
178}
179
181CMainWnd::OnFileNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
182{
184// CAtlString nodeGuid(L"{C96401CC-0E17-11D3-885B-00C04F72C717}");
185
186 /* Close all views */
187 POSITION pos = m_ViewList.GetHeadPosition();
188 while (pos)
189 {
190 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
191 console->SendMessage(WM_CLOSE, 0, 0);
192 }
193
194 InitMain();
195
196 /* Create a new snapin root node */
197 CSnapinCacheEntry *CacheEntry = GetSnapinCacheEntryByGuid((PWSTR)L"{C96401CC-0E17-11D3-885B-00C04F72C717}");
198 if (!CacheEntry)
199 {
200 DPRINT1("No folder cache entry!\n");
201 return 0;
202 }
203
204 m_RootNode = new CSnapin(CacheEntry, m_NextNodeId++, rootName.GetString());
205 if (!CacheEntry)
206 {
207 DPRINT1("No root folder!\n");
208 return 0;
209 }
210
213
214 return 1;
215}
216
218CMainWnd::OnFileOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
219{
220 OPENFILENAME openas;
222
223 ZeroMemory(&openas, sizeof(openas));
224 wcscpy(szPath, L"");
225
226 openas.lStructSize = sizeof(OPENFILENAME);
227 openas.hwndOwner = m_hWnd;
228 openas.hInstance = _AtlBaseModule.GetModuleInstance();
229 openas.lpstrFilter = L"MSC Files (*.msc)\0*.msc\0All Files (*.*)\0*.*\0";
230 openas.lpstrFile = szPath;
231 openas.nMaxFile = MAX_PATH;
233 openas.lpstrDefExt = L"msc";
234
235 if (GetOpenFileNameW(&openas))
236 {
237 /* Close all views */
238 POSITION pos = m_ViewList.GetHeadPosition();
239 while (pos)
240 {
241 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
242 console->SendMessage(WM_CLOSE, 0, 0);
243 }
244
245 InitMain();
246
249 if (ret == ERROR_SUCCESS)
250 {
253 }
254 }
255
256 return 0;
257}
258
260CMainWnd::OnFileSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
261{
263 if (child == NULL)
264 return 0;
265
266 if (m_Filename.IsEmpty())
267 return OnFileSaveAs(wNotifyCode, wID, hWndCtl, bHandled);
268
269 return SaveMscFile(m_Filename);
270}
271
273CMainWnd::OnFileSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
274{
275 OPENFILENAME saveas;
277
279 if (child == NULL)
280 return 0;
281
282 ZeroMemory(&saveas, sizeof(saveas));
283 if (!m_Filename.IsEmpty())
284 {
286 }
287 else
288 {
289 child->GetWindowText(szPath, MAX_PATH);
291 wcscat(szPath, L".msc");
292 }
293
294 saveas.lStructSize = sizeof(OPENFILENAME);
295 saveas.hwndOwner = m_hWnd;
296 saveas.hInstance = _AtlBaseModule.GetModuleInstance();
297 saveas.lpstrFilter = L"MSC Files (*.msc)\0*.msc\0All Files (*.*)\0*.*\0";
298 saveas.lpstrFile = szPath;
299 saveas.nMaxFile = MAX_PATH;
301 saveas.lpstrDefExt = L"msc";
302
303 if (GetSaveFileNameW(&saveas))
304 {
307 if (ret == ERROR_SUCCESS)
309 return ret;
310 }
311
312 return 0;
313}
314
316CMainWnd::OnFileAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
317{
319 if (child == NULL)
320 return 0;
321 CAddDialog dlg(this, child);
322 if (dlg.DoModal(m_hWnd, (LPARAM)child) == IDOK)
323 {
324 UpdateViews();
325 }
326
327 return 0;
328}
329
331CMainWnd::OnFileOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
332{
334 if (child == NULL)
335 return 0;
336 COptionsDialog dlg(this, child);
337 dlg.DoModal(m_hWnd, (LPARAM)child);
338 return 0;
339}
340
342CMainWnd::OnFileRecent(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
343{
345
346 mi.cbSize = sizeof(MENUITEMINFOW);
347 mi.fMask = MIIM_DATA;
348 if (GetMenuItemInfoW(GetMenu(), wID, FALSE, &mi))
349 {
350 CRecentFileEntry *FileEntry = (CRecentFileEntry *)mi.dwItemData;
351
352 /* Close all views */
353 POSITION pos = m_ViewList.GetHeadPosition();
354 while (pos)
355 {
356 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
357 console->SendMessage(WM_CLOSE, 0, 0);
358 }
359
360 InitMain();
361
362 LRESULT ret = LoadMscFile(FileEntry->FileName());
363 if (ret == ERROR_SUCCESS)
364 {
365 AddToRecentFiles(FileEntry->FileName());
367 }
368 }
369
370 return 0;
371}
372
374CMainWnd::OnFileExit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
375{
376 PostMessage(WM_CLOSE, 0, 0);
377 return 0;
378}
379
381CMainWnd::OnActionNewWindow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
382{
384 if (child == NULL)
385 return 0;
386
387 child->OnActionNewWindow(wNotifyCode, wID, hWndCtl, bHandled);
388
389 return 0;
390}
391
393CMainWnd::OnActionRename(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
394{
396 if (child == NULL)
397 return 0;
398
399 child->OnActionRename(wNotifyCode, wID, hWndCtl, bHandled);
400
401 return 0;
402}
403
405CMainWnd::OnViewMode(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
406{
408 if (child == NULL)
409 return 0;
410
411 child->SetListViewMode(CmdIdToViewMode(wID));
415 wID,
417
418 return 0;
419}
420
422CMainWnd::OnViewCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
423{
425 if (child == NULL)
426 return 0;
427
428 CCustomizeDialog dlg2(this, child);
429 dlg2.DoModal(m_hWnd, (LPARAM)child);
430 return 0;
431}
432
434CMainWnd::OnWindowsNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
435{
437 return 0;
438}
439
441CMainWnd::OnWindowsCascade(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
442{
444 return 0;
445}
446
448CMainWnd::OnWindowsTile(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
449{
451 return 0;
452}
453
455CMainWnd::OnWindowsArrange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
456{
458 return 0;
459}
460
462CMainWnd::OnHelpAboutMMC(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
463{
464 HICON hIcon = LoadIcon(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAINAPP));
467 CAtlString TitleString;
468
469 TitleString = AboutTitle;
470 TitleString += L"#";
471 TitleString += AppTitle;
472
473 ::ShellAboutW(this->m_hWnd, (LPWSTR)TitleString.GetString(), NULL, hIcon);
474
475 return 0;
476}
477
479CMainWnd::OnHelpAboutSnapin(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
480{
482
483 mi.cbSize = sizeof(MENUITEMINFOW);
484 mi.fMask = MIIM_DATA;
485 if (GetMenuItemInfoW(GetMenu(), wID, FALSE, &mi))
486 {
487 CSnapin *Snapin = (CSnapin *)mi.dwItemData;
488
489 CAboutSnapinDialog dlg(this, Snapin);
490 dlg.DoModal(m_hWnd, (LPARAM)0);
491 }
492
493 return 0;
494}
495
497CMainWnd::OnToolbarSelectParent(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
498{
500 if (child == NULL)
501 return 0;
502
503 child->SelectParent();
504 return 0;
505}
506
508CMainWnd::OnToolbarScopePane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
509{
511 if (child == NULL)
512 return 0;
513
514 child->SetTreeViewVisible(!child->IsTreeViewVisible());
515 return 0;
516}
517
519CMainWnd::OnToolbarActionsPane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
520{
522 if (child == NULL)
523 return 0;
524
525 child->SetActionsPaneVisible(!child->IsActionsPaneVisible());
526 return 0;
527}
528
530CMainWnd::OnMDIForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
531{
533 if (hChild)
534 {
535 WPARAM wParam = MAKEWPARAM(wNotifyCode, wID);
536 LPARAM lParam = (LPARAM)hWndCtl;
538 }
539 return 0;
540}
541
542BOOL
544{
546 HWND hChild;
547
548 mcs.szTitle = RootNode->DisplayName().GetString();
550 mcs.hOwner = _AtlBaseModule.GetModuleInstance();
551 mcs.x = mcs.cx = CW_USEDEFAULT;
552 mcs.y = mcs.cy = CW_USEDEFAULT;
553 mcs.style = MDIS_ALLCHILDSTYLES;
554 BOOL bMaximized = FALSE;
555 HWND hWndOld = (HWND)m_MDIClient.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized);
556 mcs.lParam = bMaximized || !hWndOld;
557 /* This object registers itself in the _AtlWinModule to be assigned to the next window created */
558 CConsoleWnd* child = new CConsoleWnd(this, RootNode, SelectedNode);
559 /* Ask for a new MDI Child window */
561 if (!hChild)
562 {
563 delete child;
564 return FALSE;
565 }
566
567 UpdateLayout();
568 UpdateTitle();
569 UpdateMenu();
570 UpdateViewMenu(child->GetListViewMode());
571
572 return TRUE;
573}
574
576{
577 return &m_ConsoleTitle;
578}
579
581{
582 m_ConsoleTitle = consoleTitle;
583 SetWindowTextW(consoleTitle.GetString());
584}
585
586BOOL
588{
589 return m_bToolBarVisible;
590}
591
592VOID
594{
595 m_bToolBarVisible = bVisible;
596 UpdateLayout();
597}
598
599BOOL
601{
603}
604
605VOID
607{
608 m_bStandardMenusVisible = bVisible;
609// m_MainWnd->UpdateMenu(m_bStandardMenusVisible);
610// UpdateLayout();
611}
612
615{
616 CRegKey SnapinsKey;
617 if (ERROR_SUCCESS == SnapinsKey.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MMC\\SnapIns", KEY_READ))
618 {
619 WCHAR namebuf[MAX_PATH];
620 DWORD index = 0, namelen = _countof(namebuf);
621 while (ERROR_SUCCESS == SnapinsKey.EnumKey(index++, namebuf, &namelen))
622 {
623 DPRINT1("%S\n", namebuf);
624 CSnapinCacheEntry* snapin = CSnapinCacheEntry::Create(SnapinsKey, namebuf, m_hSnapinImageList);
625 DPRINT1("CacheEntry %p\n", snapin);
626 if (snapin)
627 {
628 m_SnapinCache.Add(snapin);
629 }
630 namelen = _countof(namebuf);
631 }
632 SnapinsKey.Close();
633 }
634 return S_OK;
635}
636
637int
639{
640 return m_SnapinCache.GetSize();
641}
642
645{
646 return m_SnapinCache[nIndex];
647}
648
651{
652 for (int i = 0; i < m_SnapinCache.GetSize(); i++)
653 {
655 if (entry->GuidString().CompareNoCase(pszGuid) == 0)
656 return entry;
657 }
658 return NULL;
659}
660
663{
664 return m_hSnapinImageList;
665}
666
667CSnapin *
669{
670 return m_RootNode;
671}
672
673VOID
675{
676 m_ViewList.AddTail(pView);
677 if (pView->m_ViewId == 0)
678 pView->m_ViewId = m_NextViewId++;
679 else if (m_NextViewId <= pView->m_ViewId)
680 m_NextViewId = pView->m_ViewId + 1;
681}
682
683VOID
685{
686 POSITION pos = m_ViewList.Find(pView);
687 if (pos)
688 {
689 m_ViewList.RemoveAt(pos);
690 pView->m_ViewId = 0;
691 }
692}
693
694UINT
696{
697 return m_NextNodeId++;
698}
699
700VOID
702{
703 if (NodeId >= m_NextNodeId)
704 m_NextNodeId = NodeId + 1;
705}
706
707VOID
709{
710 CConsoleWnd *console;
712
713 pos = m_ViewList.GetHeadPosition();
714 while (pos)
715 {
716 console = (CConsoleWnd*)m_ViewList.GetNext(pos);
717 if (console)
718 console->UpdateView();
719 }
720}
721
722VOID
724{
725 RECT rcClient, rcToolBar = {0, 0, 0, 0};
726 GetClientRect(&rcClient);
727
728 int nToolBarFlags = SWP_NOZORDER;
729 if (m_bToolBarVisible && !m_ViewList.IsEmpty())
730 {
731 rcClient.top += m_iToolBarHeight;
732 rcClient.bottom -= m_iToolBarHeight;
733
734 rcToolBar.right = rcClient.right;
735 rcToolBar.bottom = m_iToolBarHeight;
736 nToolBarFlags |= SWP_SHOWWINDOW;
737 }
738 else
739 {
740 nToolBarFlags |= SWP_HIDEWINDOW;
741 }
742
743 m_ToolBar.SetWindowPos(NULL, rcToolBar.left, rcToolBar.top, rcToolBar.right, rcToolBar.bottom, nToolBarFlags);
744
745 m_MDIClient.SetWindowPos(NULL, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom, SWP_NOZORDER);
746}
747
748VOID
750{
751 if (m_ViewList.IsEmpty())
752 {
754 }
755 else
756 {
759 }
760}
761
762VOID
764{
765 if (m_ViewList.IsEmpty())
767 else
770}
771
774{
775 return m_DocumentMode;
776}
777
778void
780{
781 m_DocumentMode = DocumentMode;
782}
783
784BOOL
786{
787 return m_LogicalReadOnly;
788}
789
790void
792{
793 m_LogicalReadOnly = LogicalReadOnly;
794}
795
796BOOL
798{
800}
801
802void
804{
805 m_PreventViewCustomization = PreventCustomization;
806}
807
808VOID
810{
811 HMENU hMenu = GetMenu();
812
814
815 if (Snapin)
816 {
820
821 ValueName.Format(AboutString.GetString(), Snapin->Name().GetString());
822
823 mi.cbSize = sizeof(MENUITEMINFOW);
825 mi.fType = MFT_STRING;
827
828 mi.dwTypeData = ValueName.GetString();
829 mi.dwItemData = (ULONG_PTR)Snapin;
830
831 /* FIXME: Append this menu item */
833 }
834}
835
836VOID
838{
842 ViewModeToCmdId(ListViewMode),
844}
845
846VOID
848{
850}
851
852VOID
853CMainWnd::UpdateToolbuttons(BOOL bTreeViewVisible, BOOL bActionsPaneVisible)
854{
855 m_ToolBar.CheckButton(IDM_TB_SCOPE_PANE, bTreeViewVisible);
856 m_ToolBar.CheckButton(IDM_TB_ACTIONS_PANE, bActionsPaneVisible);
857}
858
859VOID
861{
863 HMENU hMenu = GetMenu();
864
865 mi.cbSize = sizeof(MENUITEMINFOW);
867 mi.fType = MFT_STRING;
868 mi.wID = IDM_FILE_RECENT1;
869
871
872 INT i = 0;
874 POSITION pos = m_RecentFilesList.GetHeadPosition();
875 while (pos != NULL)
876 {
878
879 CRecentFileEntry *FileEntry = m_RecentFilesList.GetNext(pos);
880 ValueName.Format(L"%d %s", i + 1, FileEntry->DisplayName().GetString());
881 mi.dwTypeData = ValueName.GetString();
882 mi.dwItemData = (ULONG_PTR)FileEntry;
883
885 mi.wID++;
886
887 i++;
888 if (i >= MAX_RECENT_FILES)
889 break;
890 }
891
892 mi.fType = MFT_SEPARATOR;
893 mi.fMask = MIIM_FTYPE | MIIM_ID;
895}
896
897VOID
899{
900 CRegKey RecentFilesKey;
901 if (ERROR_SUCCESS == RecentFilesKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MMC_NEW\\Recent Files List", KEY_READ))
902 {
903 WCHAR pathBuf[MAX_PATH];
904 ULONG pathLength, i;
905 DWORD err;
906
907 CAtlString valueName;
908 CAtlString fileName;
909
910 for (i = 0; i < MAX_RECENT_FILES; i++)
911 {
912 valueName.Format(L"File%u", i + 1);
913 pathLength = _countof(pathBuf);
914 err = RecentFilesKey.QueryStringValue(valueName.GetString(),
915 pathBuf,
916 &pathLength);
917 if (err == ERROR_SUCCESS)
918 {
919 CAtlString fileName(pathBuf);
920 m_RecentFilesList.AddTail(new CRecentFileEntry(fileName));
921 }
922 }
923
924 RecentFilesKey.Close();
925 }
926
928}
929
930VOID
932{
933 POSITION pos = m_RecentFilesList.GetHeadPosition();
934 while (pos != NULL)
935 {
937 if (ValueData->FileName() == FileName)
938 break;
939
940 m_RecentFilesList.GetNext(pos);
941 }
942
943 if (pos == NULL)
944 {
945 /* Insert at top */
947 if (m_RecentFilesList.GetCount() > 4)
948 m_RecentFilesList.RemoveTail();
949 }
950 else
951 {
952 /* Move to top */
953 /* m_RecentFilesList.MoveToHead(pos); */
955 m_RecentFilesList.RemoveAt(pos);
957 }
958
959 /* Update the registry key */
960 CRegKey RecentFilesKey;
961 if (ERROR_SUCCESS == RecentFilesKey.Create(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MMC_NEW\\Recent Files List"))
962 {
963 INT count = 0;
965 pos = m_RecentFilesList.GetHeadPosition();
966 while (pos != NULL)
967 {
969 ValueName.Format(L"File%u", count + 1);
970 RecentFilesKey.SetStringValue(ValueName, ValueData->FileName().GetString());
971 count++;
972 if (count >= MAX_RECENT_FILES)
973 break;
974 }
975
976 RecentFilesKey.Close();
977 }
978
980}
981
982DWORD
984{
985 DWORD_PTR args[1] = { (DWORD_PTR)Number };
987
988 str.LoadString(IDS_CONSOLETITLE);
989
991 str.GetString(), 0, 0, pBuffer, dwSize, (va_list*)args);
992}
993
996{
997 IXMLDOMElement *pRootNode = NULL;
998 IXMLDOMElement *pNode = NULL;
999 IXMLDOMElement *pFrameStateNode = NULL;
1000 IXMLDOMElement *pViewsNode = NULL;
1001 IXMLDOMElement *pScopeTreeNode = NULL;
1002 IXMLDOMElement *pSnapinCacheNode = NULL;
1003 IXMLDOMElement *pSnapinNode = NULL;
1004 IXMLDOMElement *pNodesNode = NULL;
1005 POSITION pos;
1006 CConsoleWnd* console;
1007 HRESULT hr = S_OK;
1008
1009 MscFile *mscFile = new MscFile(FileName.GetString());
1010
1011 CHK_HR(mscFile->CreateAndInitDOM());
1012
1013 /* <?xml version="1.0"?> */
1014 CHK_HR(mscFile->CreateAndAddPINode(L"xml", L"version='1.0'"));
1015
1016 /* <MMC_ConsoleFile ConsoleVersion="2.0" ProgramMode="Author"> */
1017 CHK_HR(mscFile->CreateElement(L"MMC_ConsoleFile", &pRootNode));
1018 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ConsoleVersion", L"2.0", pRootNode));
1019 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ProgramMode", ::DocumentModeToString(m_DocumentMode), pRootNode));
1020
1021 /* <ConsoleFileID> */
1022 CHK_HR(mscFile->CreateAndAddElementNode(L"ConsoleFileID", pRootNode, &pNode));
1023 CHK_HR(mscFile->CreateAndAddTextNode(L"{Random GUID}", pNode));
1024 SAFE_RELEASE(pNode); /* </ConsoleFileID> */
1025
1026 /* <FrameState> */
1027 CHK_HR(mscFile->CreateAndAddElementNode(L"FrameState", pRootNode, &pFrameStateNode));
1028 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ShowStatusBar", L"true", pFrameStateNode));
1030 CHK_HR(mscFile->CreateAndAddAttributeNode(L"LogicalReadOnly", L"true", pFrameStateNode));
1032 CHK_HR(mscFile->CreateAndAddAttributeNode(L"PreventViewCustomization", L"true", pFrameStateNode));
1033
1034 mscFile->SaveWindowPlacement(this, pFrameStateNode);
1035
1036 SAFE_RELEASE(pFrameStateNode); /* </FrameState> */
1037
1038 /* <Views> */
1039 CHK_HR(mscFile->CreateAndAddElementNode(L"Views", pRootNode, &pViewsNode));
1040 pos = m_ViewList.GetHeadPosition();
1041 do
1042 {
1043 console = (CConsoleWnd*)m_ViewList.GetNext(pos);
1044 if (console)
1045 console->SaveView(mscFile, pViewsNode);
1046
1047 } while (pos != NULL);
1048 SAFE_RELEASE(pViewsNode); /* </Views> */
1049
1050 /* <ScopeTree> */
1051 CHK_HR(mscFile->CreateAndAddElementNode(L"ScopeTree", pRootNode, &pScopeTreeNode));
1052
1053 /* <SnapinCache> */
1054 CHK_HR(mscFile->CreateAndAddElementNode(L"SnapinCache", pScopeTreeNode, &pSnapinCacheNode));
1055
1056 for (int i = 0; i < GetSnapinCacheCount(); i++)
1057 {
1059 if (entry)
1060 {
1061 /* <Snapin> */
1062 CHK_HR(mscFile->CreateAndAddElementNode(L"Snapin", pSnapinCacheNode, &pSnapinNode));
1063 CHK_HR(mscFile->CreateAndAddAttributeNode(L"CLSID", entry->GuidString().GetString(), pSnapinNode));
1064 CHK_HR(mscFile->CreateAndAddAttributeNode(L"AllExtensionsEnabled", L"true", pSnapinNode)); /* FIXME */
1065 CHK_HR(mscFile->CreateAndAddAttributeNode(L"Name", entry->Name().GetString(), pSnapinNode));
1066 CHK_HR(mscFile->CreateAndAddAttributeNode(L"Provider", entry->Provider().GetString(), pSnapinNode));
1067 SAFE_RELEASE(pSnapinNode); /* </Snapin> */
1068 }
1069 }
1070 SAFE_RELEASE(pSnapinCacheNode); /* </SnapinCache> */
1071
1072 /* <Nodes> */
1073 CHK_HR(mscFile->CreateAndAddElementNode(L"Nodes", pScopeTreeNode, &pNodesNode));
1074 if (m_RootNode)
1075 m_RootNode->SaveNode(mscFile, pNodesNode);
1076 SAFE_RELEASE(pNodesNode); /* </Nodes> */
1077
1078 SAFE_RELEASE(pScopeTreeNode); /* </ScopeTree> */
1079
1080 CHK_HR(mscFile->AppendChildToParent(pRootNode));
1081
1082 CHK_HR(mscFile->SaveDOM());
1083
1084CleanUp:
1085 SAFE_RELEASE(pRootNode); /* </MMC_ConsoleFile> */
1086
1087 delete mscFile;
1088
1089 return 0;
1090}
1091
1092LRESULT
1094{
1095 IXMLDOMElement *pRootElement = NULL;
1096 IXMLDOMElement *pFrameStateElement = NULL;
1097 VARIANT ProgramMode;
1098 HRESULT hr = S_OK;
1099
1101
1102 VariantInit(&ProgramMode);
1103
1107
1108 MscFile *mscFile = new MscFile(FileName.GetString());
1109
1110 hr = mscFile->CreateAndInitDOM();
1111 if (FAILED(hr))
1112 goto done;
1113
1114 hr = mscFile->LoadDOM();
1115 if (FAILED(hr))
1116 goto done;
1117
1118 hr = mscFile->CheckMscFile(&pRootElement);
1119 if (hr != S_OK)
1120 goto done;
1121
1122 hr = mscFile->GetAttribute(pRootElement, (LPWSTR)L"ProgramMode", &ProgramMode);
1123 if (hr != S_OK)
1124 goto done;
1125
1127 if (hr != S_OK)
1128 goto done;
1129
1130 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"FrameState", &pFrameStateElement);
1131 if (hr != S_OK)
1132 goto done;
1133
1135 {
1136 VARIANT LogicalReadOnly, PreventViewCustomization;
1137
1138 VariantInit(&LogicalReadOnly);
1139 VariantInit(&PreventViewCustomization);
1140
1141 hr = mscFile->GetAttribute(pFrameStateElement, (LPWSTR)L"LogicalReadOnly", &LogicalReadOnly);
1142 if ((hr == S_OK) && (_wcsicmp(V_BSTR(&LogicalReadOnly), L"true") == 0))
1144
1145 hr = mscFile->GetAttribute(pFrameStateElement, (LPWSTR)L"PreventViewCustomization", &PreventViewCustomization);
1146 if ((hr == S_OK) && (_wcsicmp(V_BSTR(&PreventViewCustomization), L"true") == 0))
1148
1149 VariantClear(&LogicalReadOnly);
1150 VariantClear(&PreventViewCustomization);
1151 hr = S_OK;
1152 }
1153
1154 hr = mscFile->ParseWindowPlacement(this, pFrameStateElement);
1155 if (hr != S_OK)
1156 goto done;
1157
1158 /* FIXME Parse other frame settings */
1159
1160 /* Parse the ScopeTree element */
1161 hr = ParseScopeTree(mscFile, pRootElement);
1162 if (hr != S_OK)
1163 goto done;
1164
1165 /* Parse the Views element */
1166 hr = ParseViewsElement(mscFile, pRootElement);
1167 if (hr != S_OK)
1168 goto done;
1169
1170done:
1171 VariantClear(&ProgramMode);
1172
1173 if (pFrameStateElement)
1174 pFrameStateElement->Release();
1175
1176 if (pRootElement)
1177 pRootElement->Release();
1178
1179 delete m_TempNodeMap;
1181
1182 delete mscFile;
1183
1184 if (hr == S_FALSE)
1185 {
1186// ::MessageBox(NULL, L"Invalid file!", FileName.GetString(), MB_OK);
1187 }
1188 else if (hr != S_OK)
1189 {
1190// ::MessageBox(NULL, L"Failure!", FileName.GetString(), MB_OK);
1191 }
1192
1193 return ERROR_SUCCESS;
1194}
1195
1196HRESULT
1198{
1199 IXMLDOMElement *pScopeTreeElement = NULL;
1200 IXMLDOMElement *pNodesElement = NULL;
1201 IXMLDOMElement *pNodeElement = NULL;
1202 HRESULT hr = S_OK;
1203
1204 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"ScopeTree", &pScopeTreeElement);
1205 if (hr != S_OK)
1206 goto done;
1207
1208 /* Fixme: SnapinCache Element */
1209
1210 /* Nodes Element */
1211 hr = mscFile->GetElement(pScopeTreeElement, (LPWSTR)L"Nodes", &pNodesElement);
1212 if (hr != S_OK)
1213 goto done;
1214
1215 hr = mscFile->GetElement(pNodesElement, (LPWSTR)L"Node", &pNodeElement);
1216 if (hr != S_OK)
1217 goto done;
1218
1219 hr = CSnapin::ParseSnapin(this, mscFile, pNodeElement, &m_RootNode);
1220
1221done:
1222 if (pNodeElement)
1223 pNodeElement->Release();
1224
1225 if (pNodesElement)
1226 pNodesElement->Release();
1227
1228 if (pScopeTreeElement)
1229 pScopeTreeElement->Release();
1230
1231 return hr;
1232}
1233
1234HRESULT
1236{
1237 IXMLDOMElement *pViewsElement = NULL;
1238 IXMLDOMNodeList *pChildList = NULL;
1239 IXMLDOMNode *nextItem;
1241 BSTR NodeName = NULL;
1242 HRESULT hr = S_OK;
1243
1244 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"Views", &pViewsElement);
1245 if (hr != S_OK)
1246 goto done;
1247
1248 hr = pViewsElement->get_childNodes(&pChildList);
1249 if (FAILED(hr))
1250 goto done;
1251
1252 for (;;)
1253 {
1254 hr = pChildList->nextNode(&nextItem);
1255 if (hr == S_FALSE)
1256 {
1257 hr = S_OK;
1258 break;
1259 }
1260
1261 hr = nextItem->get_nodeType(&NodeType);
1262 if (hr == S_OK)
1263 {
1264 if (NodeType == NODE_ELEMENT)
1265 {
1266 NodeName = NULL;
1267 hr = nextItem->get_baseName(&NodeName);
1268 if (hr == S_OK)
1269 {
1270 if (_wcsicmp(NodeName, L"View") == 0)
1271 {
1272 CConsoleWnd::ParseView(this, mscFile, (IXMLDOMElement *)nextItem);
1273 }
1274 SysFreeString(NodeName);
1275 NodeName = NULL;
1276 }
1277 }
1278 }
1279
1280 nextItem->Release();
1281 }
1282
1283done:
1284 if (pChildList)
1285 pChildList->Release();
1286
1287 if (NodeName)
1288 SysFreeString(NodeName);
1289
1290 if (pViewsElement)
1291 pViewsElement->Release();
1292
1293 return hr;
1294}
static TBBUTTON TbButtons[]
Definition: CMainWnd.cpp:12
#define BTN_SCOPE_PANE
Definition: CMainWnd.h:16
#define BTN_REDO
Definition: CMainWnd.h:14
#define BTN_ACTIONS_PANE
Definition: CMainWnd.h:19
#define BTN_UNDO
Definition: CMainWnd.h:13
#define BTN_HELP
Definition: CMainWnd.h:18
#define BTN_EXPORT_LIST
Definition: CMainWnd.h:17
#define MAX_RECENT_FILES
Definition: CMainWnd.h:21
#define BTN_UP
Definition: CMainWnd.h:15
NodeType
Definition: Node.h:6
static struct myctx * mcs
Definition: adnstest.c:53
#define IDC_STATIC
Definition: resource.h:4
#define IDM_CONSOLE_SMALL
Definition: resource.h:8
#define IDI_MAINAPP
Definition: resource.h:6
#define IDM_FILE_NEW
Definition: resource.h:11
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define IDM_CONSOLE_LARGE
Definition: resource.h:9
#define IDS_CONSOLETITLE
Definition: resource.h:4
#define IDM_FILE_EXIT
Definition: resource.h:15
#define IDS_APPTITLE
Definition: resource.h:3
UINT ViewModeToCmdId(LISTVIEW_MODE ListViewMode)
Definition: misc.cpp:11
LPWSTR DocumentModeToString(DOCUMENT_MODE DocumentMode)
Definition: misc.cpp:206
HRESULT StringToDocumentMode(_In_ LPWSTR pszDocumentMode, _Out_ PDOCUMENT_MODE pDocumentMode)
Definition: misc.cpp:228
LISTVIEW_MODE CmdIdToViewMode(UINT CmdId)
Definition: misc.cpp:39
@ DocumentMode_Author
Definition: precomp.h:43
enum _LISTVIEW_MODE LISTVIEW_MODE
enum _DOCUMENT_MODE DOCUMENT_MODE
#define IDB_TOOLBAR
Definition: resource.h:19
#define IDM_VIEW_LARGE_ICONS
Definition: resource.h:45
#define IDM_FILE_RECENT1
Definition: resource.h:33
#define IDS_CONSOLEROOT
Definition: resource.h:113
#define IDM_FILE_RECENT_SEP
Definition: resource.h:37
#define IDM_TB_ACTIONS_PANE
Definition: resource.h:70
#define IDM_TB_REDO
Definition: resource.h:65
#define IDM_HELP_ABOUT_MMC
Definition: resource.h:60
#define IDM_HELP_ABOUT_SNAPIN
Definition: resource.h:61
#define IDM_TB_UP
Definition: resource.h:66
#define IDM_TB_EXPORT_LIST
Definition: resource.h:68
#define IDM_TB_UNDO
Definition: resource.h:64
#define IDM_TB_HELP
Definition: resource.h:69
#define IDS_ABOUTTITLE
Definition: resource.h:15
#define IDM_VIEW_DETAILS
Definition: resource.h:48
#define IDM_TB_SCOPE_PANE
Definition: resource.h:67
#define IDS_ABOUT_SNAPIN
Definition: resource.h:126
#define DPRINT1
Definition: precomp.h:8
#define U(x)
Definition: wordpad.c:45
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ) noexcept
Definition: atlbase.h:1315
LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars) noexcept
Definition: atlbase.h:1240
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL) noexcept
Definition: atlbase.h:1189
LONG Close() noexcept
Definition: atlbase.h:1156
LONG EnumKey(DWORD iIndex, LPTSTR pszName, LPDWORD pnNameLength, FILETIME *pftLastWriteTime=NULL) noexcept
Definition: atlbase.h:1421
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:417
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1288
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
BOOL UpdateWindow()
Definition: atlwin.h:1345
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1333
WNDPROC GetWNDPROC()
Definition: atlwin.h:258
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:250
UINT m_ViewId
Definition: CConsoleWnd.h:52
VOID UpdateView()
static HRESULT ParseView(CMainWnd *pMainWnd, MscFile *mscFile, IXMLDOMElement *pViewElement)
VOID SaveView(MscFile *mscFile, IXMLDOMElement *pParentElement)
static LPCWSTR GetWndClassName()
Definition: CConsoleWnd.h:99
VOID UpdateToolbuttons(BOOL bTreeViewVisible, BOOL bActionsPaneVisible)
Definition: CMainWnd.cpp:853
LRESULT OnFileRecent(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:342
CMainWnd()
Definition: CMainWnd.cpp:26
void SetPreventViewCustomization(BOOL PreventCustomization)
Definition: CMainWnd.cpp:803
CWndProcThunk m_FrameThunk
Definition: CMainWnd.h:27
BOOL GetPreventViewCustomization()
Definition: CMainWnd.cpp:797
UINT m_NextNodeId
Definition: CMainWnd.h:50
LRESULT OnFileExit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:374
VOID UpdateUpToolButton(BOOL bShow)
Definition: CMainWnd.cpp:847
VOID UpdateAboutSnapinMenu(CSnapin *Snapin)
Definition: CMainWnd.cpp:809
LRESULT OnWindowsCascade(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:441
LRESULT OnDestroy(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:132
void SetConsoleTitle(CAtlString consoleTitle)
Definition: CMainWnd.cpp:580
CAtlString m_ConsoleTitle
Definition: CMainWnd.h:30
HIMAGELIST m_hToolBarImageList
Definition: CMainWnd.h:40
LRESULT OnToolbarSelectParent(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:497
VOID UpdateLayout()
Definition: CMainWnd.cpp:723
BOOL GetLogicalReadOnly()
Definition: CMainWnd.cpp:785
static LRESULT CALLBACK XDefFrameProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMainWnd.h:136
CAtlString * GetConsoleTitle()
Definition: CMainWnd.cpp:575
int m_ConsoleNumber
Definition: CMainWnd.h:29
VOID SetToolBarVisible(BOOL bVisible)
Definition: CMainWnd.cpp:593
VOID AddToRecentFiles(const CAtlString &FileName)
Definition: CMainWnd.cpp:931
LRESULT OnNotify(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:147
int GetSnapinCacheCount()
Definition: CMainWnd.cpp:638
CAtlList< CRecentFileEntry * > m_RecentFilesList
Definition: CMainWnd.h:52
VOID LoadRecentFiles()
Definition: CMainWnd.cpp:898
LRESULT OnFileAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:316
LRESULT OnFileOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:331
LRESULT OnWindowsNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:434
LRESULT OnCreate(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:74
HRESULT ParseViewsElement(MscFile *mscFile, IXMLDOMElement *pRootElement)
Definition: CMainWnd.cpp:1235
BOOL IsToolBarVisible()
Definition: CMainWnd.cpp:587
CSnapin * GetRootSnapin()
Definition: CMainWnd.cpp:668
~CMainWnd()
Definition: CMainWnd.cpp:64
VOID UpdateMenu()
Definition: CMainWnd.cpp:749
VOID UpdateViewMenu(LISTVIEW_MODE ListViewMode)
Definition: CMainWnd.cpp:837
void CreateNewConsoleTitle(CAtlString &str)
Definition: CMainWnd.h:168
DWORD CreateNewFilename(PWSTR pBuffer, DWORD dwSize, DWORD Number)
Definition: CMainWnd.cpp:983
CWindow m_MDIClient
Definition: CMainWnd.h:55
LRESULT LoadMscFile(const CAtlString &FileName)
Definition: CMainWnd.cpp:1093
HMENU m_hMenuConsoleSmall
Definition: CMainWnd.h:31
CSnapin * m_RootNode
Definition: CMainWnd.h:49
LRESULT OnFileSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:273
DOCUMENT_MODE GetDocumentMode()
Definition: CMainWnd.cpp:773
CSimpleMap< UINT, CSnapin * > * m_TempNodeMap
Definition: CMainWnd.h:59
CSnapinCacheEntry * GetSnapinCacheEntry(int nIndex)
Definition: CMainWnd.cpp:644
HIMAGELIST SnapinImageList()
Definition: CMainWnd.cpp:662
UINT GetNextNodeId()
Definition: CMainWnd.cpp:695
HIMAGELIST m_hSnapinImageList
Definition: CMainWnd.h:44
LRESULT LoadSnapinCache()
Definition: CMainWnd.cpp:614
CConsoleWnd * GetActiveChildInfo()
Definition: CMainWnd.h:157
LRESULT OnViewMode(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:405
BOOL CreateView(CSnapin *RootNode, CSnapin *SelectedNode=NULL)
Definition: CMainWnd.cpp:543
LRESULT OnHelpAboutMMC(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:462
DOCUMENT_MODE m_DocumentMode
Definition: CMainWnd.h:33
VOID UpdateViews()
Definition: CMainWnd.cpp:708
void SetLogicalReadOnly(BOOL LogicalReadOnly)
Definition: CMainWnd.cpp:791
BOOL m_LogicalReadOnly
Definition: CMainWnd.h:34
VOID UpdateRecentFilesMenu()
Definition: CMainWnd.cpp:860
LRESULT OnWindowsArrange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:455
CToolbar< DWORD_PTR > m_ToolBar
Definition: CMainWnd.h:37
VOID UpdateNextNodeId(UINT NodeId)
Definition: CMainWnd.cpp:701
BOOL m_PreventViewCustomization
Definition: CMainWnd.h:35
LRESULT OnHelpAboutSnapin(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:479
CSimpleArray< CSnapinCacheEntry * > m_SnapinCache
Definition: CMainWnd.h:43
LRESULT OnViewCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:422
CAtlList< CConsoleWnd * > m_ViewList
Definition: CMainWnd.h:46
HMENU m_hMenuConsoleLarge
Definition: CMainWnd.h:32
BOOL m_bStandardMenusVisible
Definition: CMainWnd.h:41
LRESULT OnCloseChild(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:123
LRESULT OnWindowsTile(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:448
VOID SetStandardMenusVisible(BOOL bVisible)
Definition: CMainWnd.cpp:606
void InitMain()
Definition: CMainWnd.h:144
VOID UpdateTitle()
Definition: CMainWnd.cpp:763
LRESULT OnClose(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:140
LRESULT OnFileSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:260
LRESULT OnFileNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:181
HRESULT ParseScopeTree(MscFile *mscFile, IXMLDOMElement *pRootElement)
Definition: CMainWnd.cpp:1197
LRESULT OnActionRename(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:393
BOOL m_bToolBarVisible
Definition: CMainWnd.h:39
VOID RegisterView(CConsoleWnd *pView)
Definition: CMainWnd.cpp:674
UINT m_NextViewId
Definition: CMainWnd.h:47
LRESULT OnActionNewWindow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:381
BOOL AreStandardMenusVisible()
Definition: CMainWnd.cpp:600
VOID UnregisterView(CConsoleWnd *pView)
Definition: CMainWnd.cpp:684
LRESULT OnMenuSelect(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:166
LRESULT OnToolbarScopePane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:508
LRESULT OnFileOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:218
LRESULT OnToolbarActionsPane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:519
LRESULT OnSize(UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CMainWnd.cpp:116
LRESULT OnMDIForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:530
LRESULT SaveMscFile(const CAtlString &FileName)
Definition: CMainWnd.cpp:995
CAtlString m_Filename
Definition: CMainWnd.h:56
void SetDocumentMode(DOCUMENT_MODE DocumentMode)
Definition: CMainWnd.cpp:779
CSnapinCacheEntry * GetSnapinCacheEntryByGuid(PWSTR pszGuid)
Definition: CMainWnd.cpp:650
int m_iToolBarHeight
Definition: CMainWnd.h:38
const CAtlString & DisplayName() const
const CAtlString & FileName() const
static CSnapinCacheEntry * Create(CRegKey &SnapinsKey, PWSTR guidString, HIMAGELIST hImageList)
const CAtlString & Name() const
Definition: CSnapin.cpp:37
VOID SaveNode(MscFile *mscFile, IXMLDOMElement *pParentNode)
Definition: CSnapin.cpp:122
static HRESULT ParseSnapin(CMainWnd *pMainWnd, MscFile *mscFile, IXMLDOMElement *pSnapinNode, CSnapin **ppSnapin)
Definition: CSnapin.cpp:188
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
DWORD CheckButton(int cmdId, BOOL bCheck)
Definition: rosctrls.h:362
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:429
DWORD HideButton(int cmdId, BOOL bHide)
Definition: rosctrls.h:367
HRESULT CreateAndInitDOM()
Definition: mscfile.cpp:46
HRESULT CreateAndAddTextNode(PCWSTR wszText, IXMLDOMNode *pParent)
Definition: mscfile.cpp:165
HRESULT GetElement(IXMLDOMElement *pParentElement, LPWSTR pszElementName, IXMLDOMElement **ppElement)
Definition: mscfile.cpp:509
HRESULT CreateElement(PCWSTR wszName, IXMLDOMElement **ppElement)
Definition: mscfile.cpp:65
HRESULT ParseWindowPlacement(CWindow *pWindow, IXMLDOMElement *pParentElement)
Definition: mscfile.cpp:272
HRESULT LoadDOM()
Definition: mscfile.cpp:398
HRESULT SaveWindowPlacement(CWindow *pWindow, IXMLDOMElement *pParentNode)
Definition: mscfile.cpp:222
HRESULT GetAttribute(IXMLDOMElement *pElement, LPWSTR pszAttributeName, VARIANT *pAttributeValue)
Definition: mscfile.cpp:484
HRESULT SaveDOM()
Definition: mscfile.cpp:421
HRESULT CreateAndAddAttributeNode(PCWSTR wszName, PCWSTR wszValue, IXMLDOMElement *pParent)
Definition: mscfile.cpp:137
HRESULT AppendChildToParent(IXMLDOMNode *pChild, IXMLDOMNode *pParent=NULL)
Definition: mscfile.cpp:81
HRESULT CheckMscFile(IXMLDOMElement **ppRootElement)
Definition: mscfile.cpp:427
HRESULT CreateAndAddPINode(PCWSTR wszTarget, PCWSTR wszData)
Definition: mscfile.cpp:97
HRESULT CreateAndAddElementNode(PCWSTR wszName, IXMLDOMNode *pParent, IXMLDOMElement **ppElement=NULL)
Definition: mscfile.cpp:204
RECT rect
Definition: combotst.c:67
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:573
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4760
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4825
OLECHAR * BSTR
Definition: compat.h:2293
HANDLE HWND
Definition: compat.h:19
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define true
Definition: stdbool.h:24
char * va_list
Definition: vadefs.h:50
#define RGB(r, g, b)
Definition: precomp.h:88
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
#define NodeType(P)
Definition: nodetype.h:51
#define ULONG_PTR
Definition: config.h:101
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint namelen
Definition: glext.h:7232
GLuint index
Definition: glext.h:6031
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 UINT
Definition: sysinfo.c:13
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
ULONG Release()
HRESULT nextNode([retval, out] IXMLDOMNode **outNode)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HBITMAP
Definition: button.c:44
static HICON
Definition: imagelist.c:80
static HTREEITEM hChild
Definition: treeview.c:383
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static HWND child
Definition: cursoricon.c:298
static MONITORINFO mi
Definition: win.c:9400
LPCSTR LPCTSTR
Definition: ms-dtyp.idl:130
#define SAFE_RELEASE(p)
Definition: mscfile.h:15
#define CHK_HR(stmt)
Definition: mscfile.h:9
HICON hIcon
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
enum tagDOMNodeType DOMNodeType
@ NODE_ELEMENT
Definition: msxml6.idl:113
_In_ ULONG Number
Definition: haltypes.h:1940
#define KEY_READ
Definition: nt_native.h:1026
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
#define V_BSTR(A)
Definition: oleauto.h:226
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
short WCHAR
Definition: pedump.c:58
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define BTNS_BUTTON
Definition: commctrl.h:998
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define BTNS_SEP
Definition: commctrl.h:999
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
#define ILC_COLOR32
Definition: commctrl.h:358
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1136
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define TBN_GETINFOTIP
Definition: commctrl.h:1392
#define ILC_MASK
Definition: commctrl.h:351
#define BTNS_CHECK
Definition: commctrl.h:1000
#define TB_ADDBUTTONSW
Definition: commctrl.h:1266
#define LPNMTBGETINFOTIP
Definition: commctrl.h:1394
#define TBSTATE_CHECKED
Definition: commctrl.h:972
#define WM_MDITILE
Definition: winuser.h:1846
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define WM_CLOSE
Definition: winuser.h:1649
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
#define WM_MDICREATE
Definition: winuser.h:1840
#define WM_MDICASCADE
Definition: winuser.h:1847
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_COMMAND
Definition: winuser.h:1768
#define MIIM_FTYPE
Definition: winuser.h:740
#define SM_CYSMICON
Definition: winuser.h:1024
#define MFT_SEPARATOR
Definition: winuser.h:755
#define IDOK
Definition: winuser.h:841
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define WM_MDIICONARRANGE
Definition: winuser.h:1848
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define SM_CXSMICON
Definition: winuser.h:1023
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadIcon
Definition: winuser.h:5979
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SendMessage
Definition: winuser.h:6009
#define LoadMenu
Definition: winuser.h:5983
#define PostMessage
Definition: winuser.h:5998
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define MFT_STRING
Definition: winuser.h:757
#define SW_SHOW
Definition: winuser.h:786
#define MDITILE_HORIZONTAL
Definition: winuser.h:2224
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_MDIGETACTIVE
Definition: winuser.h:1849
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2532
#define SWP_NOZORDER
Definition: winuser.h:1258
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
#define MIIM_DATA
Definition: winuser.h:737
HMENU WINAPI GetMenu(_In_ HWND)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
struct tagMENUITEMINFOW MENUITEMINFOW
PVOID pBuffer
#define err(...)
const WCHAR * str
wcscat
wcscpy
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#define _countof(array)
Definition: sndvol32.h:70
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
Definition: match.c:390
DWORD cbSize
Definition: winuser.h:3892
UINT code
Definition: winuser.h:3267
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
#define DWORD_PTR
Definition: treelist.c:76
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_In_ LPCSTR lpFileName
Definition: winbase.h:2800
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:401
#define S_FALSE
Definition: winerror.h:3451
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11