ReactOS 0.4.16-dev-306-g647d351
startuppage.c
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/startuppage.c
5 * PURPOSE: Startup page message handler
6 * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
7 *
8 */
9
10#include "precomp.h"
11
15
18
21{
23 TCHAR szTemp[256];
24 DWORD dwStyle;
25
28
29 switch (message) {
30 case WM_INITDIALOG:
31
33 hStartupDialog = hDlg;
34
36 dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
38
40
41 // Initialize the application page's controls
43
45 column.pszText = szTemp;
46 column.cx = 150;
48
51 column.pszText = szTemp;
52 column.cx = 150;
54
57 column.pszText = szTemp;
58 column.cx = 250;
60
61 GetAutostartEntriesFromRegistry(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
62 GetAutostartEntriesFromRegistry(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
63 GetDisabledAutostartEntriesFromRegistry (_T("SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\startupreg"));
64 GetDisabledAutostartEntriesFromRegistry (_T("SOFTWARE\\Microsoft\\Shared Tools\\MSConfig\\startupfolder"));
65
66 //FIXME: What about HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
67 //FIXME: Common Startup (startmenu)
68
69 return TRUE;
70 }
71
72 return 0;
73}
74
75
76 void
78{
79 HKEY hKey, hSubKey;
80 DWORD Index, SubIndex, dwValues, dwSubValues;
81 DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME;
83 TCHAR* Data;
84 TCHAR szValueName[MAX_KEY_LENGTH];
85 TCHAR szSubValueName[MAX_KEY_LENGTH];
86 TCHAR szSubPath[MAX_KEY_LENGTH];
87
89 {
91 {
92 for (Index = 0; Index < dwValues; Index++)
93 {
94 dwValueLength = MAX_KEY_LENGTH;
95 dwDataLength = MAX_VALUE_NAME;
97 if (Data == NULL)
98 break;
99
100 if(RegEnumKeyEx(hKey, Index, szValueName, &dwValueLength, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
101 {
103 continue;
104 }
105 _stprintf(szSubPath, _T("%s\\%s"), szBasePath, szValueName);
106 memset(&item, 0, sizeof(LV_ITEM));
107 item.mask = LVIF_TEXT;
108 item.iImage = 0;
109 item.pszText = szValueName;
111 item.lParam = 0;
114 {
115 if (RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwSubValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
116 {
117 for(SubIndex = 0; SubIndex < dwSubValues; SubIndex++)
118 {
119 dwValueLength = MAX_KEY_LENGTH;
120 dwDataLength = MAX_VALUE_NAME;
121 if(RegEnumValue(hSubKey, SubIndex, szSubValueName, &dwValueLength, NULL, NULL, (LPBYTE)Data, &dwDataLength) == ERROR_SUCCESS)
122 {
123 item.iSubItem = -1;
124 if (!_tcscmp(szSubValueName, _T("command")))
125 item.iSubItem = 1;
126 else if (!_tcscmp(szSubValueName, _T("key")) || !_tcscmp(szSubValueName, _T("location")))
127 item.iSubItem = 2;
128 else if (!_tcscmp(szSubValueName, _T("item")))
129 item.iSubItem = 0;
130 if (item.iSubItem != -1)
131 {
132 GetLongPathName(Data, Data, (DWORD) _tcsclen(Data));
133 item.pszText = Data;
135 }
136 }
137 }
138 }
139 }
140 RegCloseKey(hSubKey);
142 }
143 }
145 }
146}
147
148void
150{
151 HKEY hKey;
152 DWORD Index, dwValues, retVal, dwType;
153 DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME;
154 TCHAR* Data;
155 TCHAR lpValueName[MAX_KEY_LENGTH];
158
159 if (RegOpenKeyEx(hRootKey, KeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
160 {
162 {
163 for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++)
164 {
165 dwValueLength = MAX_KEY_LENGTH;
166 dwDataLength = MAX_VALUE_NAME;
168 if (Data == NULL)
169 break;
170 retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);
171 if (retVal == ERROR_SUCCESS)
172 {
173 memset(&item, 0, sizeof(LV_ITEM));
174 item.mask = LVIF_TEXT;
175 item.iImage = 0;
176 item.pszText = lpValueName;
178 item.lParam = 0;
181
182 if ((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ))
183 {
184 GetLongPathName(Data, Data, (DWORD) _tcsclen(Data));
185 item.pszText = Data;
186 item.iSubItem = 1;
188 }
189
190 switch ((ULONG_PTR)hRootKey)
191 {
193 _tcscpy(Path, _T("HKLM\\\0"));
194 break;
196 _tcscpy(Path, _T("HKCU\\\0"));
197 break;
198 default:
199 _tcscpy(Path, _T("\0"));
200 }
201
203 item.pszText = Path;
204 item.iSubItem = 2;
206 }
208 }
209 }
211 }
212
213}
PRTL_UNICODE_STRING_BUFFER Path
#define MAX_VALUE_NAME
Definition: control.c:28
#define IDS_STARTUP_COLUMN_PATH
Definition: resource.h:87
#define IDS_STARTUP_COLUMN_CMD
Definition: resource.h:86
#define IDS_STARTUP_COLUMN_ELEMENT
Definition: resource.h:85
#define IDC_STARTUP_LIST
Definition: resource.h:19
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
HINSTANCE hInst
Definition: dxdiag.c:13
#define MAX_KEY_LENGTH
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define _tcscmp
Definition: tchar.h:1424
#define _tcscat
Definition: tchar.h:622
#define _tcscpy
Definition: tchar.h:623
#define _tcsclen
Definition: tchar.h:1447
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
#define _stprintf
Definition: utility.h:124
static ATOM item
Definition: dde.c:856
HWND hStartupListCtrl
Definition: startuppage.c:13
HWND hStartupPage
Definition: startuppage.c:12
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: startuppage.c:20
void GetDisabledAutostartEntriesFromRegistry(TCHAR *szBasePath)
Definition: startuppage.c:77
HWND hStartupDialog
Definition: startuppage.c:14
void GetAutostartEntriesFromRegistry(HKEY hRootKey, TCHAR *KeyName)
Definition: startuppage.c:149
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define DWORD
Definition: nt_native.h:44
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define LVM_SETITEMTEXT
Definition: commctrl.h:2694
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define ListView_SetCheckState(hwndLV, i, fCheck)
Definition: commctrl.h:2679
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2736
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LV_ITEM
Definition: commctrl.h:2342
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2732
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2729
#define LV_COLUMN
Definition: commctrl.h:2552
#define memset(x, y, z)
Definition: compat.h:39
Definition: tftpd.h:60
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define _T(x)
Definition: vfdio.h:22
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegEnumValue
Definition: winreg.h:511
#define RegEnumKeyEx
Definition: winreg.h:510
#define RegQueryInfoKey
Definition: winreg.h:521
#define SWP_NOACTIVATE
Definition: winuser.h:1245
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1248
#define WM_INITDIALOG
Definition: winuser.h:1742
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SendMessage
Definition: winuser.h:5855
#define LoadString
Definition: winuser.h:5831
#define SWP_NOOWNERZORDER
Definition: winuser.h:1252
#define SWP_NOZORDER
Definition: winuser.h:1250
char TCHAR
Definition: xmlstorage.h:189