-
Posts
7,336 -
Joined
-
Last visited
-
Days Won
80
UEZ last won the day on June 17
UEZ had the most liked content!
About UEZ

- Currently Viewing Forums Index
- Birthday 12/03/2007
Profile Information
-
Member Title
Never say never
-
Location
Germany
-
Interests
Computer, watching movies, football (soccer), being lazy :-)
Recent Profile Visitors
UEZ's Achievements
-
Davidyese reacted to a post in a topic: Make active transparent icon on image background
-
argumentum reacted to a post in a topic: Make active transparent icon on image background
-
Make active transparent icon on image background
UEZ replied to Davidyese's topic in AutoIt General Help and Support
Fixed. -
UEZ reacted to a post in a topic: Make active transparent icon on image background
-
Davidyese reacted to a post in a topic: Make active transparent icon on image background
-
pixelsearch reacted to a post in a topic: Make active transparent icon on image background
-
Make active transparent icon on image background
UEZ replied to Davidyese's topic in AutoIt General Help and Support
I have thought again and this is simpler and the better solution. #NoTrayIcon ;#RequireAdmin #include <WinAPISys.au3> #include <GDIPlus.au3> #include <WinAPIShellEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> Example() Func Example() Local $hGUI, $hGraphic, $hIcon, $hBitmap, $iX = 768, $iY = 525 $hGUI = GUICreate("GDI+", $iX, $iY) _GDIPlus_Startup() ; Create GUI Global $idPic = GUICtrlCreatePic("", 0, 0, $iX, $iY) Global $sFileName = @ScriptDir& "\MAIN.png" $hImage = _GDIPlus_ImageLoadFromFile($sFileName) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) $hBGImage = _GDIPlus_BitmapCreateFromScan0($iX, $iY) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBGImage) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) $btnx = 250 $btny = 150 ;_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 221, 48, 48) $hBitmap = _GDIPlus_BitmapCreateFromHICON32($hIcon) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, $btnx, $btny) $shBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBGImage) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, 0x0172, 0, $shBitmap)) ; STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 GUICtrlSetState($idPic, $gui_disable) GUICtrlSetState(-1, $GUI_ONTOP) GUICtrlSetCursor(-1, 0) $hIcon = GUICtrlCreateIcon(@SystemDir & '\shell32.dll', -1, $btnx, $btny, 48, 48, BitOR($SS_NOTIFY, $SS_BLACKRECT)) GUISetState() ; Loop until user exits Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hIcon ConsoleWrite("Icon clicked" & @CRLF) EndSwitch Until False ; Clean up resources _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject($shBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_BitmapDispose($hBGImage) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example -
Davidyese reacted to a post in a topic: Make active transparent icon on image background
-
Make active transparent icon on image background
UEZ replied to Davidyese's topic in AutoIt General Help and Support
You have to exclude the area of the icon off the bitmap (graphic). One example: -
WildByDesign reacted to a post in a topic: Need help converting percentage to hex
-
argumentum reacted to a post in a topic: Need help converting percentage to hex
-
Need help converting percentage to hex
UEZ replied to WildByDesign's topic in AutoIt General Help and Support
I misunderstood the value but it's easy, too: Local $iIntensity = '80' ;% of the alpha channel Local $iTintColor = '0x0078D4' $iIntensity = Int($iIntensity) * 255 / 100 Local $iColor = BitOR(BitShift($iIntensity > 255 ? 255 : $iIntensity < 0 ? 0: $iIntensity, -24), Int($iTintColor)) ConsoleWrite(Hex($iColor, 8) & @CRLF) _WinAPI_DwmEnableBlurBehindWindow10($hGUI, True, $iColor) -
WildByDesign reacted to a post in a topic: Need help converting percentage to hex
-
Need help converting percentage to hex
UEZ replied to WildByDesign's topic in AutoIt General Help and Support
Try: Local $iIntensity = '80' ;hex Local $iTintColor = '0x0078D4' Local $iColor = BitOR(BitShift(Dec($iIntensity), -24), Int($iTintColor)) ConsoleWrite(Hex($iColor, 8) & @CRLF) _WinAPI_DwmEnableBlurBehindWindow10($hGUI, True, $iColor) -
Fast array functions concept [feedback wanted]
UEZ replied to genius257's topic in AutoIt Projects and Collaboration
AutoIt was never really built for speed — it’s an interpreted language, great for scripting and automation, but not exactly a high-performance engine under the hood. So trying to make it handle things like fast array slicing or inserting elements mid-array feels a bit like teaching a car to fly or haul 30 tons. Sure, maybe you could pull it off with enough creativity (and duct tape), but if you want to fly, you take a plane. If you want to haul heavy stuff, get a truck. Same with programming — sometimes it's better to just pick a faster compiled language for the job. That said, I love seeing people push the boundaries of what AutoIt can do. Using FASM, COM, and clever hacks to get more out of it is impressive, and if it helps you learn or build something cool — go for it! Just don’t forget the core strengths of AutoIt: simplicity, ease of use, and rapid development. Sometimes it’s okay to let the car be a car. 😊 -
How can I mount an iso image with autoit?
UEZ replied to Keketoco00's topic in AutoIt General Help and Support
This is more complicated than I thought. I have not found a way to read the path of the mounted ISO file via the WinAPI - only PowerShell: Get-Volume -DriveLetter Z | ForEach-Object { Get-DiskImage -DevicePath ($_.Path -replace '\\$','') } | Select-Object -ExpandProperty ImagePath Maybe WMI is also possible. Example: ;Coded by UEZ Global $sPath2ISO = "<path to your iso file>" MsgBox(0, "Test", $sPath2ISO & " already mounted: " & _IsISOFileMounted($sPath2ISO)) Func RunStdoutPS($sDrv) Local $sCmd = "powershell -NoProfile -Command Get-Volume -DriveLetter " & $sDrv & " | ForEach-Object { Get-DiskImage -DevicePath ($_.Path -replace '\\$','') } | Select-Object -ExpandProperty ImagePath" Local $tPipe = ObjCreate("WScript.Shell").Exec($sCmd) Local $sOutput = "" While Not $tPipe.StdOut.AtEndOfStream $sOutput &= $tPipe.StdOut.ReadLine() Sleep(10) WEnd Return $sOutput EndFunc Func _IsISOFileMounted($sISOPath) Local $aDrives = DriveGetDrive("CDROM"), $sVolumePath, $sDrive, $sResult If @error Then Return False For $i = 1 To $aDrives[0] $sDrive = $aDrives[$i] & "\" $sResult = RunStdoutPS($sDrive) If StringInStr($sResult, $sISOPath) = 1 Then Return 1 Next Return 0 EndFunc -
I created a DLL (x64) to do the job: ;coded by UEZ build 2025-06-12 #AutoIt3Wrapper_UseX64=y #include <Array.au3> Local $a1 = [1, 2, 3, 4, 5, 6, 7, 8] Local $a2 = [4, 5, 7, 12, 23, 28, 44, 56, 57] Local $a3 = [3, 6, 9] Local $a4 = [12, 13, 18, 22, 28, 29, 33, 37, 40, 42, 51, 57] Local $a5 = [2, 15, 47, 56] Local $a6 = [6, 8, 9, 12, 15, 18, 22, 29, 33, 35] Local $a7 = [41, 51, 53, 55, 57, 59] Local $a8 = [12, 21, 31, 41, 47, 55, 56, 57, 58, 59] Local $aAll = [$a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8] Generate($aAll) Func Generate($aArrayOfArrays, $sOutput = @ScriptDir & "\array_output.txt") Local $tagDLL, $i, $j For $i = 0 To UBound($aArrayOfArrays) - 1 $tagDLL &= "ubyte a" & $i & "[" & UBound($aArrayOfArrays[$i]) & "];" Next Local $tArrays = DllStructCreate($tagDLL), $a, $tUBArrays = DllStructCreate("ubyte ub[8]") For $i = 0 To UBound($aArrayOfArrays) - 1 $a = $aArrayOfArrays[$i] For $j = 0 To UBound($a) - 1 DllStructSetData($tArrays, $i + 1, $a[$j], $j + 1) Next $tUBArrays.ub(($i + 1)) = UBound($a) - 1 Next Local $t = TimerInit() Local $iResult = DllCall("DoTheJobForMe.dll", "uint", "GenerateCombinations", "struct*", $tArrays, "ushort", DllStructGetSize($tArrays), "struct*", $tUBArrays, "str", $sOutput)[0] ConsoleWrite(TimerDiff($t) & " ms" & @CRLF) ConsoleWrite("Wrote " & $iResult & " lines to file " & $sOutput & @CRLF) EndFunc DLL: DoTheJobForMe-DLL.7z Put the DLL to script dir. How long does it take? Btw, what is the purpose for all these combinations?
-
I tested it in Freebasic and it took to generate the 6220800 combinations and ignoring duplicates values per line ~72 ms. Non duplicate entries: 3219062 I agree with @Numeric1 to outsource the code to a DLL.
-
How can I mount an iso image with autoit?
UEZ replied to Keketoco00's topic in AutoIt General Help and Support
Yes, it is - homework for you, check out _WinAPI_GetFinalPathNameByHandleEx() function. 🙂 -
How can I mount an iso image with autoit?
UEZ replied to Keketoco00's topic in AutoIt General Help and Support
Here the version to choose the drive letter: ;Coded by UEZ build 2025-06-11 beta #RequireAdmin #include <WinAPIHObj.au3> #include <WinAPIFiles.au3> Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT = '{EC984AEC-A0F9-47E9-901F-71415A66345B}' Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_UNKNOWN = '{00000000-0000-0000-0000-000000000000}' ;VIRTUAL_STORAGE_TYPE -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Enum $VIRTUAL_STORAGE_TYPE_DEVICE_UNKNOWN = 0, $VIRTUAL_STORAGE_TYPE_DEVICE_ISO, $VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_DEVICE_VHDX ;VIRTUAL_DISK_ACCESS_MASK -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-virtual_disk_access_mask-r1 Global Enum $VIRTUAL_DISK_ACCESS_NONE = 0, $VIRTUAL_DISK_ACCESS_ATTACH_RO = 0x00010000, $VIRTUAL_DISK_ACCESS_ATTACH_RW = 0x00020000, $VIRTUAL_DISK_ACCESS_DETACH = 0x00040000, _ $VIRTUAL_DISK_ACCESS_GET_INFO = 0x00080000, $VIRTUAL_DISK_ACCESS_CREATE = 0x00100000, $VIRTUAL_DISK_ACCESS_METAOPS = 0x00200000, $VIRTUAL_DISK_ACCESS_READ = 0x000D0000, _ $VIRTUAL_DISK_ACCESS_ALL = 0x003F0000, $VIRTUAL_DISK_ACCESS_WRITABLE = 0x00320000 ;OPEN_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_flag Global Enum $OPEN_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = 0x00000001, $OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = 0x00000002, $OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = 0x00000004, _ $OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = 0x00000008, $OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = 0x00000010, $OPEN_VIRTUAL_DISK_FLAG_PARENT_CACHED_IO = 0x00000020, $OPEN_VIRTUAL_DISK_FLAG_VHDSET_FILE_ONLY = 0x00000040, _ $OPEN_VIRTUAL_DISK_FLAG_IGNORE_RELATIVE_PARENT_LOCATOR = 0x00000080, $OPEN_VIRTUAL_DISK_FLAG_NO_WRITE_HARDENING = 0x00000100, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_COMPRESSED_VOLUMES, _ $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_SPARSE_FILES_ANY_FS, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILES ;ATTACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_flag Global Enum $ATTACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY = 0x00000001, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER = 0x00000002, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME = 0x00000004, _ $ATTACH_VIRTUAL_DISK_FLAG_NO_LOCAL_HOST = 0x00000008, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR = 0x00000010, $ATTACH_VIRTUAL_DISK_FLAG_BYPASS_DEFAULT_ENCRYPTION_POLICY = 0x00000020, _ $ATTACH_VIRTUAL_DISK_FLAG_NON_PNP, $ATTACH_VIRTUAL_DISK_FLAG_RESTRICTED_RANGE, $ATTACH_VIRTUAL_DISK_FLAG_SINGLE_PARTITION, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME, $ATTACH_VIRTUAL_DISK_FLAG_AT_BOOT ;OPEN_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_version Global Enum $OPEN_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $OPEN_VIRTUAL_DISK_VERSION_1, $OPEN_VIRTUAL_DISK_VERSION_2, $OPEN_VIRTUAL_DISK_VERSION_3 Global Enum $DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000 ;DETACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-detach_virtual_disk_flag Global Const $tagOPEN_VIRTUAL_DISK_PARAMETERS = "dword Version;dword RWDepth" ;"ulong Data1;ushort Data2;ushort Data3;ubyte Data4[8]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Const $tagVIRTUAL_STORAGE_TYPE = "ulong DeviceId;byte VendorId[16]" ;https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-security_descriptor Global Const $tagSECURITY_DESCRIPTOR = "byte Revision;byte Sbz1;ushort Control;ptr Owner;ptr Group;ptr Sacl;ptr Dacl;" ;https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped ;Global Const $tagOVERLAPPED = "ptr Internal;ptr InternalHigh;dword Offset;dword OffsetHigh;ptr hEvent" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-attach_virtual_disk_parameters Global Const $tagATTACH_VIRTUAL_DISK_PARAMETERS = "dword Version;" & _ ; ATTACH_VIRTUAL_DISK_VERSION enum "uint Reserved;" & _ ; Nur bei Version1 "uint64 RestrictedOffset;" & _ ; Nur bei Version2 "uint64 RestrictedLength;" ; Nur bei Version2 ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-openvirtualdisk Func _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, $sPath, $VIRTUAL_DISK_ACCESS_MASK = 0, $OPEN_VIRTUAL_DISK_FLAG = 0, $tOPEN_VIRTUAL_DISK_PARAMETERS = 0) If Not FileExists($sPath) Then SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "OpenVirtualDisk", "struct*", $tVIRTUAL_STORAGE_TYPE, "wstr", $sPath, "ulong", $VIRTUAL_DISK_ACCESS_MASK, "ulong", $OPEN_VIRTUAL_DISK_FLAG, "struct*", $tOPEN_VIRTUAL_DISK_PARAMETERS, "handle*", 0) If @error Then Return SetError(2, 0, 0) Return $aReturn[6] EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-attachvirtualdisk Func _WinAPI_AttachVirtualDisk($hVD, $tSECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG, $ProviderSpecificFlags, $tATTACH_VIRTUAL_DISK_PARAMETERS = Null, $tOVERLAPPED = Null) If Not $hVD Then Return SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "AttachVirtualDisk", "handle", $hVD, "struct*", $tSECURITY_DESCRIPTOR, "ulong", $ATTACH_VIRTUAL_DISK_FLAG, "ulong", $ProviderSpecificFlags, "struct*", $tATTACH_VIRTUAL_DISK_PARAMETERS, "struct*", $tOVERLAPPED) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-detachvirtualdisk Func _WinAPI_DetachVirtualDisk($hVD, $iFlags = $DETACH_VIRTUAL_DISK_FLAG_NONE, $ProviderSpecificFlags = 0) Local $aCall = DllCall("VirtDisk.dll", "dword", "DetachVirtualDisk", "handle", $hVD, "long", $iFlags, "ulong", $ProviderSpecificFlags) If @error Then Return SetError(1, 0, 0) If $aCall[0] <> 0 Then Return SetError(2, $aCall[0], 0) Return 1 EndFunc ;https://learn.microsoft.com/de-de/windows/win32/api/virtdisk/nf-virtdisk-getvirtualdiskphysicalpath Func _WinAPI_GetVirtualDiskPhysicalPath($hVD) If Not $hVD Then Return SetError(1, 0, 0) Local $tPhysicalDrive = DllStructCreate("wchar physicalDrive[260]") Local $aReturn = DllCall("VirtDisk.dll", "dword", "GetVirtualDiskPhysicalPath", "handle", $hVD, "ulong*", DllStructGetSize($tPhysicalDrive), "struct*", $tPhysicalDrive) If @error Then Return SetError(2, 0, 0) Return $tPhysicalDrive.physicalDrive EndFunc Global $sISOFile = FileOpenDialog("Select an ISO file to mount", "", "ISO (*.iso)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then Exit Global $tVIRTUAL_STORAGE_TYPE = DllStructCreate($tagVIRTUAL_STORAGE_TYPE) $tVIRTUAL_STORAGE_TYPE.DeviceId = $VIRTUAL_STORAGE_TYPE_DEVICE_ISO $tVIRTUAL_STORAGE_TYPE.VendorId = Binary("0xEC984AECA0F947E9901F71415A66345B") ;$VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT Global $tOPEN_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagOPEN_VIRTUAL_DISK_PARAMETERS) $tOPEN_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 $tOPEN_VIRTUAL_DISK_PARAMETERS.RWDepth = 0 Global $tATTACH_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagATTACH_VIRTUAL_DISK_PARAMETERS) $tATTACH_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 Global $sDrvLetter = "z:\" Global $hMountISO = _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, _ $sISOFile, _ BitOR($VIRTUAL_DISK_ACCESS_READ, $VIRTUAL_DISK_ACCESS_ATTACH_RO, $VIRTUAL_DISK_ACCESS_GET_INFO), _ $OPEN_VIRTUAL_DISK_FLAG_NONE, _ $tOPEN_VIRTUAL_DISK_PARAMETERS) If Not $hMountISO Then Exit MsgBox($MB_ICONERROR, "ERROR", "Something went wrong opening ISO!") If _WinAPI_AttachVirtualDisk($hMountISO, _ 0, _ BitOR($ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER), _ 0, _ $tATTACH_VIRTUAL_DISK_PARAMETERS) Then Global $sPhysicalDrive = _WinAPI_GetVirtualDiskPhysicalPath($hMountISO) If StringRight($sPhysicalDrive, 1) <> "\" Then $sPhysicalDrive &= "\" Global $sVolumeNameGUID = _WinAPI_GetVolumeNameForVolumeMountPoint($sPhysicalDrive) If StringRight($sVolumeNameGUID, 1) <> "\" Then $sVolumeNameGUID &= "\" _WinAPI_SetVolumeMountPoint($sDrvLetter, $sVolumeNameGUID) MsgBox(0, "TEST ISO Mounting", "ISO mounted to drive letter " & $sDrvLetter & " - checkout Windows Explorer") Else MsgBox($MB_ICONERROR, "ERROR", "Something went wrong attaching ISO!") EndIf If $hMountISO Then _WinAPI_DeleteVolumeMountPoint($sDrvLetter) _WinAPI_DetachVirtualDisk($hMountISO) _WinAPI_CloseHandle($hMountISO) EndIf Check out variable $sDrvLetter -
How can I mount an iso image with autoit?
UEZ replied to Keketoco00's topic in AutoIt General Help and Support
You are welcome. There is a way to choose the drive letter. Maybe tomorrow I can code something. -
How can I mount an iso image with autoit?
UEZ replied to Keketoco00's topic in AutoIt General Help and Support
Try this: ;Coded by UEZ build 2025-06-13 beta ;Mount ISO and let system assign drive letter. Sometimes drive letter is not assigned for unknown reason to me. ^^ #AutoIt3Wrapper_UseX64=y #include <WinAPIHObj.au3> #include <WinAPIFiles.au3> Global Const $MAX_PATH = 260 Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT = '{EC984AEC-A0F9-47E9-901F-71415A66345B}' Global Const $VIRTUAL_STORAGE_TYPE_VENDOR_UNKNOWN = '{00000000-0000-0000-0000-000000000000}' ;VIRTUAL_STORAGE_TYPE -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Enum $VIRTUAL_STORAGE_TYPE_DEVICE_UNKNOWN = 0, $VIRTUAL_STORAGE_TYPE_DEVICE_ISO, $VIRTUAL_STORAGE_TYPE_DEVICE_VHD, $VIRTUAL_STORAGE_TYPE_DEVICE_VHDX ;VIRTUAL_DISK_ACCESS_MASK -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-virtual_disk_access_mask-r1 Global Enum $VIRTUAL_DISK_ACCESS_NONE = 0, $VIRTUAL_DISK_ACCESS_ATTACH_RO = 0x00010000, $VIRTUAL_DISK_ACCESS_ATTACH_RW = 0x00020000, $VIRTUAL_DISK_ACCESS_DETACH = 0x00040000, _ $VIRTUAL_DISK_ACCESS_GET_INFO = 0x00080000, $VIRTUAL_DISK_ACCESS_CREATE = 0x00100000, $VIRTUAL_DISK_ACCESS_METAOPS = 0x00200000, $VIRTUAL_DISK_ACCESS_READ = 0x000D0000, _ $VIRTUAL_DISK_ACCESS_ALL = 0x003F0000, $VIRTUAL_DISK_ACCESS_WRITABLE = 0x00320000 ;OPEN_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_flag Global Enum $OPEN_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = 0x00000001, $OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = 0x00000002, $OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = 0x00000004, _ $OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = 0x00000008, $OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = 0x00000010, $OPEN_VIRTUAL_DISK_FLAG_PARENT_CACHED_IO = 0x00000020, $OPEN_VIRTUAL_DISK_FLAG_VHDSET_FILE_ONLY = 0x00000040, _ $OPEN_VIRTUAL_DISK_FLAG_IGNORE_RELATIVE_PARENT_LOCATOR = 0x00000080, $OPEN_VIRTUAL_DISK_FLAG_NO_WRITE_HARDENING = 0x00000100, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_COMPRESSED_VOLUMES, _ $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_SPARSE_FILES_ANY_FS, $OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILES ;ATTACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_flag Global Enum $ATTACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000, $ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY = 0x00000001, $ATTACH_VIRTUAL_DISK_FLAG_NO_DRIVE_LETTER = 0x00000002, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME = 0x00000004, _ $ATTACH_VIRTUAL_DISK_FLAG_NO_LOCAL_HOST = 0x00000008, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR = 0x00000010, $ATTACH_VIRTUAL_DISK_FLAG_BYPASS_DEFAULT_ENCRYPTION_POLICY = 0x00000020, _ $ATTACH_VIRTUAL_DISK_FLAG_NON_PNP, $ATTACH_VIRTUAL_DISK_FLAG_RESTRICTED_RANGE, $ATTACH_VIRTUAL_DISK_FLAG_SINGLE_PARTITION, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME, $ATTACH_VIRTUAL_DISK_FLAG_AT_BOOT ;OPEN_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-open_virtual_disk_version Global Enum $OPEN_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $OPEN_VIRTUAL_DISK_VERSION_1, $OPEN_VIRTUAL_DISK_VERSION_2, $OPEN_VIRTUAL_DISK_VERSION_3 Global Enum $DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000 ;ATTACH_VIRTUAL_DISK_VERSION -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-attach_virtual_disk_version Global Enum $ATTACH_VIRTUAL_DISK_VERSION_UNSPECIFIED = 0, $ATTACH_VIRTUAL_DISK_VERSION_1 = 1, $ATTACH_VIRTUAL_DISK_VERSION_2 Global Enum $GET_VIRTUAL_DISK_INFO_UNSPECIFIED = 0, $GET_VIRTUAL_DISK_INFO_SIZE, $GET_VIRTUAL_DISK_INFO_IDENTIFIER, $GET_VIRTUAL_DISK_INFO_PARENT_LOCATION, $GET_VIRTUAL_DISK_INFO_PARENT_IDENTIFIER, _ $GET_VIRTUAL_DISK_INFO_PARENT_TIMESTAMP, $GET_VIRTUAL_DISK_INFO_VIRTUAL_STORAGE_TYPE, $GET_VIRTUAL_DISK_INFO_PROVIDER_SUBTYPE, $GET_VIRTUAL_DISK_INFO_IS_4K_ALIGNED, $GET_VIRTUAL_DISK_INFO_PHYSICAL_DISK, _ $GET_VIRTUAL_DISK_INFO_VHD_PHYSICAL_SECTOR_SIZE, $GET_VIRTUAL_DISK_INFO_SMALLEST_SAFE_VIRTUAL_SIZE, $GET_VIRTUAL_DISK_INFO_FRAGMENTATION, $GET_VIRTUAL_DISK_INFO_IS_LOADED, _ $GET_VIRTUAL_DISK_INFO_VIRTUAL_DISK_ID, $GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE ;DETACH_VIRTUAL_DISK_FLAG -> https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-detach_virtual_disk_flag Global Const $tagOPEN_VIRTUAL_DISK_PARAMETERS = "dword Version;dword RWDepth" ;"ulong Data1;ushort Data2;ushort Data3;ubyte Data4[8]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-virtual_storage_type Global Const $tagVIRTUAL_STORAGE_TYPE = "ulong DeviceId;byte VendorId[16]" ;https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-security_descriptor Global Const $tagSECURITY_DESCRIPTOR = "byte Revision;byte Sbz1;ushort Control;ptr Owner;ptr Group;ptr Sacl;ptr Dacl;" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ns-virtdisk-attach_virtual_disk_parameters Global Const $tagATTACH_VIRTUAL_DISK_PARAMETERS = "dword Version;" & _ ; ATTACH_VIRTUAL_DISK_VERSION enum "ulong Reserved;" & _ ; Nur bei Version1 "uint64 RestrictedOffset;" & _ ; Nur bei Version2 "uint64 RestrictedLength;" ; Nur bei Version2 Global Const $tagGET_VIRTUAL_DISK_INFO_SIZE = "dword Version;" & _ "uint64 VirtualSize;" & _ "uint64 PhysicalSize;" & _ "dword BlockSize;" & _ "dword SectorSize;" Global Const $tagGET_VIRTUAL_DISK_INFO_IDENTIFIER = "dword Version;byte Identifier[16];" ; GUID = 16 Bytes Global Const $tagGET_VIRTUAL_DISK_INFO_PARENT_LOCATION = "dword Version;bool ParentResolved;wchar ParentLocationBuffer[" & $MAX_PATH & "]" ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-openvirtualdisk Func _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, $sPath, $VIRTUAL_DISK_ACCESS_MASK = 0, $OPEN_VIRTUAL_DISK_FLAG = 0, $tOPEN_VIRTUAL_DISK_PARAMETERS = 0) If Not FileExists($sPath) Then SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "OpenVirtualDisk", "struct*", $tVIRTUAL_STORAGE_TYPE, "wstr", $sPath, "ulong", $VIRTUAL_DISK_ACCESS_MASK, "ulong", $OPEN_VIRTUAL_DISK_FLAG, "struct*", $tOPEN_VIRTUAL_DISK_PARAMETERS, "handle*", 0) If @error Then Return SetError(2, 0, 0) Return $aReturn[6] EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-attachvirtualdisk Func _WinAPI_AttachVirtualDisk($hVD, $tSECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG, $ProviderSpecificFlags, $tATTACH_VIRTUAL_DISK_PARAMETERS = Null, $tOVERLAPPED = Null) If Not $hVD Then Return SetError(1, 0, 0) Local $aReturn = DllCall("VirtDisk.dll", "dword", "AttachVirtualDisk", "handle", $hVD, "struct*", $tSECURITY_DESCRIPTOR, "ulong", $ATTACH_VIRTUAL_DISK_FLAG, "ulong", $ProviderSpecificFlags, "struct*", $tATTACH_VIRTUAL_DISK_PARAMETERS, "struct*", $tOVERLAPPED) If @error Then Return SetError(2, 0, 0) Return 1 EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/nf-virtdisk-detachvirtualdisk Func _WinAPI_DetachVirtualDisk($hVD, $iFlags = $DETACH_VIRTUAL_DISK_FLAG_NONE, $ProviderSpecificFlags = 0) Local $aCall = DllCall("VirtDisk.dll", "dword", "DetachVirtualDisk", "handle", $hVD, "long", $iFlags, "ulong", $ProviderSpecificFlags) If @error Then Return SetError(1, 0, 0) If $aCall[0] <> 0 Then Return SetError(2, $aCall[0], 0) Return 1 EndFunc ;https://learn.microsoft.com/de-de/windows/win32/api/virtdisk/nf-virtdisk-getvirtualdiskphysicalpath Func _WinAPI_GetVirtualDiskPhysicalPath($hVD) If Not $hVD Then Return SetError(1, 0, 0) Local $tPhysicalDrive = DllStructCreate("wchar physicalDrive[" & $MAX_PATH & "]") Local $aReturn = DllCall("VirtDisk.dll", "dword", "GetVirtualDiskPhysicalPath", "handle", $hVD, "ulong*", DllStructGetSize($tPhysicalDrive), "struct*", $tPhysicalDrive) If @error Then Return SetError(2, 0, 0) Return $tPhysicalDrive.physicalDrive EndFunc ;https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumepathnamesforvolumenamew Func _WinAPI_GetMountPointFromVolumeGUID($sGUID) Local $tBuffer = DllStructCreate("wchar path[" & $MAX_PATH & "]") Local $aRet = DllCall("kernel32.dll", "bool", "GetVolumePathNamesForVolumeNameW", "wstr", $sGUID, "struct*", $tBuffer, "dword", $MAX_PATH, "dword*", 0) If @error Or Not $aRet[0] Then Return SetError(1, 0, "") Return $tBuffer.path EndFunc Global $sISOFile = FileOpenDialog("Select an ISO file to mount", "", "ISO (*.iso)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then Exit Global $tVIRTUAL_STORAGE_TYPE = DllStructCreate($tagVIRTUAL_STORAGE_TYPE) $tVIRTUAL_STORAGE_TYPE.DeviceId = $VIRTUAL_STORAGE_TYPE_DEVICE_ISO $tVIRTUAL_STORAGE_TYPE.VendorId = Binary("0xEC984AECA0F947E9901F71415A66345B") ;$VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT Global $tOPEN_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagOPEN_VIRTUAL_DISK_PARAMETERS) $tOPEN_VIRTUAL_DISK_PARAMETERS.Version = $OPEN_VIRTUAL_DISK_VERSION_1 $tOPEN_VIRTUAL_DISK_PARAMETERS.RWDepth = 0 Global $tATTACH_VIRTUAL_DISK_PARAMETERS = DllStructCreate($tagATTACH_VIRTUAL_DISK_PARAMETERS) $tATTACH_VIRTUAL_DISK_PARAMETERS.Version = $ATTACH_VIRTUAL_DISK_VERSION_1 Global $hMountISO = _WinAPI_OpenVirtualDisk($tVIRTUAL_STORAGE_TYPE, _ $sISOFile, _ BitOR($VIRTUAL_DISK_ACCESS_READ, $VIRTUAL_DISK_ACCESS_ATTACH_RO), _ $OPEN_VIRTUAL_DISK_FLAG_NONE, _ $tOPEN_VIRTUAL_DISK_PARAMETERS) If Not $hMountISO Then Exit MsgBox($MB_ICONERROR, "ERROR", "Something went wrong opening ISO!") If _WinAPI_AttachVirtualDisk($hMountISO, _ 0, _ BitOR($ATTACH_VIRTUAL_DISK_FLAG_READ_ONLY, $ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, $ATTACH_VIRTUAL_DISK_FLAG_NO_SECURITY_DESCRIPTOR, $ATTACH_VIRTUAL_DISK_FLAG_REGISTER_VOLUME), _ 0, _ 0) Then Global $sPhysicalDrive = _WinAPI_GetVirtualDiskPhysicalPath($hMountISO) If StringRight($sPhysicalDrive, 1) <> "\" Then $sPhysicalDrive &= "\" Global $sVolumeNameGUID = _WinAPI_GetVolumeNameForVolumeMountPoint($sPhysicalDrive) If StringRight($sVolumeNameGUID, 1) <> "\" Then $sVolumeNameGUID &= "\" Global $sDrvLetter = _WinAPI_GetMountPointFromVolumeGUID($sVolumeNameGUID) MsgBox(0, "TEST ISO Mounting", "ISO mounted " & ($sDrvLetter = "" ? "but no drive letter was assigned!" : "to " & $sDrvLetter)) Else MsgBox($MB_ICONERROR, "ERROR", "Something went wrong attaching ISO!") EndIf If $hMountISO Then _WinAPI_DetachVirtualDisk($hMountISO) _WinAPI_CloseHandle($hMountISO) EndIf For some unknown reason to me, sometimes drive letter is not automatically assigned by the system although ISO is mounted. Can be checked by opening "Disk Management" -> diskmgmt.msc -
Update to: WebP v0.3.3 build 2025-06-04 beta Updated WebP x64 dll to latest version Added decoding code for animated WebP files for boths DLLs -> see Example6 and Example7 See first post for download link.