Commit 7b373edb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Implement GetConvertStg().

parent ea196ef0
...@@ -9400,12 +9400,42 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM ( ...@@ -9400,12 +9400,42 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM (
return hRes; return hRes;
} }
enum stream_1ole_flags {
OleStream_LinkedObject = 0x00000001,
OleStream_Convert = 0x00000100
};
/*********************************************************************** /***********************************************************************
* GetConvertStg (OLE32.@) * GetConvertStg (OLE32.@)
*/ */
HRESULT WINAPI GetConvertStg(IStorage *stg) { HRESULT WINAPI GetConvertStg(IStorage *stg)
FIXME("unimplemented stub!\n"); {
return E_FAIL; static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
static const DWORD version_magic = 0x02000001;
DWORD header[2];
IStream *stream;
HRESULT hr;
ULONG len;
TRACE("%p\n", stg);
if (!stg) return E_INVALIDARG;
hr = IStorage_OpenStream(stg, stream_1oleW, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
if (FAILED(hr)) return hr;
len = 0;
hr = IStream_Read(stream, header, sizeof(header), &len);
IStream_Release(stream);
if (FAILED(hr)) return hr;
if (header[0] != version_magic)
{
ERR("got wrong version magic for \1Ole stream, 0x%08x\n", header[0]);
return E_FAIL;
}
return header[1] & OleStream_Convert ? S_OK : S_FALSE;
} }
/****************************************************************************** /******************************************************************************
......
...@@ -2995,6 +2995,34 @@ static void test_hglobal_storage_creation(void) ...@@ -2995,6 +2995,34 @@ static void test_hglobal_storage_creation(void)
ILockBytes_Release(ilb); ILockBytes_Release(ilb);
} }
static void test_convert(void)
{
static const WCHAR filename[] = {'s','t','o','r','a','g','e','.','s','t','g',0};
IStorage *stg;
HRESULT hr;
hr = GetConvertStg(NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
ok(hr == S_OK, "StgCreateDocfile failed\n");
hr = GetConvertStg(stg);
ok(hr == STG_E_FILENOTFOUND, "got 0x%08x\n", hr);
hr = SetConvertStg(stg, TRUE);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetConvertStg(stg);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = SetConvertStg(stg, FALSE);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = GetConvertStg(stg);
ok(hr == S_FALSE, "got 0x%08x\n", hr);
}
IStorage_Release(stg);
DeleteFileW(filename);
}
START_TEST(storage32) START_TEST(storage32)
{ {
CHAR temp[MAX_PATH]; CHAR temp[MAX_PATH];
...@@ -3038,4 +3066,5 @@ START_TEST(storage32) ...@@ -3038,4 +3066,5 @@ START_TEST(storage32)
test_copyto_locking(); test_copyto_locking();
test_copyto_recursive(); test_copyto_recursive();
test_hglobal_storage_creation(); test_hglobal_storage_creation();
test_convert();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment