Hi,
Have been using this UDF, and added another function to it for the people to use: _WIM_GetMountedImageInfo
; #FUNCTION# ====================================================================================================================
; Name...........: _WIM_GetMountedImageInfo
; Description ...: Returns list of mounted images
; Syntax.........: _WIM_GetMountedImageInfo()
; Parameters ....:
; Return values .: Success - Returns Array where [0][0] holds number of mounted images, each subsequent row holds information to each image
; Failure - Returns 0 and Sets @Error:
; |0 - No DLLCall error.
; |1 - Unable to use the DLL file
; |2 - Unknown "return type"
; |3 - "function" not found in the DLL file
; |4 - Bad number of parameters.
; Both - Sets @Extended to _WinAPI_GetLastError()
; Author(s) .....: Herman van Drie (hvandrie)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ===============================================================================================================================
Func _WIM_GetMountedImageInfo()
Local $aReturn[2][4]
Local $pWimMountList = DllStructCreate($tagWIM_MOUNT_LIST)
Local $pWimMountInfoLevel1 = DllStructCreate($tagWIM_MOUNT_INFO_LEVEL1)
Local $pWimMountImageCount = DllStructCreate("dword pdwImageCount;")
Local $pWimMountListSize = DllStructCreate("dword pcbReturnLength;")
Local $aResult
$aResult = DllCall($ghwimgapi, "bool", "WIMGetMountedImageInfo", _
"int", 1, _
"ptr", DllStructGetPtr($pWimMountImageCount), _
"ptr", DllStructGetPtr($pWimMountList), _
"dword", DllStructGetSize($pWimMountList), _
"ptr", DllStructGetPtr($pWimMountListSize))
If _WinAPI_GetLastError() = 122 Then ; ERROR_INSUFFICIENT_BUFFER 122 (0x7A) : The data area passed to a system call is too small.
; Calculate required buffer / array size
Local $iRequiredBufferSizeFactor = Int(DllStructGetData($pWimMountListSize, "pcbReturnLength"))/int(DllStructGetSize($pWimMountList))
Local $tWimMountList
ReDim $aReturn[UBound($aReturn,1)+$iRequiredBufferSizeFactor][4]
For $i = 1 To $iRequiredBufferSizeFactor
$tWimMountList &= $tagWIM_MOUNT_LIST & "; "
Next
$pWimMountList = DllStructCreate($tWimMountList)
; Retry the call
$aResult = DllCall($ghwimgapi, "bool", "WIMGetMountedImageInfo", _
"int", 1, _
"ptr", DllStructGetPtr($pWimMountImageCount), _
"ptr", DllStructGetPtr($pWimMountList), _
"dword", DllStructGetSize($pWimMountList), _
"ptr", DllStructGetPtr($pWimMountListSize))
EndIf
$aReturn[0][0]= DllStructGetData($pWimMountImageCount,"pdwImageCount") ; number of mounted images
For $i = 0 To $aReturn[0][0] - 1
$aReturn[$i+1][0] = DllStructGetData($pWimMountList, 4*$i+1 ) ; "WimPath"
$aReturn[$i+1][1] = DllStructGetData($pWimMountList, 4*$i+2 ) ; "MountPath"
$aReturn[$i+1][2] = DllStructGetData($pWimMountList, 4*$i+3 ) ; "ImageIndex")
$aReturn[$i+1][3] = DllStructGetData($pWimMountList, 4*$i+4 ) ; "MountedForRW")
Next
Return SetError(@error, _WinAPI_GetLastError(), $aReturn)
EndFunc
;==>_WIM_GetMountedImageInfo
Have fun with it!