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.
5 // Library functions related to the OEM Deal Confirmation Code.
7 #ifndef RLZ_WIN_LIB_MACHINE_DEAL_H_
8 #define RLZ_WIN_LIB_MACHINE_DEAL_H_
11 #include "rlz/lib/rlz_lib.h"
15 class MachineDealCode
{
17 // Set the OEM Deal Confirmation Code (DCC). This information is used for RLZ
18 // initalization. Must have write access to HKLM - SYSTEM or admin, unless
19 // rlz_lib::CreateMachineState() has been successfully called.
20 static bool Set(const char* dcc
);
22 // Get the OEM Deal Confirmation Code from the registry. Used to ping
24 static bool Get(AccessPoint point
,
27 const wchar_t* sid
= NULL
);
29 // Parses a ping response, checks if it is valid and sets the machine DCC
30 // from the response. The response should also contain the current value of
31 // the DCC to be considered valid.
32 // Write access to HKLM (system / admin) needed, unless
33 // rlz_lib::CreateMachineState() has been successfully called.
34 static bool SetFromPingResponse(const char* response
);
36 // Gets the new DCC to set from a ping response. Returns true if the ping
37 // response is valid. Sets has_new_dcc true if there is a new DCC value.
38 static bool GetNewCodeFromPingResponse(const char* response
,
43 // Get the DCC cgi argument string to append to a daily or financial ping.
44 static bool GetAsCgi(char* cgi
, int cgi_size
);
46 // Get the machine code.
47 static bool Get(char* dcc
, int dcc_size
);
50 // Clear the DCC value. Only for testing purposes.
51 // Requires write access to HKLM, unless rlz_lib::CreateMachineState() has
52 // been successfully called.
59 } // namespace rlz_lib
61 #endif // RLZ_WIN_LIB_MACHINE_DEAL_H_