SetVhdDeviceElement method of the BcdObject class

Creates a virtual hard disk (VHD) boot device element.

Syntax


boolean SetVhdDeviceElement(
  [in]  ULONG Type,
  [in]  PCWSTR Path,
  [in]  ULONG ParentDeviceType,
  [in]  PCWSTR ParentAdditionalOptions,
  [in]  PCWSTR ParentPath,
  [in]  ULONG CustomLocate
);

Parameters

Type [in]

The element type. This parameter is one of the values from the following enumerations:

It can also be a custom element type created for your own use.

Path [in]

The path to the VHD file.

ParentDeviceType [in]

The device type. This parameter can be one of the following values.

ValueMeaning
BootDevice
1

Device that initiated the boot.

FileDevice
3

File that contains file system metadata. This file is treated as a device.

LocateDevice
8

Locate device. The ParentPath parameter is not used.

PartitionDevice
2

Disk partition.

RamdiskDevice
4

Ramdisk.

UnknownDevice
5

Unknown.

 

ParentAdditionalOptions [in]

Either a GUID in string form with surrounding braces that represents another object in the store, or the empty string ("").

ParentPath [in]

The path to the physical partition that contains the VHD file. If the ParentDeviceType parameter is Locate, this parameter is not used.

CustomLocate [in]

A BCD element that overrides the default locate heuristics for a VHD device.

If this parameter is zero, the application path (for example, \Windows\System32\winload.exe) is used to locate a boot device and the system root element (\Windows) is used to locate an operating system device.

Remarks

A native VHD boot device element is identified by its VHD file name and a parent device that describes the physical partition that contains the VHD file. This kind of VHD device element also specifies a partition within the VHD and is the only VHD boot device that supports multi-boot scenarios within a single VHD. A native VHD boot device element provides the fastest performance because it is fully qualified; however, its entry in the BCD store is not portable and cannot be used in a BCD store that will be imported to a different system. To create native VHD boot device elements for mounted VHDs, use the SetPartitionDeviceElement method.

A VPART+PPART locate VHD device element is identified by its VHD file name only, and the parent device is not specified. The system resolves the VPART to the first VHD partition that contains the specified element and resolves the PPART to the first physical partition that contains the VHD file. A VPART+PPART locate VHD device element is slower and cannot be used for multi-boot scenarios, but its entry in the BCD store is portable. Use this kind of locate VHD device entry in a BCD store that will be imported on a different system.

A VPART locate VHD device element is identified by its VHD file name and its corresponding parent physical partition device. A VPART locate VHD device element has better performance than a VPART+PPART locate VHD device element, but its entry in the BCD store is not portable. The VPART locate device is the best choice for most applications because it provides reasonable performance and can be created without having to mount the VHD.

To enumerate a VHD boot device, use the locate data types BcdDeviceLocateData, BcdDeviceLocateElementChildData, BcdDeviceLocateElementData, and BcdDeviceLocateStringData.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Namespace

\\.\Root\WMI

MOF

Bcd.mof

See also

BcdDeviceLocateData
BcdDeviceLocateElementChildData
BcdDeviceLocateElementData
BcdDeviceLocateStringData
BcdObject

 

 

Community Additions

ADD
Show:
© 2014 Microsoft