Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with extracting file summary information
    primarykey
    data
    text
    <p>I apologize for my English, it's not good, but I hope you will understand my question. I have problem with usage of WinAPI function <code>StgOpenStorageEx</code>. I need to get file's summary information. I found some solutions, but in all of them I need to use <code>StgOpenStorageEx</code>. Because it is not in standard modules, I declared it myself as exported from ole32.dll like this</p> <pre><code>function StgOpenStorageEx ( const pwcsName : POleStr; //Pointer to the path of the //file containing storage object grfMode : LongInt; //Specifies the access mode for the object stgfmt : DWORD; //Specifies the storage file format grfAttrs : DWORD; //Reserved; must be zero pStgOptions : Pointer; //Address of STGOPTIONS pointer reserved2 : Pointer; //Reserved; must be zero riid : PGUID; //Specifies the GUID of the interface pointer out stgOpen : //Address of an interface pointer IStorage ) : HResult; stdcall; external 'ole32.dll'; </code></pre> <p>Next I need to use this function like this</p> <pre><code> var res, open: hresult; stg: IStorage; PropSetStg: IPropertySetStorage; PropStg: IPropertyStorage; FileName: string; const IID_IPropertySetStorage : TGUID = '{0000013A-0000-0000-C000-000000000046}'; FmtID_SummaryInformation: TGUID = '{F29F85E0-4FF9-1068-AB91-08002B27B3D9}'; function StgOpenStorageEx ( const pwcsName : POleStr; //Pointer to the path of the //file containing storage object grfMode : LongInt; //Specifies the access mode for the object stgfmt : DWORD; //Specifies the storage file format grfAttrs : DWORD; //Reserved; must be zero pStgOptions : Pointer; //Address of STGOPTIONS pointer reserved2 : Pointer; //Reserved; must be zero riid : PGUID; //Specifies the GUID of the interface pointer out stgOpen : //Address of an interface pointer IStorage ) : HResult; stdcall; external 'ole32.dll'; ... implementation ... FileName:=OpenDialog1.FileName; res:=StgOpenStorageEx(PWideChar(FileName), STGM_READ or STGM_SHARE_DENY_WRITE, STGFMT_FILE, 0, nil, nil, @IID_IPropertySetStorage, stg); OleCheck(res); PropSetStg := Stg as IPropertySetStorage; open:=PropSetStg.Open(FmtID_SummaryInformation, STGFMT_FILE or STGM_READ or STGM_SHARE_EXCLUSIVE, PropStg); //open=-2147287038 OleCheck(open); // EOleSysError "%1 could not be found ... </code></pre> <p>On instruction <code>OLECheck(Open)</code> I have an EOleSysError "%1 could not be found". <code>Open</code> returns -2147287038 </p> <p>Please tell me what I'm doing wrong <a href="http://www.tek-tips.com/viewthread.cfm?qid=992447" rel="nofollow">Article with full function code</a></p> <p>IDE: Embarcadero® Delphi® XE Version 15.0.3890.34076 </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload