ReactOS 0.4.15-dev-7942-gd23573b
srvpage.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Applications
3 * LICENSE: LGPL - See COPYING in the top level directory
4 * FILE: base/applications/msconfig_new/srvpage.cpp
5 * PURPOSE: Services page message handler
6 * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
7 * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca@sfr.fr>
8 *
9 */
10
11#include "precomp.h"
12#include "utils.h"
13#include "regutils.h"
14#include "stringutils.h"
15// #include "CmdLineParser.h"
16#include "listview.h"
17#include "uxthemesupp.h"
18
19#include <winsvc.h>
20
21// #include <atlbase.h>
22#include <atlcoll.h>
23#include <atlstr.h>
24
27static int iSortedColumn = 0;
29
31{
32 DWORD dwServices = 0;
33 RegGetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\state", L"services", &dwServices);
34 return dwServices;
35}
36
38{
39 return (RegSetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\state", L"services", TRUE, dwState) == ERROR_SUCCESS);
40}
41
42static BOOL
44{
45 return (RegSetDWORDValue(HKEY_CURRENT_USER /* HKEY_LOCAL_MACHINE ?? */,
46 L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig",
47 L"HideEssentialServiceWarning",
48 TRUE, 1) == ERROR_SUCCESS);
49}
50
51BOOL
53{
54 BOOL bRetVal = FALSE;
55 DWORD dwValue = 0;
56
57 bRetVal = ( (RegGetDWORDValue(HKEY_CURRENT_USER /* HKEY_LOCAL_MACHINE ?? */,
58 L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig",
59 L"HideEssentialServiceWarning",
60 &dwValue) == ERROR_SUCCESS) &&
61 (dwValue == 1) );
62
63 return bRetVal;
64}
65
67{
68 ServiceItem(const LPCWSTR lpszSvcName,
69 BOOL bIsEnabled,
70 BOOL bIsRequired) :
71 m_lpszSvcName(lpszSvcName),
72 m_bIsEnabled(bIsEnabled),
73 m_bIsRequired(bIsRequired)
74 { }
75
77 { }
78
82};
83
85{
87 BOOL bIsKeyed; // bIsKeyed == TRUE for a keyed-registered service ; == FALSE for a valued-registered service.
90};
91
93
94QUERY_REGISTRY_VALUES_ROUTINE(GetRegistryValuedDisabledServicesQueryRoutine)
95{
99
100 if (!EntryContext)
101 return ERROR_SUCCESS;
102
104 if (pContextParams->bIsPresent)
105 return ERROR_SUCCESS;
106
107 if ( (hRootKey == HKEY_LOCAL_MACHINE) && (ValueType == REG_DWORD) && (ValueLength == sizeof(DWORD)) &&
108 (wcsicmp((LPCWSTR)Context, ValueName) == 0) )
109 {
110 pContextParams->bIsPresent = TRUE;
111 pContextParams->bIsKeyed = FALSE;
112 pContextParams->dwStartType = *(DWORD*)ValueData;
113 // pContextParams->time = {};
114 }
115 else
116 {
117 pContextParams->bIsPresent = FALSE;
118 pContextParams->bIsKeyed = FALSE;
119 pContextParams->dwStartType = 0;
120 // pContextParams->time = {};
121 }
122
123 return ERROR_SUCCESS;
124}
125
126QUERY_REGISTRY_KEYS_ROUTINE(GetRegistryKeyedDisabledServicesQueryRoutine)
127{
128 UNREFERENCED_PARAMETER(hRootKey);
130
131 if (!EntryContext)
132 return ERROR_SUCCESS;
133
135 if (pContextParams->bIsPresent)
136 return ERROR_SUCCESS;
137
138 DWORD dwType = 0, dwBufSize = 0;
139
140 // Be careful, the order of the operations in the comparison is very important.
141 if ( (wcsicmp((LPCWSTR)Context, SubKeyName) == 0) &&
142 (RegQueryValueEx(hOpenedSubKey, /* ValueName == */ SubKeyName, NULL, &dwType, NULL, &dwBufSize) == ERROR_SUCCESS) &&
143 (dwType == REG_DWORD) && (dwBufSize == sizeof(DWORD)) )
144 {
145#if 1 // DisableDate
146 SYSTEMTIME disableDate = {};
147 DWORD dwRegData = 0;
148
149 dwRegData = 0;
150 RegGetDWORDValue(hOpenedSubKey, NULL, L"DAY", &dwRegData);
151 disableDate.wDay = LOWORD(dwRegData);
152
153 dwRegData = 0;
154 RegGetDWORDValue(hOpenedSubKey, NULL, L"HOUR", &dwRegData);
155 disableDate.wHour = LOWORD(dwRegData);
156
157 dwRegData = 0;
158 RegGetDWORDValue(hOpenedSubKey, NULL, L"MINUTE", &dwRegData);
159 disableDate.wMinute = LOWORD(dwRegData);
160
161 dwRegData = 0;
162 RegGetDWORDValue(hOpenedSubKey, NULL, L"MONTH", &dwRegData);
163 disableDate.wMonth = LOWORD(dwRegData);
164
165 dwRegData = 0;
166 RegGetDWORDValue(hOpenedSubKey, NULL, L"SECOND", &dwRegData);
167 disableDate.wSecond = LOWORD(dwRegData);
168
169 dwRegData = 0;
170 RegGetDWORDValue(hOpenedSubKey, NULL, L"YEAR", &dwRegData);
171 disableDate.wYear = LOWORD(dwRegData);
172#endif
173
174 DWORD dwStartType = 0;
175 RegGetDWORDValue(hOpenedSubKey, NULL, SubKeyName /* Service name */, &dwStartType);
176
177 pContextParams->bIsPresent = TRUE;
178 pContextParams->bIsKeyed = TRUE;
179 pContextParams->dwStartType = dwStartType;
180 pContextParams->time = disableDate;
181 }
182 else
183 {
184 pContextParams->bIsPresent = FALSE;
185 pContextParams->bIsKeyed = TRUE;
186 pContextParams->dwStartType = 0;
187 // pContextParams->time = {};
188 }
189
190 return ERROR_SUCCESS;
191}
192
193
194
195static void AddService(SC_HANDLE hSCManager, LPENUM_SERVICE_STATUS_PROCESS Service, BOOL bHideOSVendorServices)
196{
197 //
198 // Retrieve a handle to the service.
199 //
200 SC_HANDLE hService = OpenServiceW(hSCManager, Service->lpServiceName, SERVICE_QUERY_CONFIG);
201 if (hService == NULL)
202 return;
203
204 DWORD dwBytesNeeded = 0;
205 QueryServiceConfigW(hService, NULL, 0, &dwBytesNeeded);
206 // if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
207
208 LPQUERY_SERVICE_CONFIG lpServiceConfig = (LPQUERY_SERVICE_CONFIG)MemAlloc(0, dwBytesNeeded);
209 if (!lpServiceConfig)
210 {
211 CloseServiceHandle(hService);
212 return;
213 }
214 QueryServiceConfigW(hService, lpServiceConfig, dwBytesNeeded, &dwBytesNeeded);
215
216 //
217 // Get the service's vendor...
218 //
219 LPWSTR lpszVendor = NULL;
220 {
221 // Isolate only the executable path, without any arguments.
222 // TODO: Correct at the level of CmdLineToArgv the potential bug when lpszFilename == NULL.
223#if 0 // Disabled until CmdLineToArgv is included
224 unsigned int argc = 0;
225 LPWSTR* argv = NULL;
226 CmdLineToArgv(lpServiceConfig->lpBinaryPathName, &argc, &argv, L" \t");
227 if (argc >= 1 && argv[0])
228 lpszVendor = GetExecutableVendor(argv[0]);
229#else
230 // Hackish solution taken from the original srvpage.c.
231 // Will be removed after CmdLineToArgv is introduced.
233 memset(&FileName, 0, sizeof(FileName));
234 if (wcscspn(lpServiceConfig->lpBinaryPathName, L"\""))
235 {
236 wcsncpy(FileName, lpServiceConfig->lpBinaryPathName, wcscspn(lpServiceConfig->lpBinaryPathName, L" ") );
237 }
238 else
239 {
240 wcscpy(FileName, lpServiceConfig->lpBinaryPathName);
241 }
242 lpszVendor = GetExecutableVendor(FileName);
243#endif
244 if (!lpszVendor)
245 lpszVendor = LoadResourceString(hInst, IDS_UNKNOWN);
246#if 0
247 MemFree(argv);
248#endif
249 }
250
251 // ...and display or not the Microsoft / ReactOS services.
252 BOOL bContinue = TRUE;
253 if (bHideOSVendorServices)
254 {
255 if (FindSubStrI(lpszVendor, bIsWindows ? IDS_MICROSOFT : IDS_REACTOS))
256 bContinue = FALSE;
257 }
258
259 if (bContinue)
260 {
261 BOOL bIsServiceEnabled = (lpServiceConfig->dwStartType != SERVICE_DISABLED);
262 BOOL bAddServiceToList = FALSE;
263 BOOL bIsModifiedService = FALSE;
265
266 //
267 // Try to look into the user modifications list...
268 //
269 POSITION it = userModificationsList.Find(Service->lpServiceName);
270 if (it)
271 {
272 bAddServiceToList = TRUE;
273 bIsModifiedService = TRUE;
274 }
275
276 //
277 // ...if not found, try to find if the disabled service is in the registry.
278 //
279 if (!bAddServiceToList)
280 {
281 if (!bIsServiceEnabled)
282 {
283 QUERY_REGISTRY_KEYS_TABLE KeysQueryTable[2] = {};
284 KeysQueryTable[0].QueryRoutine = GetRegistryKeyedDisabledServicesQueryRoutine;
285 KeysQueryTable[0].EntryContext = &params;
286 RegQueryRegistryKeys(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", KeysQueryTable, Service->lpServiceName);
287
288 bAddServiceToList = params.bIsPresent;
289
290 if (bIsWindows && bIsPreVistaOSVersion && !bAddServiceToList)
291 {
292 QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
293 ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
294 ValuesQueryTable[0].EntryContext = &params;
295 RegQueryRegistryValues(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", ValuesQueryTable, Service->lpServiceName);
296
297 bAddServiceToList = params.bIsPresent;
298 }
299 }
300 else
301 {
302 bAddServiceToList = TRUE;
303 }
304 }
305
306 if (bAddServiceToList)
307 {
308 //
309 // Check if service is required by the system.
310 //
311 BOOL bIsRequired = FALSE;
312
313 dwBytesNeeded = 0;
314 QueryServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS, NULL, 0, &dwBytesNeeded);
315 // if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
316
317 LPSERVICE_FAILURE_ACTIONS lpServiceFailureActions = (LPSERVICE_FAILURE_ACTIONS)MemAlloc(0, dwBytesNeeded);
318 if (!lpServiceFailureActions)
319 {
320 MemFree(lpszVendor);
321 MemFree(lpServiceConfig);
322 CloseServiceHandle(hService);
323 return;
324 }
325
326 QueryServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS, (LPBYTE)lpServiceFailureActions, dwBytesNeeded, &dwBytesNeeded);
327
328 // In Microsoft's MSConfig, things are done just like that!! (extracted string values from msconfig.exe)
329 if ( ( wcsicmp(Service->lpServiceName, L"rpcss" ) == 0 ||
330 wcsicmp(Service->lpServiceName, L"rpclocator") == 0 ||
331 wcsicmp(Service->lpServiceName, L"dcomlaunch") == 0 ) ||
332 ( lpServiceFailureActions &&
333 (lpServiceFailureActions->cActions >= 1) &&
334 (lpServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT) ) ) // We add also this test, which corresponds to real life.
335 {
336 bIsRequired = TRUE;
337 }
338 MemFree(lpServiceFailureActions);
339
340 //
341 // Add the service into the list.
342 //
343 LVITEM item = {};
344 item.mask = LVIF_TEXT | LVIF_PARAM;
345 item.pszText = Service->lpDisplayName;
346 item.lParam = reinterpret_cast<LPARAM>(new ServiceItem(Service->lpServiceName, bIsServiceEnabled, bIsRequired));
348
349 if (bIsRequired)
350 {
352 ListView_SetItemText(hServicesListCtrl, item.iItem, 1, lpszYes);
353 MemFree(lpszYes);
354 }
355
356 ListView_SetItemText(hServicesListCtrl, item.iItem, 2, lpszVendor);
357
358 LPWSTR lpszStatus = LoadResourceString(hInst, ((Service->ServiceStatusProcess.dwCurrentState == SERVICE_STOPPED) ? IDS_SERVICES_STATUS_STOPPED : IDS_SERVICES_STATUS_RUNNING));
359 ListView_SetItemText(hServicesListCtrl, item.iItem, 3, lpszStatus);
360 MemFree(lpszStatus);
361
362 if (!bIsServiceEnabled)
363 {
365
366 LPWSTR lpszDisableDate = FormatDateTime(&params.time);
367 ListView_SetItemText(hServicesListCtrl, item.iItem, 4, (lpszDisableDate ? lpszDisableDate : lpszUnknown));
368 FreeDateTime(lpszDisableDate);
369
370 MemFree(lpszUnknown);
371 }
372
373 ListView_SetCheckState(hServicesListCtrl, item.iItem, (!bIsModifiedService ? bIsServiceEnabled : !bIsServiceEnabled));
374 }
375 }
376
377 MemFree(lpszVendor);
378 MemFree(lpServiceConfig);
379 CloseServiceHandle(hService);
380
381 return;
382}
383
384static void ClearServicesList(void)
385{
386 LVITEM lvitem = {};
387 lvitem.mask = LVIF_PARAM;
388 lvitem.iItem = -1; // From the beginning.
389
390 while ((lvitem.iItem = ListView_GetNextItem(hServicesListCtrl, lvitem.iItem, LVNI_ALL)) != -1)
391 {
393
394 delete reinterpret_cast<ServiceItem*>(lvitem.lParam);
395 lvitem.lParam = NULL;
396 }
398
399 return;
400}
401
402static void GetServices(BOOL bHideOSVendorServices = FALSE)
403{
404 //
405 // First of all, clear the list.
406 //
408
409 //
410 // Now, we can list the services.
411 //
412
413 // Open the Service Control Manager.
415 if (hSCManager == NULL)
416 return;
417
418 // Enumerate all the Win32 services.
419 DWORD dwBytesNeeded = 0;
420 DWORD dwNumServices = 0;
421 // DWORD dwResumeHandle = 0;
422 EnumServicesStatusExW(hSCManager, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_STATE_ALL, NULL, 0, &dwBytesNeeded, &dwNumServices, NULL /* &dwResumeHandle */, NULL);
423 // if (GetLastError() == ERROR_MORE_DATA)
424
426 if (!lpServices)
427 {
429 return;
430 }
431 EnumServicesStatusExW(hSCManager, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_STATE_ALL, (LPBYTE)lpServices, dwBytesNeeded, &dwBytesNeeded, &dwNumServices, NULL /* &dwResumeHandle */, NULL);
432
433 // Add them into the list.
434 for (DWORD i = 0 ; i < dwNumServices ; ++i)
435 {
436 AddService(hSCManager, lpServices + i, bHideOSVendorServices);
437 }
438
439 // Cleaning.
440 MemFree(lpServices);
442
443 return;
444}
445
451{
453
454 switch (message)
455 {
456 case WM_INITDIALOG:
457 {
458 /* Correctly display message strings */
459 LPCWSTR szOSVendor;
460 size_t itemLength = 0;
461 LPWSTR szItem = NULL, szNewItem = NULL;
462
463 szOSVendor = (bIsWindows ? IDS_WINDOWS : IDS_REACTOS);
464
466 szItem = (LPWSTR)MemAlloc(0, itemLength * sizeof(WCHAR));
467 GetDlgItemText(hDlg, IDC_STATIC_REQSVCSDIS_INFO, szItem, (int)itemLength);
468 szNewItem = FormatString(szItem, szOSVendor);
470 MemFree(szNewItem);
471 MemFree(szItem);
472
473 return TRUE;
474 }
475
476 case WM_COMMAND:
477 {
478 switch (LOWORD(wParam))
479 {
480 case IDOK:
481 {
484
485 EndDialog(hDlg, LOWORD(wParam));
486 return TRUE;
487 }
488
489 case IDCANCEL:
490 EndDialog(hDlg, LOWORD(wParam));
491 return TRUE;
492
493 default:
494 //break;
495 return FALSE;
496 }
497 }
498 }
499
500 return FALSE;
501}
502
503static BOOL ValidateItem(int index, BOOL bNewState, BOOL bDisplayErrors)
504{
505 ServiceItem* pSvcItem = NULL;
506
507 LVITEM truc = {};
508 truc.mask = LVIF_PARAM;
509 truc.iItem = index;
511
512 // The lParam member must be valid.
513 pSvcItem = reinterpret_cast<ServiceItem*>(truc.lParam);
514 if (!pSvcItem)
515 return FALSE;
516
517 //
518 // Allow modifications only if the service is not a required service for the system,
519 // or allow only the activation of a disabled required service.
520 //
521 BOOL bOldState = !!(ListView_GetCheckState(hServicesListCtrl, truc.iItem /* == index */) % 2);
522
523 if ( !pSvcItem->m_bIsRequired ||
524 (pSvcItem->m_bIsRequired && !pSvcItem->m_bIsEnabled && bOldState == FALSE && bNewState == TRUE) )
525 {
526 if (bOldState == bNewState)
527 return FALSE;
528
530
531 if (pSvcItem->m_bIsEnabled) // Enabled service.
532 {
533 if (bNewState == FALSE) // To be deactivated.
534 {
535 userModificationsList.AddTail(pSvcItem->m_lpszSvcName);
536 }
537 else if (bNewState == TRUE) // To be reactivated
538 {
539 POSITION it = userModificationsList.Find(pSvcItem->m_lpszSvcName);
540 if (it)
541 {
542 userModificationsList.RemoveAt(it);
543 }
544 else
545 {
546 OutputDebugString(_T("(1) \"WTF: What The Fukhurmajalmahamadahaldeliya ?!\" (The Dictator, Sacha Baron Cohen)\n"));
547 }
548 }
549 }
550 else // Disabled service.
551 {
552 if (bNewState == TRUE) // To be activated.
553 {
554 userModificationsList.AddTail(pSvcItem->m_lpszSvcName);
555 }
556 else if (bNewState == FALSE) // To be redeactivated
557 {
558 POSITION it = userModificationsList.Find(pSvcItem->m_lpszSvcName);
559 if (it)
560 {
561 userModificationsList.RemoveAt(it);
562 }
563 else
564 {
565 OutputDebugString(_T("(2) \"WTF: What The Fukhurmajalmahamadahaldeliya ?!\" (The Dictator, Sacha Baron Cohen)\n"));
566 }
567 }
568 }
569
570 return TRUE;
571 }
572 else
573 {
574 if (bDisplayErrors)
575 {
577 }
578
579 return FALSE;
580 }
581}
582
583
584static void
586{
587 // HWND hTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
588
589 //
590 // "Enable all" / "Disable all" buttons.
591 //
592 // UINT uRootCheckState = TreeView_GetRealSubtreeState(hTree, TVI_ROOT);
593 UINT uRootCheckState = ListView_GetCheckState(hServicesListCtrl, 0);
594#define OP(a, b) ((a) == (b) ? (a) : 2)
595 int index = 0; // -1 // From the beginning + 1.
597 {
599 uRootCheckState = OP(uRootCheckState, temp);
600 }
601
602 if (uRootCheckState == 0)
603 {
606 }
607 else if (uRootCheckState == 1)
608 {
611 }
612 else if (uRootCheckState == 2)
613 {
616 }
617 else
618 {
621 }
622
623 return;
624}
625
626extern "C" {
627
630{
633
634 switch (message)
635 {
636 case WM_INITDIALOG:
637 {
638 hServicesPage = hDlg;
640
641 //
642 // Correctly display message strings.
643 //
644 LPCWSTR szOSVendor = (bIsWindows ? IDS_MICROSOFT : IDS_REACTOS);
645
646 size_t itemLength = 0;
647 LPWSTR szItem = NULL, szNewItem = NULL;
648
650 szItem = (LPWSTR)MemAlloc(0, itemLength * sizeof(WCHAR));
652 szNewItem = FormatString(szItem, szOSVendor);
654 MemFree(szNewItem);
655 MemFree(szItem);
656
658 szItem = (LPWSTR)MemAlloc(0, itemLength * sizeof(WCHAR));
660 szNewItem = FormatString(szItem, szOSVendor);
662 MemFree(szNewItem);
663 MemFree(szItem);
664
665 //
666 // Initialize the styles.
667 //
671
672 //
673 // Initialize the application page's controls.
674 //
675 LVCOLUMN column = {};
676
677 // First column : Service's name.
678 column.mask = LVCF_TEXT | LVCF_WIDTH;
680 column.cx = 150;
682 MemFree(column.pszText);
683
684 // Second column : Whether the service is required or not.
685 column.mask = LVCF_TEXT | LVCF_WIDTH;
687 column.cx = 60;
689 MemFree(column.pszText);
690
691 // Third column : Service's vendor.
692 column.mask = LVCF_TEXT | LVCF_WIDTH;
694 column.cx = 150;
696 MemFree(column.pszText);
697
698 // Fourth column : Service's status.
699 column.mask = LVCF_TEXT | LVCF_WIDTH;
701 column.cx = 60;
703 MemFree(column.pszText);
704
705 // Fifth column : Service's disabled date.
706 column.mask = LVCF_TEXT | LVCF_WIDTH;
708 column.cx = 120;
710 MemFree(column.pszText);
711
712 //
713 // Populate and sort the list.
714 //
715 GetServices();
717 UpdateBtnStates(hDlg);
718
719 // Select the first item.
721
722 return TRUE;
723 }
724
725 case WM_DESTROY:
726 {
728 userModificationsList.RemoveAll();
729 return 0;
730 }
731
732 case WM_COMMAND:
733 {
734 switch (LOWORD(wParam))
735 {
737 {
738 BOOL bAreThereMods = FALSE;
739
740 int index = -1; // From the beginning.
742 {
743 bAreThereMods = ValidateItem(index, TRUE, FALSE) || bAreThereMods; // The order is verrrrrry important !!!!
744 }
745
746 if (bAreThereMods)
747 {
748 UpdateBtnStates(hDlg);
750 }
751
752 return TRUE;
753 }
754
756 {
757 BOOL bAreThereMods = FALSE;
758
759 int index = -1; // From the beginning.
761 {
762 bAreThereMods = ValidateItem(index, FALSE, FALSE) || bAreThereMods; // The order is verrrrrry important !!!!
763 }
764
765 if (bAreThereMods)
766 {
767 UpdateBtnStates(hDlg);
769 }
770
771 return TRUE;
772 }
773
775 {
778 UpdateBtnStates(hDlg);
779
780 return TRUE;
781 }
782
783 default:
784 return FALSE;
785 }
786 return FALSE;
787 }
788
790 {
791 BOOL bNewCheckState = !!((ListView_GetCheckState(hServicesListCtrl, int(lParam)) + 1) % 2);
792
793 if (ValidateItem(/*reinterpret_cast<int>*/ int(lParam), bNewCheckState, !HideEssentialServiceWarning()))
794 {
795 UpdateBtnStates(hDlg);
797 }
798
799 return TRUE;
800 }
801
802 case WM_NOTIFY:
803 {
804 if (reinterpret_cast<LPNMHDR>(lParam)->hwndFrom == hServicesListCtrl)
805 {
806 switch (reinterpret_cast<LPNMHDR>(lParam)->code)
807 {
808 case NM_CLICK:
809 case NM_RCLICK:
810 {
811 DWORD dwpos = GetMessagePos();
812 LVHITTESTINFO ht = {};
813 ht.pt.x = GET_X_LPARAM(dwpos);
814 ht.pt.y = GET_Y_LPARAM(dwpos);
816
817 /*
818 * We use ListView_SubItemHitTest(...) and not ListView_HitTest(...)
819 * because ListView_HitTest(...) returns bad flags when one clicks
820 * on a sub-item different from 0. The flags then contain LVHT_ONITEMSTATEICON
821 * which must not be obviously present in this case.
822 */
824
825 if (LVHT_ONITEMSTATEICON & ht.flags)
826 {
827 PostMessage(hDlg, UM_CHECKSTATECHANGE, 0, (LPARAM)ht.iItem);
828
829 // Disable default behaviour. Needed for the UM_CHECKSTATECHANGE
830 // custom notification to work as expected.
832 }
833
834 return TRUE;
835 }
836
837 case NM_DBLCLK:
838 case NM_RDBLCLK:
839 {
840 // We deactivate double-clicks.
842 return TRUE;
843 }
844
845 case LVN_KEYDOWN:
846 {
847 if (reinterpret_cast<LPNMLVKEYDOWN>(lParam)->wVKey == VK_SPACE)
848 {
850 PostMessage(hDlg, UM_CHECKSTATECHANGE, 0, (LPARAM)iItem);
851
852 // Disable default behaviour. Needed for the UM_CHECKSTATECHANGE
853 // custom notification to work as expected.
855 }
856
857 return TRUE;
858 }
859
860 case LVN_COLUMNCLICK:
861 {
862 int iSortingColumn = reinterpret_cast<LPNMLISTVIEW>(lParam)->iSubItem;
863
865 iSortedColumn = iSortingColumn;
866
867 return TRUE;
868 }
869 }
870 }
871 else
872 {
873 switch (reinterpret_cast<LPNMHDR>(lParam)->code)
874 {
875 case PSN_APPLY:
876 {
877 // Try to apply the modifications to the system.
878 MessageBox(NULL, _T("In Services page: PSN_APPLY"), _T("Info"), MB_ICONINFORMATION);
879
880 /*
881 //
882 // Move this away...
883 //
884 int iRetVal = MessageBox(NULL, _T("Would you really want to modify the configuration of your system ?"), _T("Warning"), MB_ICONWARNING | MB_YESNOCANCEL);
885
886 if (iRetVal == IDYES /\* modifications are OK *\/)
887 SetWindowLongPtr(hServicesPage, DWLP_MSGRESULT, PSNRET_NOERROR);
888 else if (iRetVal == IDNO /\* modifications are not OK *\/)
889 SetWindowLongPtr(hServicesPage, DWLP_MSGRESULT, PSNRET_NOERROR);
890 else // if (iRetVal == IDCANCEL) // There was an error...
891 SetWindowLongPtr(hServicesPage, DWLP_MSGRESULT, PSNRET_INVALID);
892 */
893
894 //
895 // We modify the services which are stored in the user modification list.
896 //
897
898 // 1- Open the Service Control Manager for modifications.
900 if (hSCManager != NULL)
901 {
902 LPCWSTR svcName;
903
904 for (POSITION it = userModificationsList.GetHeadPosition(); it; userModificationsList.GetNext(it))
905 {
906 svcName = userModificationsList.GetAt(it);
907
908 // 2- Retrieve a handle to the service.
909 SC_HANDLE hService = OpenServiceW(hSCManager, svcName, SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG);
910 if (hService == NULL)
911 {
912 // TODO : Show a message box.
913 continue;
914 }
915
916 DWORD dwBytesNeeded = 0;
917 QueryServiceConfigW(hService, NULL, 0, &dwBytesNeeded);
918 // if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
919
920 LPQUERY_SERVICE_CONFIG lpServiceConfig = (LPQUERY_SERVICE_CONFIG)MemAlloc(0, dwBytesNeeded);
921 if (!lpServiceConfig)
922 {
923 CloseServiceHandle(hService);
924 continue; // TODO ? Show a message box...
925 }
926 QueryServiceConfigW(hService, lpServiceConfig, dwBytesNeeded, &dwBytesNeeded);
927
928 if (lpServiceConfig->dwStartType == SERVICE_DISABLED) // We have a disabled service which is becoming to be enabled.
929 {
930 // 3a- Retrieve the properties of the disabled service from the registry.
932
933 QUERY_REGISTRY_KEYS_TABLE KeysQueryTable[2] = {};
934 KeysQueryTable[0].QueryRoutine = GetRegistryKeyedDisabledServicesQueryRoutine;
935 KeysQueryTable[0].EntryContext = &params;
936 RegQueryRegistryKeys(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", KeysQueryTable, (PVOID)svcName);
937
938 if (bIsWindows && bIsPreVistaOSVersion && !params.bIsPresent)
939 {
940 QUERY_REGISTRY_VALUES_TABLE ValuesQueryTable[2] = {};
941 ValuesQueryTable[0].QueryRoutine = GetRegistryValuedDisabledServicesQueryRoutine;
942 ValuesQueryTable[0].EntryContext = &params;
943 RegQueryRegistryValues(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", ValuesQueryTable, (PVOID)svcName);
944 }
945
946 if (params.bIsPresent)
947 {
948 // 4a- Modify the service.
950
951 // 5a- Remove the registry entry of the service.
952 if (params.bIsKeyed)
953 {
954 CAtlStringW serviceRegKey(L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services\\");
955 serviceRegKey += svcName;
956 RegDeleteKeyW(HKEY_LOCAL_MACHINE, serviceRegKey);
957
958 /***** HACK for Windows < Vista (e.g. 2000, Xp, 2003...) *****/
959 //
960 // Delete also the valued-entry of the service.
961 //
963 {
964 HKEY hSubKey = NULL;
965 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", 0, KEY_SET_VALUE /*KEY_READ*/, &hSubKey) == ERROR_SUCCESS)
966 {
967 RegDeleteValue(hSubKey, svcName);
968 RegCloseKey(hSubKey);
969 }
970 }
971 /*************************************************************/
972 }
973 else
974 {
975 HKEY hSubKey = NULL;
976 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", 0, KEY_SET_VALUE /*KEY_READ*/, &hSubKey) == ERROR_SUCCESS)
977 {
978 RegDeleteValue(hSubKey, svcName);
979 RegCloseKey(hSubKey);
980 }
981 }
982
984 // userModificationsList.RemoveAt(it);
985 }
986 else
987 {
988 // Ohoh !! We have a very big problem.
989 MessageBox(NULL, _T("WTF ??"), _T("FATAL ERROR !!!!"), MB_ICONERROR);
990 }
991 }
992 else // We have an enabled service which is becoming to be disabled.
993 {
994 // 3b- Retrieve the local time of disabling.
995 SYSTEMTIME disableDate = {};
996 GetLocalTime(&disableDate);
997
998 // 4b- Modify the service.
1000
1001 // 5b- Register the service into the registry.
1002 CAtlStringW serviceRegKey(L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services\\");
1003 serviceRegKey += svcName;
1004 HKEY hSubKey = NULL;
1006 {
1007 RegSetDWORDValue(hSubKey, NULL, svcName, FALSE, lpServiceConfig->dwStartType);
1008
1009 #if 1 // DisableDate
1010 RegSetDWORDValue(hSubKey, NULL, L"DAY" , FALSE, disableDate.wDay );
1011 RegSetDWORDValue(hSubKey, NULL, L"HOUR" , FALSE, disableDate.wHour );
1012 RegSetDWORDValue(hSubKey, NULL, L"MINUTE", FALSE, disableDate.wMinute);
1013 RegSetDWORDValue(hSubKey, NULL, L"MONTH" , FALSE, disableDate.wMonth );
1014 RegSetDWORDValue(hSubKey, NULL, L"SECOND", FALSE, disableDate.wSecond);
1015 RegSetDWORDValue(hSubKey, NULL, L"YEAR" , FALSE, disableDate.wYear );
1016 #endif
1017
1018 RegCloseKey(hSubKey);
1019 }
1020
1021 /***** HACK for Windows < Vista (e.g. 2000, Xp, 2003...) *****/
1022 //
1023 // Save also a valued-entry for the service.
1024 //
1026 {
1027 RegSetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\services", svcName, TRUE, lpServiceConfig->dwStartType);
1028 }
1029 /*************************************************************/
1030
1032 // userModificationsList.RemoveAt(it);
1033 }
1034
1035 MemFree(lpServiceConfig);
1036 CloseServiceHandle(hService);
1037 }
1038
1040 userModificationsList.RemoveAll();
1042
1044
1045
1048
1049 /* Modifications are OK */
1051 }
1052 else
1053 {
1054 MessageBox(hDlg, _T("Impossible to open the SC manager..."), _T("Error"), MB_ICONERROR);
1055
1056 // There was an error...
1058 }
1059
1061 UpdateBtnStates(hDlg);
1062
1063 return TRUE;
1064 }
1065
1066 case PSN_HELP:
1067 {
1068 MessageBox(hServicesPage, _T("Help not implemented yet!"), _T("Help"), MB_ICONINFORMATION | MB_OK);
1069 return TRUE;
1070 }
1071
1072 case PSN_KILLACTIVE: // Is going to lose activation.
1073 {
1074 // Changes are always valid of course.
1076 return TRUE;
1077 }
1078
1079 case PSN_QUERYCANCEL:
1080 {
1081 // RefreshStartupList();
1082
1083 // Allows cancellation.
1085
1086 return TRUE;
1087 }
1088
1090 {
1091 // Give the focus on and select the first item.
1093
1095 return TRUE;
1096 }
1097
1098 //
1099 // DO NOT TOUCH THESE NEXT MESSAGES, THEY ARE OK LIKE THIS...
1100 //
1101 case PSN_RESET: // Perform final cleaning, called before WM_DESTROY.
1102 return TRUE;
1103
1104 case PSN_SETACTIVE: // Is going to gain activation.
1105 {
1107 return TRUE;
1108 }
1109
1110 default:
1111 break;
1112 }
1113 }
1114 }
1115
1116 default:
1117 return FALSE;
1118 }
1119
1120 return FALSE;
1121}
1122
1123}
static int argc
Definition: ServiceArgs.c:12
#define IDS_YES
Definition: resource.h:16
#define IDC_BTN_SERVICES_ACTIVATE
Definition: resource.h:20
#define IDS_SERVICES_STATUS_STOPPED
Definition: resource.h:109
#define IDS_SERVICES_COLUMN_VENDOR
Definition: resource.h:83
#define IDS_SERVICES_COLUMN_SERVICE
Definition: resource.h:81
#define IDS_SERVICES_COLUMN_REQ
Definition: resource.h:82
#define IDC_SERVICES_LIST
Definition: resource.h:17
#define IDC_BTN_SERVICES_DEACTIVATE
Definition: resource.h:21
#define IDS_SERVICES_STATUS_RUNNING
Definition: resource.h:110
#define IDS_SERVICES_COLUMN_STATUS
Definition: resource.h:84
BOOL ListView_SortEx(HWND hListView, int iSortingColumn, int iSortedColumn)
Definition: listview.c:43
#define IDS_UNKNOWN
Definition: resource.h:7
#define IDD_REQUIRED_SERVICES_DISABLING_DIALOG
Definition: resource.h:19
#define IDS_SERVICES_COLUMN_DATEDISABLED
Definition: resource.h:136
#define IDC_CBX_REQSVCSDIS_NO_MSG_ANYMORE
Definition: resource.h:108
#define IDC_STATIC_REQSVCSDIS_INFO
Definition: resource.h:109
#define IDC_CBX_SERVICES_MASK_PROPRIETARY_SVCS
Definition: resource.h:73
#define IDC_STATIC_SERVICES_WARNING
Definition: resource.h:74
LPWSTR FormatDateTime(IN LPSYSTEMTIME pDateTime)
Definition: utils.c:41
BOOL MemFree(IN PVOID lpMem)
Definition: utils.c:26
VOID FreeDateTime(IN LPWSTR lpszDateTime)
Definition: utils.c:84
PVOID MemAlloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: utils.c:33
LPWSTR GetExecutableVendor(IN LPCWSTR lpszFilename)
Definition: utils.c:288
#define LoadResourceString(hInst, uID)
Definition: utils.h:48
#define index(s, c)
Definition: various.h:29
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define UM_CHECKSTATECHANGE
Definition: comctl32supp.h:16
#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
#define IDS_REACTOS
Definition: resource.h:9
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define wcsicmp
Definition: compat.h:15
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
static const WCHAR AddService[]
Definition: install.c:106
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FormatString(DWORD dwFlags, HINSTANCE hInstance, DWORD dwStringId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list *Arguments)
Definition: fontview.c:34
GLuint index
Definition: glext.h:6031
GLenum const GLfloat * params
Definition: glext.h:5645
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
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
static const struct newhuff ht[]
Definition: huffman.h:296
#define ListView_Sort(hListView, iSortingColumn)
Definition: listview.h:32
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
static ATOM item
Definition: dde.c:856
#define argv
Definition: mplay32.c:18
const LPCWSTR IDS_WINDOWS
Definition: msconfig.c:37
const LPCWSTR IDS_MICROSOFT
Definition: msconfig.c:36
BOOL bIsPreVistaOSVersion
Definition: msconfig.c:32
BOOL bIsWindows
Definition: msconfig.c:31
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4725
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4207
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define DWORD
Definition: nt_native.h:44
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
@ Service
Definition: ntsecapi.h:292
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSNRET_INVALID
Definition: prsht.h:130
#define PropSheet_CancelToClose(d)
Definition: prsht.h:343
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
#define PSN_HELP
Definition: prsht.h:119
#define PSN_RESET
Definition: prsht.h:118
#define PSN_SETACTIVE
Definition: prsht.h:115
#define NM_RDBLCLK
Definition: commctrl.h:134
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define NM_DBLCLK
Definition: commctrl.h:131
#define ListView_SetCheckState(hwndLV, i, fCheck)
Definition: commctrl.h:2674
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define ListView_SubItemHitTest(hwnd, plvhti)
Definition: commctrl.h:2765
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define NM_CLICK
Definition: commctrl.h:130
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_PARAM
Definition: commctrl.h:2311
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2691
#define LVIF_TEXT
Definition: commctrl.h:2309
#define NM_RCLICK
Definition: commctrl.h:133
#define ListView_GetCheckState(hwndLV, i)
Definition: commctrl.h:2677
#define LVN_KEYDOWN
Definition: commctrl.h:3184
#define LVHT_ONITEMSTATEICON
Definition: commctrl.h:2496
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVCOLUMN
Definition: commctrl.h:2581
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2728
#define LVNI_ALL
Definition: commctrl.h:2422
LRESULT RegQueryRegistryKeys(IN HKEY hRootKey, IN LPCWSTR KeyName, IN PQUERY_REGISTRY_KEYS_TABLE QueryTable, IN PVOID Context)
Definition: regutils.c:6
LRESULT RegQueryRegistryValues(IN HKEY hRootKey, IN LPCWSTR KeyName, IN PQUERY_REGISTRY_VALUES_TABLE QueryTable, IN PVOID Context)
Definition: regutils.c:51
LONG RegSetDWORDValue(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValue OPTIONAL, IN BOOL bCreateKeyIfDoesntExist, IN DWORD dwData)
Definition: regutils.c:162
LONG RegGetDWORDValue(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValue OPTIONAL, OUT LPDWORD lpData OPTIONAL)
Definition: regutils.c:95
#define QUERY_REGISTRY_VALUES_ROUTINE(fnName)
Definition: regutils.h:51
#define QUERY_REGISTRY_KEYS_ROUTINE(fnName)
Definition: regutils.h:19
#define WM_NOTIFY
Definition: richedit.h:61
static calc_node_t temp
Definition: rpn_ieee.c:38
SC_HANDLE hSCManager
Definition: sc.c:12
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2068
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2160
BOOL WINAPI QueryServiceConfigW(SC_HANDLE hService, LPQUERY_SERVICE_CONFIGW lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2291
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:482
BOOL WINAPI EnumServicesStatusExW(SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName)
Definition: scm.c:1518
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
#define memset(x, y, z)
Definition: compat.h:39
void GetServices(void)
Definition: srvpage.c:77
#define OP(a, b)
static int iSortedColumn
Definition: srvpage.cpp:27
DWORD GetServicesActivation(VOID)
Definition: srvpage.cpp:30
static void UpdateBtnStates(HWND hDlg)
Definition: srvpage.cpp:585
static HWND hServicesListCtrl
Definition: srvpage.cpp:26
BOOL HideEssentialServiceWarning(VOID)
Definition: srvpage.cpp:52
static CAtlList< CAtlStringW > userModificationsList
Definition: srvpage.cpp:92
INT_PTR CALLBACK RequiredServicesDisablingDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: srvpage.cpp:447
static BOOL RegisterNoMsgAnymore(VOID)
Definition: srvpage.cpp:43
BOOL SetServicesActivation(DWORD dwState)
Definition: srvpage.cpp:37
static HWND hServicesPage
Definition: srvpage.cpp:25
static void ClearServicesList(void)
Definition: srvpage.cpp:384
static BOOL ValidateItem(int index, BOOL bNewState, BOOL bDisplayErrors)
Definition: srvpage.cpp:503
static BOOL bMaskProprietarySvcs
Definition: srvpage.cpp:28
INT_PTR CALLBACK ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: srvpage.cpp:629
LPTSTR FindSubStrI(LPCTSTR str, LPCTSTR strSearch)
Definition: stringutils.c:183
BOOL m_bIsEnabled
Definition: srvpage.cpp:80
ServiceItem(const LPCWSTR lpszSvcName, BOOL bIsEnabled, BOOL bIsRequired)
Definition: srvpage.cpp:68
BOOL m_bIsRequired
Definition: srvpage.cpp:81
~ServiceItem(void)
Definition: srvpage.cpp:76
CAtlStringW m_lpszSvcName
Definition: srvpage.cpp:79
SC_ACTION_TYPE Type
Definition: winsvc.h:205
SC_ACTION * lpsaActions
Definition: winsvc.h:213
WORD wYear
Definition: winbase.h:905
WORD wMonth
Definition: winbase.h:906
WORD wHour
Definition: winbase.h:909
WORD wSecond
Definition: winbase.h:911
WORD wMinute
Definition: winbase.h:910
WORD wDay
Definition: winbase.h:908
PQUERY_REGISTRY_KEYS_ROUTINE QueryRoutine
Definition: regutils.h:29
PQUERY_REGISTRY_VALUES_ROUTINE QueryRoutine
Definition: regutils.h:63
Definition: inflate.c:139
Definition: tftpd.h:60
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define _T(x)
Definition: vfdio.h:22
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
#define OutputDebugString
Definition: winbase.h:3890
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define Button_GetCheck(hwndCtl)
Definition: windowsx.h:31
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegCreateKeyEx
Definition: winreg.h:501
#define RegQueryValueEx
Definition: winreg.h:524
#define RegDeleteValue
Definition: winreg.h:508
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_STATE_ALL
Definition: winsvc.h:52
LPENUM_SERVICE_STATUS_PROCESSA LPENUM_SERVICE_STATUS_PROCESS
Definition: winsvc.h:549
LPSERVICE_FAILURE_ACTIONSA LPSERVICE_FAILURE_ACTIONS
Definition: winsvc.h:557
@ SC_ACTION_REBOOT
Definition: winsvc.h:201
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
QUERY_SERVICE_CONFIGA * LPQUERY_SERVICE_CONFIG
Definition: winsvc.h:550
#define SERVICE_CONFIG_FAILURE_ACTIONS
Definition: winsvc.h:66
@ SC_ENUM_PROCESS_INFO
Definition: winsvc.h:122
#define QueryServiceConfig2
Definition: winsvc.h:581
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
#define SERVICE_QUERY_CONFIG
Definition: winsvc.h:53
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
#define IDCANCEL
Definition: winuser.h:831
#define GetWindowTextLength
Definition: winuser.h:5799
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
#define VK_SPACE
Definition: winuser.h:2219
#define GetDlgItemText
Definition: winuser.h:5785
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
#define HWND_DESKTOP
Definition: winuser.h:1209
#define MB_ICONERROR
Definition: winuser.h:787
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:790
#define PostMessage
Definition: winuser.h:5832
HWND WINAPI GetParent(_In_ HWND)
#define MessageBox
Definition: winuser.h:5822
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define WM_DESTROY
Definition: winuser.h:1609
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SetDlgItemText
Definition: winuser.h:5849
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define SERVICE_DISABLED
Definition: cmtypes.h:979
#define SERVICE_WIN32
Definition: cmtypes.h:964
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185