VirtualBox

source: vbox/trunk/src/VBox/Main/include/NvramStoreImpl.h@ 94703

Last change on this file since 94703 was 94660, checked in by vboxsync, 3 years ago

doc/manual,Main,Frontends: API changes in preparation for full VM encryption, guarded by VBOX_WITH_FULL_VM_ENCRYPTION (disabled by default) and returning a not supported error for now, bugref:9955

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: NvramStoreImpl.h 94660 2022-04-21 08:38:34Z vboxsync $ */
2/** @file
3 * VirtualBox COM NVRAM store class implementation
4 */
5
6/*
7 * Copyright (C) 2021-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_NvramStoreImpl_h
19#define MAIN_INCLUDED_NvramStoreImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "NvramStoreWrap.h"
25#include <VBox/vmm/pdmdrv.h>
26
27#ifdef VBOX_COM_INPROC
28class Console;
29#else
30class GuestOSType;
31
32namespace settings
33{
34 struct NvramSettings;
35}
36#endif
37
38class ATL_NO_VTABLE NvramStore :
39 public NvramStoreWrap
40{
41public:
42
43 DECLARE_COMMON_CLASS_METHODS(NvramStore)
44
45 HRESULT FinalConstruct();
46 void FinalRelease();
47
48 // public initializer/uninitializer for internal purposes only
49#ifdef VBOX_COM_INPROC
50 HRESULT init(Console *aParent, const com::Utf8Str &strNonVolatileStorageFile);
51#else
52 HRESULT init(Machine *parent);
53 HRESULT init(Machine *parent, NvramStore *that);
54 HRESULT initCopy(Machine *parent, NvramStore *that);
55#endif
56 void uninit();
57
58 // public methods for internal purposes only
59#ifndef VBOX_COM_INPROC
60 HRESULT i_loadSettings(const settings::NvramSettings &data);
61 HRESULT i_saveSettings(settings::NvramSettings &data);
62#endif
63
64#ifdef VBOX_COM_INPROC
65 static const PDMDRVREG DrvReg;
66#else
67 void i_rollback();
68 void i_commit();
69 void i_copyFrom(NvramStore *aThat);
70 HRESULT i_applyDefaults(GuestOSType *aOSType);
71#endif
72
73 com::Utf8Str i_getNonVolatileStorageFile();
74 void i_updateNonVolatileStorageFile(const com::Utf8Str &aNonVolatileStorageFile);
75
76 int i_loadStore(const char *pszPath);
77 int i_saveStore(void);
78
79#ifndef VBOX_COM_INPROC
80 HRESULT i_retainUefiVarStore(PRTVFS phVfs, bool fReadonly);
81 HRESULT i_releaseUefiVarStore(RTVFS hVfs);
82#endif
83
84 HRESULT i_updateEncryptionSettings(const com::Utf8Str &strKeyId,
85 const com::Utf8Str &strKeyStore);
86 HRESULT i_getEncryptionSettings(com::Utf8Str &strKeyId,
87 com::Utf8Str &strKeyStore);
88
89 int i_addPassword(const Utf8Str &strKeyId, const Utf8Str &strPassword);
90 int i_removePassword(const Utf8Str &strKeyId);
91 int i_removeAllPasswords();
92
93private:
94
95 // Wrapped NVRAM store properties
96 HRESULT getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile);
97 HRESULT getUefiVariableStore(ComPtr<IUefiVariableStore> &aUefiVarStore);
98 HRESULT getKeyId(com::Utf8Str &aKeyId);
99 HRESULT getKeyStore(com::Utf8Str &aKeyStore);
100
101 // Wrapped NVRAM store members
102 HRESULT initUefiVariableStore(ULONG aSize);
103
104 int i_loadStoreFromTar(RTVFSFSSTREAM hVfsFssTar);
105 int i_saveStoreAsTar(const char *pszPath);
106
107#ifdef VBOX_COM_INPROC
108 static DECLCALLBACK(int) i_SsmSaveExec(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM);
109 static DECLCALLBACK(int) i_SsmLoadExec(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
110
111 static DECLCALLBACK(int) i_nvramStoreQuerySize(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
112 uint64_t *pcb);
113 static DECLCALLBACK(int) i_nvramStoreReadAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
114 void *pvBuf, size_t cbRead);
115 static DECLCALLBACK(int) i_nvramStoreWriteAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
116 const void *pvBuf, size_t cbWrite);
117 static DECLCALLBACK(int) i_nvramStoreDelete(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath);
118 static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
119 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
120 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
121#endif
122
123 struct Data; // opaque data struct, defined in NvramStoreImpl.cpp
124 Data *m;
125};
126
127#endif /* !MAIN_INCLUDED_NvramStoreImpl_h */
128/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette