ReactOS 0.4.15-dev-7897-g78dc504
startuppage.c File Reference
#include "precomp.h"
Include dependency graph for startuppage.c:

Go to the source code of this file.

Functions

void GetAutostartEntriesFromRegistry (HKEY hRootKey, TCHAR *KeyName)
 
void GetDisabledAutostartEntriesFromRegistry (TCHAR *szBasePath)
 
INT_PTR CALLBACK StartupPageWndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

HWND hStartupPage
 
HWND hStartupListCtrl
 
HWND hStartupDialog
 

Function Documentation

◆ GetAutostartEntriesFromRegistry()

void GetAutostartEntriesFromRegistry ( HKEY  hRootKey,
TCHAR KeyName 
)

Definition at line 149 of file startuppage.c.

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 (PtrToLong(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 PtrToLong(p)
Definition: basetsd.h:84
#define RegCloseKey(hKey)
Definition: registry.h:49
#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 MAX_KEY_LENGTH
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#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
static ATOM item
Definition: dde.c:856
HWND hStartupListCtrl
Definition: startuppage.c:13
#define KEY_READ
Definition: nt_native.h:1023
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define LVM_SETITEMTEXT
Definition: commctrl.h:2689
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define ListView_SetCheckState(hwndLV, i, fCheck)
Definition: commctrl.h:2674
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define LV_ITEM
Definition: commctrl.h:2337
#define LVIF_TEXT
Definition: commctrl.h:2309
#define memset(x, y, z)
Definition: compat.h:39
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
#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 RegQueryInfoKey
Definition: winreg.h:521
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char TCHAR
Definition: xmlstorage.h:189

◆ GetDisabledAutostartEntriesFromRegistry()

void GetDisabledAutostartEntriesFromRegistry ( TCHAR szBasePath)

Definition at line 77 of file startuppage.c.

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}
#define _tcscmp
Definition: tchar.h:1424
if(dx< 0)
Definition: linetemp.h:194
#define _stprintf
Definition: utility.h:124
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define RegEnumKeyEx
Definition: winreg.h:510

◆ StartupPageWndProc()

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

Definition at line 20 of file startuppage.c.

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}
#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
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HINSTANCE hInst
Definition: dxdiag.c:13
void GetDisabledAutostartEntriesFromRegistry(TCHAR *szBasePath)
Definition: startuppage.c:77
HWND hStartupDialog
Definition: startuppage.c:14
void GetAutostartEntriesFromRegistry(HKEY hRootKey, TCHAR *KeyName)
Definition: startuppage.c:149
#define DWORD
Definition: nt_native.h:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2727
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define LV_COLUMN
Definition: commctrl.h:2547
Definition: tftpd.h:60
#define SWP_NOACTIVATE
Definition: winuser.h:1242
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LoadString
Definition: winuser.h:5819
#define SWP_NOOWNERZORDER
Definition: winuser.h:1249
#define SWP_NOZORDER
Definition: winuser.h:1247

Variable Documentation

◆ hStartupDialog

HWND hStartupDialog

Definition at line 14 of file startuppage.c.

◆ hStartupListCtrl

HWND hStartupListCtrl

Definition at line 13 of file startuppage.c.

◆ hStartupPage

HWND hStartupPage

Definition at line 12 of file startuppage.c.