30 PDWORD pdwCurrentControlSet,
31 PDWORD pdwDefaultControlSet,
32 PDWORD pdwFailedControlSet,
33 PDWORD pdwLastKnownGoodControlSet)
40 DPRINT(
"ScmGetControlSetValues() called\n");
55 (
LPBYTE)pdwCurrentControlSet,
59 *pdwCurrentControlSet = 0;
67 (
LPBYTE)pdwDefaultControlSet,
71 *pdwDefaultControlSet = 0;
79 (
LPBYTE)pdwFailedControlSet,
83 *pdwFailedControlSet = 0;
91 (
LPBYTE)pdwLastKnownGoodControlSet,
95 *pdwLastKnownGoodControlSet = 0;
101 DPRINT(
"Current: %lu\n", *pdwCurrentControlSet);
102 DPRINT(
"Default: %lu\n", *pdwDefaultControlSet);
103 DPRINT(
"Failed: %lu\n", *pdwFailedControlSet);
104 DPRINT(
"LastKnownGood: %lu\n", *pdwLastKnownGoodControlSet);
131 sizeof(dwControlSet));
150 DPRINT(
"ScmGetSetupInProgress()\n");
163 L"SystemSetupInProgress",
166 (
LPBYTE)&dwSetupInProgress,
171 DPRINT(
"SetupInProgress: %lu\n", dwSetupInProgress);
172 return dwSetupInProgress;
179 DWORD dwSourceControlSet,
180 DWORD dwDestinationControlSet)
182 WCHAR szSourceControlSetName[32];
183 WCHAR szDestinationControlSetName[32];
185 HKEY hDestinationControlSetKey =
NULL;
190 swprintf(szSourceControlSetName,
L"SYSTEM\\ControlSet%03lu", dwSourceControlSet);
191 DPRINT(
"Source control set: %S\n", szSourceControlSetName);
194 swprintf(szDestinationControlSetName,
L"SYSTEM\\ControlSet%03lu", dwDestinationControlSet);
195 DPRINT(
"Destination control set: %S\n", szDestinationControlSetName);
199 szSourceControlSetName,
202 &hSourceControlSetKey);
208 szDestinationControlSetName,
214 &hDestinationControlSetKey,
222 hDestinationControlSetKey);
229 if (hDestinationControlSetKey !=
NULL)
232 if (hSourceControlSetKey !=
NULL)
244 WCHAR szControlSetName[32];
248 DPRINT(
"ScmDeleteControSet(%lu)\n", dwControlSet);
251 swprintf(szControlSetName,
L"SYSTEM\\ControlSet%03lu", dwControlSet);
252 DPRINT(
"Control set: %S\n", szControlSetName);
277 DWORD dwCurrentControlSet, dwDefaultControlSet;
278 DWORD dwFailedControlSet, dwLastKnownGoodControlSet;
279 DWORD dwNewControlSet;
284 &dwDefaultControlSet,
286 &dwLastKnownGoodControlSet);
292 (dwCurrentControlSet == dwLastKnownGoodControlSet))
294 DPRINT(
"First boot after setup\n");
297 for (dwNewControlSet = 1; dwNewControlSet < 1000; dwNewControlSet++)
299 if ((dwNewControlSet != dwCurrentControlSet) &&
300 (dwNewControlSet != dwDefaultControlSet) &&
301 (dwNewControlSet != dwFailedControlSet) &&
302 (dwNewControlSet != dwLastKnownGoodControlSet))
307 if (dwNewControlSet >= 1000)
309 DPRINT1(
"Too many control sets\n");
338 DWORD dwCurrentControlSet, dwDefaultControlSet;
339 DWORD dwFailedControlSet, dwLastKnownGoodControlSet;
340 DWORD dwNewControlSet;
343 DPRINT(
"ScmAcceptBoot()\n");
347 DPRINT1(
"Boot has already been accepted\n");
353 &dwDefaultControlSet,
355 &dwLastKnownGoodControlSet);
360 for (dwNewControlSet = 1; dwNewControlSet < 1000; dwNewControlSet++)
362 if ((dwNewControlSet != dwCurrentControlSet) &&
363 (dwNewControlSet != dwDefaultControlSet) &&
364 (dwNewControlSet != dwFailedControlSet) &&
365 (dwNewControlSet != dwLastKnownGoodControlSet))
370 if (dwNewControlSet >= 1000)
372 DPRINT1(
"Too many control sets\n");
383 if ((dwLastKnownGoodControlSet != dwCurrentControlSet) &&
384 (dwLastKnownGoodControlSet != dwDefaultControlSet) &&
385 (dwLastKnownGoodControlSet != dwFailedControlSet))
404 DPRINT(
"ScmRunLastKnownGood()\n");
408 DPRINT1(
"Boot has already been accepted\n");
#define RegCloseKey(hKey)
DWORD ScmRunLastKnownGood(VOID)
DWORD ScmCreateLastKnownGoodControlSet(VOID)
static DWORD ScmSetLastKnownGoodControlSet(DWORD dwControlSet)
LSTATUS WINAPI RegCopyTreeW(_In_ HKEY, _In_opt_ LPCWSTR, _In_ HKEY)
static DWORD ScmGetSetupInProgress(VOID)
static DWORD ScmDeleteControlSet(DWORD dwControlSet)
DWORD ScmAcceptBoot(VOID)
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
static DWORD ScmGetControlSetValues(PDWORD pdwCurrentControlSet, PDWORD pdwDefaultControlSet, PDWORD pdwFailedControlSet, PDWORD pdwLastKnownGoodControlSet)
static DWORD ScmCopyControlSet(DWORD dwSourceControlSet, DWORD dwDestinationControlSet)
static BOOL bBootAccepted
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegFlushKey(HKEY hKey)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_NO_MORE_ITEMS
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define REG_OPTION_NON_VOLATILE
#define KEY_ENUMERATE_SUB_KEYS
#define ERROR_BOOT_ALREADY_ACCEPTED
#define HKEY_LOCAL_MACHINE