1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sandbox/win/src/restricted_token.h"
6 #include "sandbox/win/src/restricted_token_utils.h"
7 #include "sandbox/win/tools/finder/finder.h"
14 memset(filesystem_stats_, 0, sizeof(filesystem_stats_));
15 memset(registry_stats_, 0, sizeof(registry_stats_));
16 memset(kernel_object_stats_, 0, sizeof(kernel_object_stats_));
21 ::CloseHandle(token_handle_);
24 DWORD Finder::Init(sandbox::TokenLevel token_type,
28 DWORD err_code = ERROR_SUCCESS;
31 if (ERROR_SUCCESS != err_code)
34 object_type_ = object_type;
35 access_type_ = access_type;
36 file_output_ = file_output;
38 err_code = sandbox::CreateRestrictedToken(&token_handle_, token_type,
39 sandbox::INTEGRITY_LEVEL_LAST,
44 DWORD Finder::Scan() {
46 return ERROR_NO_TOKEN;
49 if (object_type_ & kScanRegistry) {
50 ParseRegistry(HKEY_LOCAL_MACHINE, L"HKLM\\");
51 ParseRegistry(HKEY_USERS, L"HKU\\");
52 ParseRegistry(HKEY_CURRENT_CONFIG, L"HKCC\\");
55 if (object_type_ & kScanFileSystem) {
56 ParseFileSystem(L"\\\\?\\C:");
59 if (object_type_ & kScanKernelObjects) {
60 ParseKernelObjects(L"\\");