VirtualBox

source: vbox/trunk/include/VBox/GuestHost/VBoxWinDrvStore.h@ 106321

Last change on this file since 106321 was 106321, checked in by vboxsync, 6 weeks ago

Windows installers: Big revamp for removing all DIFxApp-related / DIFxApi-related code and build dependencies for the host and guest installers. bugref:10762

This implements an own framework (VBoxWinDrvInst and VBoxWinDrvStore) for installing Windows drivers and querying / handling the Windows driver store,
along with testcases for the Windows guest and host installers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 KB
Line 
1/* $Id: VBoxWinDrvStore.h 106321 2024-10-15 13:06:30Z vboxsync $ */
2/** @file
3 * VBoxWinDrvInst - Header for Windows driver store handling.
4 */
5
6/*
7 * Copyright (C) 2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef VBOX_INCLUDED_GuestHost_VBoxWinDrvStore_h
38#define VBOX_INCLUDED_GuestHost_VBoxWinDrvStore_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <iprt/list.h>
44#include <iprt/utf16.h>
45
46/** Maximum model PnP ID length (in characters). */
47#define VBOXWINDRVSTORE_MAX_PNP_ID 255
48/** Maximum model name length (in characters). */
49#define VBOXWINDRVSTORE_MAX_MODEL_NAME 255
50/** Maximum driver name length (in characters). */
51#define VBOXWINDRVSTORE_MAX_DRIVER_NAME 255
52
53/**
54 * Structure for keeping a generic Windows driver store list.
55 */
56typedef struct _VBOXWINDRVSTORELIST
57{
58 /** List node. */
59 RTLISTANCHOR List;
60 /** Number of current entries of type VBOXWINDRVSTOREENTRY. */
61 size_t cEntries;
62} VBOXWINDRVSTORELIST;
63/** Pointer to a generic Windows driver store list. */
64typedef VBOXWINDRVSTORELIST *PVBOXWINDRVSTORELIST;
65
66/**
67 * Structure for keeping a Windows driver store entry.
68 */
69typedef struct _VBOXWINDRVSTOREENTRY
70{
71 RTLISTNODE Node;
72 /** Full path to the oemXXX.inf file within the driver store. */
73 RTUTF16 wszInfFile[RTPATH_MAX];
74 /** PnP ID of the driver.
75 * Only the first (valid) PnP ID is supported for now */
76 RTUTF16 wszPnpId[VBOXWINDRVSTORE_MAX_PNP_ID];
77 /** Model name of the driver.
78 * Only the first (valid) model name is supported for now */
79 RTUTF16 wszModel[VBOXWINDRVSTORE_MAX_MODEL_NAME];
80 /** Driver name (.sys).
81 * Only the first (valid) driver name is supported for now */
82 RTUTF16 wszDriverName[VBOXWINDRVSTORE_MAX_DRIVER_NAME];
83} VBOXWINDRVSTOREENTRY;
84/** Pointer to a Windows driver store entry. */
85typedef VBOXWINDRVSTOREENTRY *PVBOXWINDRVSTOREENTRY;
86
87struct _VBOXWINDRVSTORE;
88typedef struct _VBOXWINDRVSTORE *PVBOXWINDRVSTORE;
89
90/**
91 * Interface for a Windows driver store implementation.
92 */
93typedef struct _VBOXWINDRVSTOREIFACE
94{
95 /**
96 * Adds a driver to the driver store.
97 *
98 * @returns VBox status code.
99 * @param pThis Pointer to interface instance.
100 * @param pszInfFile Path of INF file to add.
101 *
102 * Optional and can be NULL.
103 */
104 DECLCALLBACKMEMBER(int, pfnDriverAdd,(PVBOXWINDRVSTORE pThis, const char *pszInfFile));
105 /**
106 * Removes a driver from the driver store.
107 *
108 * @returns VBox status code.
109 * @param pThis Pointer to interface instance.
110 * @param pszInfFile Path of INF file to remove.
111 *
112 * Optional and can be NULL.
113 */
114 DECLCALLBACKMEMBER(int, pfnDriverRemove,(PVBOXWINDRVSTORE pThis, const char *pszInfFile, bool fForce));
115 /**
116 * Performs (re-)enumeration of the driver store entries.
117 *
118 * @returns VBox status code.
119 * @param pThis Pointer to interface instance.
120 */
121 DECLCALLBACKMEMBER(int, pfnEnumerate,(PVBOXWINDRVSTORE pThis));
122} VBOXWINDRVSTOREIFACE;
123/** Pointer to a Windows driver store implementation. */
124typedef VBOXWINDRVSTOREIFACE *PVBOXWINDRVSTOREIFACE;
125
126/**
127 * Enumeration for a driver store backend.
128 */
129typedef enum _VBOXWINDRVSTOREBACKENDTYPE
130{
131 /** Invalid. */
132 VBOXWINDRVSTOREBACKENDTYPE_INVALID = 0,
133 /** Local file system. */
134 VBOXWINDRVSTOREBACKENDTYPE_LOCAL_FS
135} VBOXWINDRVSTOREBACKENDTYPE;
136
137/**
138 * Structure for keeping a Windows driver store backend.
139 *
140 * Currently only the (local) file system backend is supported.
141 */
142typedef struct _VBOXWINDRVSTOREBACKEND
143{
144 VBOXWINDRVSTOREBACKENDTYPE enmType;
145 /** The Windows driver store interface to use. */
146 VBOXWINDRVSTOREIFACE Iface;
147 union
148 {
149 struct
150 {
151 char szPathAbs[RTPATH_MAX];
152 } LocalFs;
153 } u;
154} VBOXWINDRVSTOREBACKEND;
155/** Pointer to a Windows driver store backend. */
156typedef VBOXWINDRVSTOREBACKEND *PVBOXWINDRVSTOREBACKEND;
157
158/**
159 * Structure for keeping Windows driver store instance data.
160 */
161typedef struct _VBOXWINDRVSTORE
162{
163 /** The current list of drivers. */
164 VBOXWINDRVSTORELIST lstDrivers;
165 /** The backend this driver store uses. */
166 VBOXWINDRVSTOREBACKEND Backend;
167} VBOXWINDRVSTORE;
168/** Pointer to Windows driver store instance data. */
169typedef VBOXWINDRVSTORE *PVBOXWINDRVSTORE;
170
171int VBoxWinDrvStoreCreate(PVBOXWINDRVSTORE *ppDrvStore);
172void VBoxWinDrvStoreDestroy(PVBOXWINDRVSTORE pDrvStore);
173int VBoxWinDrvStoreQueryAny(PVBOXWINDRVSTORE pDrvStore, const char *pszPattern, PVBOXWINDRVSTORELIST *ppResults);
174int VBoxWinDrvStoreQueryAll(PVBOXWINDRVSTORE pDrvStore, PVBOXWINDRVSTORELIST *ppResults);
175int VBoxWinDrvStoreQueryByPnpId(PVBOXWINDRVSTORE pDrvStore, const char *pszPnpId, PVBOXWINDRVSTORELIST *ppResults);
176int VBoxWinDrvStoreQueryByModelName(PVBOXWINDRVSTORE pDrvStore, const char *pszModelName, PVBOXWINDRVSTORELIST *ppResults);
177
178const char *VBoxWinDrvStoreBackendGetLocation(PVBOXWINDRVSTORE pDrvStore);
179
180void VBoxWinDrvStoreListFree(PVBOXWINDRVSTORELIST pList);
181
182#endif /* !VBOX_INCLUDED_GuestHost_VBoxWinDrvStore_h */
183
Note: See TracBrowser for help on using the repository browser.

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