Function Reference


_SHCreateStreamOnFileEx

Creates an IStream object from a file using SHCreateStreamOnFileEx.

_SHCreateStreamOnFileEx($sFile[, $grfMode[, $dwAttributes[, $fCreate]]])

Parameters

$sFile Path to the file.
$grfMode [optional] STGM flags (default: $STGM_READWRITE $STGM_SHARE_DENY_WRITE | $STGM_CREATE).
$dwAttributes [optional] File attributes for new files (default: FILE_ATTRIBUTE_NORMAL).
$fCreate [optional] If True, creates or overwrites the file (default: True).

Return Value

Success: IStream COM object.
Failure: 0, sets @error to:
1 - File does not exist and $fCreate is False.
2 - Invalid file path.
3 - DllCall failed (HRESULT in @extended).
4 - Failed to create COM object.

Remarks

Caller must release the returned object using _StreamRelease. The file is opened or created with the specified mode and attributes.

Related

_StreamCreateFromDataOnHGlobal, _StreamRelease