Popular Post Yashied Posted February 2, 2015 Popular Post Share Posted February 2, 2015 LAST VERSION - 1.002-Feb-15This UDF allows to use API Virtual Hard Disk (VHD) in AutoIt scripts. VHD format is a publicly-available image format specification that specifies a virtual hard disk encapsulated in a single file, capable of hosting native file systems while supporting standard disk and file operations. VHD is supported on Windows 7 and Windows Server 2008 R2. WinAPIVhd UDF written for AutoIt 3.3.6.x or later, however, if you are using AutiIt 3.3.12.x, you can integrate this library into AutoIt package (see below). The library contains a detailed help file (WinAPIVhd.chm) in AutoIt style, syntax highlighting and calltips files for SciTE (required full version), and full examples. I hope that many users will find this library useful.Moreover, I created two icons for the file types .vhd (Virtual Hard Disk) and .vhdx (Hyper-V Virtual Hard Disk) which you can use for yourself. You can also download more document icons in the same style for AutoIt, Restorator, etc. To associate icons with the required file types, you can use my simple utility >File Types Manager.Installation (optionaly)If you are using AutiIt 3.3.12.0 or later, you can integrate WinAPIVhd UDF library into AutoIt package. This will add the calltips and syntax highlighting for new functions, and provide a simpler way to include the library in your scripts. To integrate WinAPIVhd UDF library into AutoIt, you should do the following steps. Before to do anything, you should make sure that the WinAPIVhd UDF library is not included in the AutoIt package. For more information, see the help file (WinAPIVhd.chm) within the archive.Сopy APIVhdConstants.au3 and WinAPIVhd.au3 to AutoIt3Include.Сopy Examples*.au3 to AutoIt3ExamplesHelpFile.Сopy SciTE*.* to AutoIt3SciTE (only if the full version of SciTE is installed).Сopy HelpWinAPIVhd.chm to AutoIt3.Open AutoIt3IncludeAPIConstants.au3 in SciTE and add the line #include "APIVhdConstants.au3" to the end of list.Open AutoIt3IncludeWinAPIEx.au3 in SciTE and add the line #include "WinAPIVhd.au3" to the end of list.Available functions_WinAPI_AddVirtualDiskParent_WinAPI_AttachVirtualDisk_WinAPI_BreakMirrorVirtualDisk_WinAPI_CompactVirtualDisk_WinAPI_CreateCreateVirtualDiskParametersV1_WinAPI_CreateCreateVirtualDiskParametersV2_WinAPI_CreateExpandVirtualDiskParameters_WinAPI_CreateMergeVirtualDiskParametersV1_WinAPI_CreateMergeVirtualDiskParametersV2_WinAPI_CreateMirrorVirtualDiskParameters_WinAPI_CreateOpenVirtualDiskParametersV1_WinAPI_CreateOpenVirtualDiskParametersV2_WinAPI_CreateResizeVirtualDiskParameters_WinAPI_CreateVirtualDisk_WinAPI_CreateVirtualStorageType_WinAPI_DeleteVirtualDiskMetadata_WinAPI_DetachVirtualDisk_WinAPI_EnumerateVirtualDiskMetadata_WinAPI_ExpandVirtualDisk_WinAPI_GetStorageDependencyInformation_WinAPI_GetVirtualDiskInformation_WinAPI_GetVirtualDiskMetadata_WinAPI_GetVirtualDiskOperationProgress_WinAPI_GetVirtualDiskPhysicalPath_WinAPI_MergeVirtualDisk_WinAPI_MirrorVirtualDisk_WinAPI_OpenVirtualDisk_WinAPI_ResizeVirtualDisk_WinAPI_SetVirtualDiskInformation_WinAPI_SetVirtualDiskMetadataWinAPIVhd UDF Library v1.0Previous downloads: 17WinAPIVhd.zipExampleexpandcollapse popup#Include <APIConstants.au3> #Include <GUIConstantsEx.au3> #Include <EditConstants.au3> #Include <WinAPIEx.au3> #Include <APIVhdConstants.au3> #Include <WinAPIVhd.au3> Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) Global $hForm, $hVHD = 0, $Edit, $Button[3], $Path, $Size = 128 * 1024 * 1024 If _WinAPI_GetVersion() < '6.1' Then MsgBox(16, 'Error', 'Require Windows 7 or later.') Exit EndIf $hForm = GUICreate('VHD API Example', 460, 302) $Edit = GUICtrlCreateEdit('', 13, 13, 434, 238, $ES_READONLY) GUICtrlSetFont(-1, 9, 400, 0, 'Courier New') GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetColor(-1, 0x404040) $Button[0] = GUICtrlCreateButton('Create VHD', 12, 263, 140, 27) $Button[1] = GUICtrlCreateButton('Open VHD', 160, 263, 140, 27) $Button[2] = GUICtrlCreateButton('Close VHD', 308, 263, 140, 27) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE If $hVHD Then _VHD_Close() EndIf Exit Case $Button[0] $Path = FileSaveDialog('Create VHD', @ScriptDir, 'Virtual Hard Disk (*.vhd)|All Files (*.*)', 2 + 16, 'Test.vhd', $hForm) If $Path Then If FileExists($Path) Then FileDelete($Path) EndIf Else ContinueLoop EndIf GUICtrlSetData($Edit, '') If Not _VHD_Create($Path, $Size) Then If FileExists($Path) Then FileDelete($Path) EndIf ContinueLoop EndIf For $i = 0 To 1 GUiCtrlSetState($Button[$i], $GUI_DISABLE) Next GUiCtrlSetState($Button[2], $GUI_ENABLE) Case $Button[1] $Path = FileOpenDialog('Open VHD', @ScriptDir, 'Virtual Hard Disk (*.vhd)|All Files (*.*)', 1 + 2, '', $hForm) If $Path Then Else ContinueLoop EndIf GUICtrlSetData($Edit, '') If Not _VHD_Open($Path) Then ContinueLoop EndIf For $i = 0 To 1 GUiCtrlSetState($Button[$i], $GUI_DISABLE) Next GUiCtrlSetState($Button[2], $GUI_ENABLE) Case $Button[2] _VHD_Close() GUiCtrlSetState($Button[2], $GUI_DISABLE) For $i = 0 To 1 GUiCtrlSetState($Button[$i], $GUI_ENABLE) Next EndSwitch WEnd Func _P2L($sDisk) Local $aData, $aList, $iDisk, $iTime, $sMask = '' $iDisk = StringReplace($sDisk, '\\.\PHYSICALDRIVE', '') If Not StringIsDigit($iDisk) Then Return $sDisk EndIf $iDisk = Number($iDisk) $iTime = TimerInit() While TimerDiff($iTime) < 5000 $aList = DriveGetDrive('FIXED') If IsArray($aList) Then For $i = 1 To $aList[0] If Not StringInStr($sMask, $aList[$i]) Then $aData =_WinAPI_GetDriveNumber($aList[$i]) If (IsArray($aData)) And ($aData[1] = $iDisk) Then Return StringUpper($aList[$i]) EndIf EndIf $sMask&= $aList[$i] Next EndIf Sleep(10) WEnd Return $sDisk EndFunc ;==>_P2L Func _Log($sEvent, $iError = -1) Switch $iError Case -1 $sEvent &= @CRLF Case 0 $sEvent &= ': OK' & @CRLF Case Else $sEvent &= ': FAIL (' & $iError & ')' & @CRLF EndSwitch GUICtrlSendMsg($Edit, $EM_SETSEL, 32767, 32767) GUICtrlSetData($Edit, $sEvent, 1) EndFunc ;==>_Log Func _VHD_Close() Local $sDisk = _P2L(_WinAPI_GetVirtualDiskPhysicalPath($hVHD)) _WinAPI_DetachVirtualDisk($hVHD) If @Error Then _Log('Detach', @Extended) Else _Log('Detach', 0) EndIf _WinAPI_CloseHandle($hVHD) $hVHD = 0 If $sDisk Then _Log('VHD (' & $sDisk & ') has been closed!') EndIf EndFunc ;==>_VHD_Close Func _VHD_Create($sPath, $iSize) Local $tVST, $tCVDPV1, $tGVDI, $sDisk, $Error = True _Log('Path: ' & _WinAPI_PathCompactPathEx($sPath, 60)) Do $tVST = _WinAPI_CreateVirtualStorageType($VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT) $tCVDPV1 = _WinAPI_CreateCreateVirtualDiskParametersV1($iSize) $hVHD = _WinAPI_CreateVirtualDisk($sPath, $tVST, $tCVDPV1, $VIRTUAL_DISK_ACCESS_ALL, $CREATE_VIRTUAL_DISK_FLAG_FULL_PHYSICAL_ALLOCATION) If @Error Then _Log('Create', @Extended) ExitLoop Else _Log('Create', 0) EndIf _WinAPI_AttachVirtualDisk($hVHD) If @Error Then _Log('Attach', @Extended) ExitLoop Else _Log('Attach', 0) EndIf $sDisk = _WinAPI_GetVirtualDiskPhysicalPath($hVHD) If @Error Then ; Nothing EndIf _VHD_Initialize($sDisk) If @Error Then _Log('Initialize', @Extended) ExitLoop Else _Log('Initialize', 0) EndIf $Error = False Until 1 If $Error Then If $hVHD Then _WinAPI_DetachVirtualDisk($hVHD) _WinAPI_CloseHandle($hVHD) EndIf $hVHD = 0 Return 0 EndIf $tGVDI = _WinAPI_GetVirtualDiskInformation($hVHD, $GET_VIRTUAL_DISK_INFO_IDENTIFIER) If Not @Error Then _Log('GUID: ' & _WinAPI_StringFromGUID(DllStructGetPtr($tGVDI, 'Identifier'))) EndIf $tGVDI = _WinAPI_GetVirtualDiskInformation($hVHD, $GET_VIRTUAL_DISK_INFO_SIZE) If Not @Error Then _Log('Size: ' & _WinAPI_StrFormatByteSize(DllStructGetData($tGVDI, 'VirtualSize'))) EndIf _Log('VHD (' & _P2L($sDisk) & ') has been successfully created and ready for use!') Return 1 EndFunc ;==>_VHD_Create Func _VHD_Initialize($sDisk) ;~ Local Const $PARTITION_ENTRY_UNUSED = 0x00 ;~ Local Const $PARTITION_EXTENDED = 0x05 ;~ Local Const $PARTITION_FAT_12 = 0x01 ;~ Local Const $PARTITION_FAT_16 = 0x04 ;~ Local Const $PARTITION_FAT_32 = 0x0B Local Const $PARTITION_IFS = 0x07 ;~ Local Const $PARTITION_LDM = 0x42 ;~ Local Const $PARTITION_NTFT = 0x80 ;~ Local Const $PARTITION_VALID_NTFT = 0xC0 Local Const $PARTITION_STYLE_MBR = 0 ;~ Local Const $PARTITION_STYLE_GPT = 1 ;~ Local Const $PARTITION_STYLE_RAW = 2 Local Const $tagDISK_GEOMETRY = 'int64 Cylinders;dword MediaType;dword TracksPerCylinder;dword SectorsPerTrack;dword BytesPerSector;' Local Const $tagCREATE_DISK_MBR = 'dword Signature;byte GPT[16];' ;~ Local Const $tagCREATE_DISK_GPT = 'byte DiskId[16];dword MaxPartitionCount' Local Const $tagCREATE_DISK = 'dword PartitionStyle;' & $tagCREATE_DISK_MBR Local Const $tagPARTITION_INFORMATION_MBR = 'byte PartitionType;boolean BootIndicator;boolean RecognizedPartition;dword HiddenSectors;byte GPT[104];' ;~ Local Const $tagPARTITION_INFORMATION_GPT = 'byte PartitionType[16];byte PartitionId[16];uint64 Attributes;wchar Name[36];' Local Const $tagPARTITION_INFORMATION_EX = 'dword PartitionStyle;int64 StartingOffset;int64 PartitionLength;dword PartitionNumber;boolean RewritePartition;byte Alignment[3];' & $tagPARTITION_INFORMATION_MBR Local Const $tagDRIVE_LAYOUT_INFORMATION_MBR = 'ulong Signature;byte GPT[36];' ;~ Local Const $tagDRIVE_LAYOUT_INFORMATION_GPT = 'byte DiskId[16];int64 StartingUsableOffset;int64 UsableLength;ulong MaxPartitionCount;' Local Const $tagDRIVE_LAYOUT_INFORMATION_EX = 'dword PartitionStyle;dword PartitionCount;' & $tagDRIVE_LAYOUT_INFORMATION_MBR & 'byte PartitionEntry[144];' Local Const $tagVERIFY_INFORMATION = 'int64 StartingOffset;dword Length' Local $hFile, $tDG, $tCD, $tDLIEX, $tPIEX, $tVI, $Error, $Extended = 0 Do $Error = 1 $hFile = _WinAPI_CreateFileEx($sDisk, $OPEN_EXISTING, BitOR($GENERIC_READ, $GENERIC_WRITE), BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), $FILE_ATTRIBUTE_NORMAL) If @Error Then ExitLoop EndIf ; IOCTL_DISK_GET_DRIVE_GEOMETRY $Error = 2 $tDG = DllStructCreate($tagDISK_GEOMETRY) If Not _WinAPI_DeviceIoControl($hFile, $IOCTL_DISK_GET_DRIVE_GEOMETRY, 0, 0, DllStructGetPtr($tDG), DllStructGetSize($tDG)) Then ExitLoop EndIf ; IOCTL_DISK_CREATE_DISK $Error = 3 $tCD = DllStructCreate($tagCREATE_DISK) DllStructSetData($tCD, 'PartitionStyle', $PARTITION_STYLE_MBR) DllStructSetData($tCD, 'Signature', 0xA4B57300) If Not _WinAPI_DeviceIoControl($hFile, $IOCTL_DISK_CREATE_DISK, DllStructGetPtr($tCD), DllStructGetSize($tCD)) Then ExitLoop EndIf ; IOCTL_DISK_SET_DRIVE_LAYOUT_EX $Error = 4 $tDLIEX = DllStructCreate($tagDRIVE_LAYOUT_INFORMATION_EX) DllStructSetData($tDLIEX, 'PartitionStyle', $PARTITION_STYLE_MBR) DllStructSetData($tDLIEX, 'PartitionCount', 1) DllStructSetData($tDLIEX, 'Signature', 0xA4B57300) $tPIEX = DllStructCreate($tagPARTITION_INFORMATION_EX, DllStructGetPtr($tDLIEX, 'PartitionEntry')) DllStructSetData($tPIEX, 'PartitionStyle', $PARTITION_STYLE_MBR) DllStructSetData($tPIEX, 'StartingOffset', 0) DllStructSetData($tPIEX, 'PartitionLength', DllStructGetData($tDG, 'Cylinders') * DllStructGetData($tDG, 'TracksPerCylinder') * DllStructGetData($tDG, 'SectorsPerTrack') * DllStructGetData($tDG, 'BytesPerSector')) DllStructSetData($tPIEX, 'PartitionNumber', 1) DllStructSetData($tPIEX, 'RewritePartition', 1) DllStructSetData($tPIEX, 'PartitionType', $PARTITION_IFS) DllStructSetData($tPIEX, 'BootIndicator', 0) DllStructSetData($tPIEX, 'RecognizedPartition', 1) DllStructSetData($tPIEX, 'HiddenSectors', 1) If Not _WinAPI_DeviceIoControl($hFile, $IOCTL_DISK_SET_DRIVE_LAYOUT_EX, DllStructGetPtr($tDLIEX), DllStructGetSize($tDLIEX)) Then ExitLoop EndIf ; IOCTL_DISK_VERIFY $Error = 5 $tVI = DllStructCreate($tagVERIFY_INFORMATION) DllStructSetData($tVI, 'StartingOffset', 0) DllStructSetData($tVI, 'Length', DllStructGetData($tPIEX, 'PartitionLength')) If Not _WinAPI_DeviceIoControl($hFile, $IOCTL_DISK_VERIFY, DllStructGetPtr($tVI), DllStructGetSize($tVI)) Then ExitLoop EndIf ; IOCTL_DISK_UPDATE_PROPERTIES $Error = 6 If Not _WinAPI_DeviceIoControl($hFile, $IOCTL_DISK_UPDATE_PROPERTIES) Then ExitLoop EndIf $Error = 0 Until 1 If $Error Then $Extended = _WinAPI_GetLastError() EndIf If $hFile Then _WinAPI_CloseHandle($hFile) EndIf Return SetError($Error, $Extended, Not $Error) EndFunc ;==>_VHD_Initialize Func _VHD_Open($sPath) Local $tVST, $tGVDI, $sDisk, $Error = True _Log('Path: ' & _WinAPI_PathCompactPathEx($sPath, 50)) Do $tVST = _WinAPI_CreateVirtualStorageType($VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT) $hVHD = _WinAPI_OpenVirtualDisk($sPath, $tVST, 0, $VIRTUAL_DISK_ACCESS_ALL) If @Error Then _Log('Open', @Extended) ExitLoop Else _Log('Open', 0) EndIf _WinAPI_AttachVirtualDisk($hVHD) If @Error Then _Log('Attach', @Extended) ExitLoop Else _Log('Attach', 0) EndIf $Error = False Until 1 If $Error Then If $hVHD Then _WinAPI_DetachVirtualDisk($hVHD) _WinAPI_CloseHandle($hVHD) EndIf $hVHD = 0 Return 0 EndIf $tGVDI = _WinAPI_GetVirtualDiskInformation($hVHD, $GET_VIRTUAL_DISK_INFO_IDENTIFIER) If Not @Error Then _Log('GUID: ' & _WinAPI_StringFromGUID(DllStructGetPtr($tGVDI, 'Identifier'))) EndIf $tGVDI = _WinAPI_GetVirtualDiskInformation($hVHD, $GET_VIRTUAL_DISK_INFO_SIZE) If Not @Error Then _Log('Size: ' & _WinAPI_StrFormatByteSize(DllStructGetData($tGVDI, 'VirtualSize'))) EndIf $sDisk = _WinAPI_GetVirtualDiskPhysicalPath($hVHD) If Not @Error Then _Log('VHD (' & _P2L($sDisk) & ') has been successfully opened and ready for use!') EndIf Return 1 EndFunc ;==>_VHD_Open wakillon, mesale0077, funkey and 3 others 6 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JFX Posted February 2, 2015 Share Posted February 2, 2015 (edited) Hi Yashied, nicely done. somehow your examples missing #include <WinAPIVhd.au3>, if running from scite. But's fine from explorer. You could add support for vhdx, if @OSBuild >= 9200. Edited February 5, 2015 by JFX Link to comment Share on other sites More sharing options...
topten Posted March 30, 2015 Share Posted March 30, 2015 Thank you very much for this great UDF! I tired it and created a virtual disk Open: OK Attach: OK GUID: {XXXXXXXXXXXXXXXXXXXXXXXXX} Size: 128 МБ VHD (.PHYSICALDRIVE1) has been successfully opened and ready for use! What I can't understand, when I am trying to access it from windows explorer it says : Can't access file because it is busy How can I make it accessable? Great thanx in advance! Link to comment Share on other sites More sharing options...
wakillon Posted April 9, 2015 Share Posted April 9, 2015 Thanks Yashield ! I was working on virtdisk.dll when i fall on your great work. But something puzzles me, i'm on Win7 and my virtdisk.dll have only 12 functions : AttachVirtualDisk CompactVirtualDisk CreateVirtualDisk DetachVirtualDisk ExpandVirtualDisk GetStorageDependencyInformation GetVirtualDiskInformation GetVirtualDiskOperationProgress GetVirtualDiskPhysicalPath MergeVirtualDisk OpenVirtualDisk SetVirtualDiskInformation instead of the 20 of your UDF AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 10, 2015 Author Share Posted April 10, 2015 @toptenI think the reason may be some kind of third-party programs such as antivirus or something like that. Always works fine for me.@wakillonLook more carefully at the functions. Some functions (_WinAPI_Create*VirtualDiskParameters*()) is auxiliary and not included in the dll. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wakillon Posted April 10, 2015 Share Posted April 10, 2015 (edited) @wakillon Look more carefully at the functions. Some functions (_WinAPI_Create*VirtualDiskParameters*()) is auxiliary and not included in the dll. AddVirtualDiskParent BreakMirrorVirtualDisk DeleteVirtualDiskMetadata EnumerateVirtualDiskMetadata GetVirtualDiskMetadata MirrorVirtualDisk ResizeVirtualDisk SetVirtualDiskMetadata This 8 functions names are not auxiliary and are not displayed in "Dll Export Viewer" for my virtdisk.dll. Is there different versions of this dll ? Edit1 : Same result with "DllExportFinder" Edit2 : As i'm under windows 7 family premium, may be it's different on Windows 7 Enterprise and Windows 7 Ultimate. Edited April 10, 2015 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 11, 2015 Author Share Posted April 11, 2015 AddVirtualDiskParentBreakMirrorVirtualDiskDeleteVirtualDiskMetadataEnumerateVirtualDiskMetadataGetVirtualDiskMetadataMirrorVirtualDiskResizeVirtualDiskSetVirtualDiskMetadata This 8 functions names are not auxiliary and are not displayed in "Dll Export Viewer" for my virtdisk.dll.These functions require Windows 8 or later.https://msdn.microsoft.com/en-us/library/windows/desktop/dd323699(v=vs.85).aspx My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wakillon Posted April 11, 2015 Share Posted April 11, 2015 These functions require Windows 8 or later. Yes. I have just look for a Win7 Ultimate version and it's same result. Thanks to precise this difference in your first post. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
kaz Posted March 11, 2017 Share Posted March 11, 2017 (edited) Hi, i try to play with this udf. The initialize step should format the virtual drive but it doesn't on my computer (win 7 pro). I tried to change partition type with $PARTITION_FAT_32 but same result. I saw some GPT[x] name but ... The result of initialize is ok but windows ask for formatting, if i accept, windows show an error : he can't format What must i change to obtain a formated drive by script? If i open and close one vhd of mine, it's ok. Edited March 11, 2017 by kaz Link to comment Share on other sites More sharing options...
kaz Posted March 12, 2017 Share Posted March 12, 2017 (edited) after asking google and looking in detail the initialize function i i found something interesting. Then offset must of one partition is most commun 64 KB (with sector size 512-byte sectors ) or a multiple of. So, i modified the line : DllStructSetData($tPIEX, 'StartingOffset', 0) by DllStructSetData($tPIEX, 'StartingOffset', 64 * 2 * DllStructGetData($tDG, 'BytesPerSector')) and the line : DllStructSetData($tVI, 'StartingOffset', 0) by DllStructSetData($tVI, 'StartingOffset', DllStructGetData($tPIEX, 'StartingOffset')) The script create a valide partition now. When it mounted the first time, windows ask for formatting. No error obtain now. i didn't find solution to avoid this external step. Edited March 12, 2017 by kaz Link to comment Share on other sites More sharing options...
juniq Posted May 6, 2019 Share Posted May 6, 2019 (edited) doesnt work! errors over errors. unknown function names and so on. finish a project before you upload it thanks ! Edited May 6, 2019 by JLogan3o13 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 6, 2019 Moderators Share Posted May 6, 2019 @juniq did you happen to notice this thread is more than 4 years old? Perhaps what worked in 2015 doesn't work the same in 2019. If you would like to actually contribute to the thread, rather than a blanket "fix your errors", why don't you point out spots where you are running into issue and what you would do to fix it? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Virgus Posted January 25, 2023 Share Posted January 25, 2023 (edited) Dear all, I know that this thread is several years old but maybe JFX or others have a suggestion for what I'm looking for. To reply to juniq or to others who might want to test this nice UDF: to make it work you just need to add to the scripts the missing Iif function. Func __Iif($fTest, $vTrueVal, $vFalseVal) Return $fTest ? $vTrueVal : $vFalseVal EndFunc ;==>__Iif Once the UDF finds the function it works with latest AutoIt release. Then the only extra fix needed it the one Kaz pointed out in his previous comment. Concerning my issue, I'm trying to get the VHD source path once an OS booted from a VHD via bootmgr. Unfortunately Diskpart is not reliable and I have a batch script which is slow and more a mock-up than a real script. If you're interested you can read the details in this post of reboot.pro. Besides DiskPart method I've been looking for a Windows API to do that without success. I don't know where to look for. Yesterday I just found that UsbDriveInfo.exe from Uwe Sieber has this information when you click on the FileBackedVirtual Bus volumes (see attached picture). I tried to find anything related to "Container" information in WinAPIs but without success. Has anybody here any clue on how to be able to use AutoIt instead of the slow (and unreliable) DiskPart to retreive the original VHD path of a booted virtual volume ? Thanks for any suggestion you might give me, V. Edit: BTW if you're on an x64 OS and you run the 32bit version of UsbDriveInfo the "Container" field will not appear. Edited January 25, 2023 by Virgus Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now