Sorry, i have a problem with istorage too. (note: my nickname not joke!)
Have 1-lv compound-file (only streams). Can not read streams. Trying:
#include <Array.au3>
Global $cUsrFile1c = "D:\my.md"
If StringLeft(_ArrayToString(DllCall("Ole32.dll", 'int', 'StgIsStorageFile', 'wstr', $cUsrFile1c), "#"),2) <> "0#" Then
MsgBox(16, '<Error!>', $cUsrFile1c & " == if NOT iStorage-file !");
Exit -1
EndIf
MsgBox(64, '<Ok>', $cUsrFile1c & " is iStorage-file ...");
Local $cMsg=""
Local $tStgOpened = DllStructCreate("int")
Local $pStgOpened = DllStructGetPtr($tStgOpened)
Global $aStgOpened = DllCall("Ole32.dll", "int", "StgOpenStorage", _
'wstr', $cUsrFile1c, _
'ptr', 0, _
'dword', BitOR(0x00400000, 0, 0x00000040), _ ; = STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE
'ptr', 0, _
'dword', 0, _
'ptr', $pStgOpened )
$cMsg = "IStorage interface pointer (" & VarGetType ($pStgOpened) & ") = " & $pStgOpened
If IsArray($aStgOpened) Then
$cMsg &= @CRLF & "Return Array = " & UBound($aStgOpened)
If UBound($aStgOpened) = 0 Then
MsgBox (16, "debug: <StgOpenStorage ERROR>", $cMsg)
Exit -1
EndIf
Else
$cMsg &= @CRLF & "(ERROR) Return(" & VarGetType($aStgOpened) & ") = " & $aStgOpened
MsgBox (16, "debug: <StgOpenStorage>", $cMsg ) ;******* HERE!
Exit -1
EndIf
MsgBox (64, "debug: <StgOpenStorage>", $cMsg & " " & $aStgOpened[0])
_ArrayDisplay( $aStgOpened, 'debug: <StgOpenStorage>')
$cMsg = ""
Local $cStreamName = "Container.Contents" & ChrW(0x0000)
Local $tStreamOpened = DllStructCreate("int")
Local $pStreamOpened = DllStructGetPtr($tStreamOpened)
Global $aStreamOpened = DllCall("Ole32.dll", 'int', 'OpenStream', _
'wchar', $cStreamName, _
'void', 0, _
'dword', BitOR(0x00400000, 0, 0x00000040), _ ; = STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE
'dword', 0, _
"ptr", $pStreamOpened )
$cMsg = "ISream interface pointer (" & VarGetType($pStreamOpened) & ") = " & $pStreamOpened
If IsArray($aStreamOpened) Then
$cMsg &= @CRLF & "Return Array = " & UBound($aStreamOpened) & " / " & $aStreamOpened[0]
MsgBox (64, "debug: <OpenStream>", $cMsg)
_ArrayDisplay( $aStreamOpened, '<OpenStream>')
Else
$cMsg &= @CRLF & "(ERROR) Return(" & VarGetType($aStreamOpened) & ") = " & $aStreamOpened
MsgBox (16, "debug: <OpenStream>", $cMsg )
Exit -2
EndIf
;******* HERE! == "... (ERROR) Return(Int32) = 0