1 // Copyright (c) 2012 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. 4 // 5 // A library to manage RLZ information for access-points shared 6 // across different client applications. 7 // 8 // All functions return true on success and false on error. 9 // This implemenation is thread safe. 10 // 11 // Each prototype mentions the registry access requirements: 12 // 13 // HKLM read: Will work from any process and at any privilege level on Vista. 14 // HKCU read: Calls made from the SYSTEM account must pass the current user's 15 // SID as the optional 'sid' param. Can be called from low integrity 16 // process on Vista. 17 // HKCU write: Calls made from the SYSTEM account must pass the current user's 18 // SID as the optional 'sid' param. Calls require at least medium 19 // integrity on Vista (e.g. Toolbar will need to use their broker) 20 // HKLM write: Calls must be made from an account with admin rights. No SID 21 // need be passed when running as SYSTEM. 22 // Functions which do not access registry will be marked with "no restrictions". 23 24 #ifndef RLZ_WIN_LIB_RLZ_LIB_H_ 25 #define RLZ_WIN_LIB_RLZ_LIB_H_ 26 27 // Clients can get away by just including rlz/lib/rlz_lib.h. This file only 28 // contains function definitions for files used by tests. It's mostly kept 29 // around for backwards-compatibility. 30 31 #include "rlz/lib/rlz_lib.h" 32 33 #include "base/win/registry.h" 34 35 namespace rlz_lib { 36 37 #if defined(OS_WIN) 38 39 // Initialize temporary HKLM/HKCU registry hives used for testing. 40 // Testing RLZ requires reading and writing to the Windows registry. To keep 41 // the tests isolated from the machine's state, as well as to prevent the tests 42 // from causing side effects in the registry, HKCU and HKLM are overridden for 43 // the duration of the tests. RLZ tests don't expect the HKCU and KHLM hives to 44 // be empty though, and this function initializes the minimum value needed so 45 // that the test will run successfully. 46 // 47 // The two arguments to this function should be the keys that will represent 48 // the HKLM and HKCU registry hives during the tests. This function should be 49 // called *before* the hives are overridden. 50 void InitializeTempHivesForTesting(const base::win::RegKey& temp_hklm_key, 51 const base::win::RegKey& temp_hkcu_key); 52 #endif // defined(OS_WIN) 53 54 } // namespace rlz_lib 55 56 #endif // RLZ_WIN_LIB_RLZ_LIB_H_ 57