Using Win32 functions in Visual FoxPro Image Gallery
Virtual Hard Disk (Win7)
Code examples:
..msdn    Add comment     W32 Constants      Translate this page
Creates a virtual hard disk (VHD) image file, either using default parameters or using an existing virtual disk or physical disk.
Code examples:
DWORD CreateVirtualDisk(
    __in   PVIRTUAL_STORAGE_TYPE VirtualStorageType,
    __in   PCWSTR Path,
    __in   VIRTUAL_DISK_ACCESS_MASK VirtualDiskAccessMask,
    __in   PSECURITY_DESCRIPTOR SecurityDescriptor,
    __in   ULONG ProviderSpecificFlags,
    __in   LPOVERLAPPED Overlapped,
    __out  PHANDLE Handle
FoxPro declaration:
DECLARE LONG CreateVirtualDisk IN virtdisk;
    STRING @VirtualStorageType,;
    STRING ImageFilePath,;
    INTEGER VirtualDiskAccessMask,;
    INTEGER SecurityDescriptor,;
    INTEGER VirtualDiskFlags,;
    LONG ProviderSpecificFlags,;
    STRING @VirtualDiskParameters,;
    INTEGER Overlapped,;
    INTEGER @Handle
VirtualStorageType [in]
A pointer to a VIRTUAL_STORAGE_TYPE structure that contains the desired disk type and vendor information.

Path [in]
A pointer to a valid string that represents the path to the new virtual disk image file.

VirtualDiskAccessMask [in]
The VIRTUAL_DISK_ACCESS_MASK value to use when opening the newly created virtual disk file.

SecurityDescriptor [in]
An optional pointer to a SECURITY_DESCRIPTOR to apply to the virtual disk image file. If this parameter is NULL, the parent directory"s security descriptor will be used.

Flags [in]
Creation flags, which must be a valid combination of the CREATE_VIRTUAL_DISK_FLAG enumeration.

ProviderSpecificFlags [in]
Flags specific to the type of virtual disk being created. May be zero if none are required.

Parameters [in]
A pointer to a valid CREATE_VIRTUAL_DISK_PARAMETERS structure that contains creation parameter data.

Overlapped [in]
An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.

Handle [out]
A pointer to the handle object that represents the newly created virtual disk.
Return value:
If the function succeeds, the return value is ERROR_SUCCESS (0) and the Handle parameter contains a valid pointer to the new virtual disk object.
nHandle = 0

nResult = CreateVirtualDisk(;
    STRCONV("d:\VDisks\vd002.vhd", 5),;
My comment:
Quote: SizeOf(CREATE_VIRTUAL_DISK_PARAMETERS) = 44 and I think it should be 48 since the Union is not anonymous...

Structures and unions are subject to alignment considerations...


See also: OpenVirtualDisk, AttachVirtualDisk
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
Created: 2010-11-02 08:21:20
Modified: 2010-11-02 08:52:16
Visited in last 7 days: 57
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
18 sec.Function: 'SetupOpenInfFile'
36 sec.Function: 'getprotobyname'
54 sec.Function: 'GdipCreateHICONFromBitmap'
1.2 min.Function: 'RegQueryValueEx'
1.5 min.Function: 'GetPrivateProfileString'
1.78 min.Function: 'CryptEncrypt'
2.1 min.Function: 'GdipCreateMatrix'
2.38 min.Function: 'GetClassInfo'
2.68 min.Function: 'DefWindowProc'
2.98 min.Function: 'GetFileInformationByHandle'
Advertise here!