Commit 2cd2628c authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ole32: Make sure StgIsStorageILockBytes tests real data.

parent 30d18c11
......@@ -7846,15 +7846,16 @@ HRESULT WINAPI StgSetTimes(OLECHAR const *str, FILETIME const *pctime,
*/
HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt)
{
BYTE sig[8];
BYTE sig[sizeof(STORAGE_magic)];
ULARGE_INTEGER offset;
ULONG read = 0;
offset.u.HighPart = 0;
offset.u.LowPart = 0;
ILockBytes_ReadAt(plkbyt, offset, sig, sizeof(sig), NULL);
ILockBytes_ReadAt(plkbyt, offset, sig, sizeof(sig), &read);
if (memcmp(sig, STORAGE_magic, sizeof(STORAGE_magic)) == 0)
if (read == sizeof(sig) && memcmp(sig, STORAGE_magic, sizeof(sig)) == 0)
return S_OK;
return S_FALSE;
......
......@@ -66,6 +66,9 @@ static void test_hglobal_storage_stat(void)
r = CreateILockBytesOnHGlobal( NULL, TRUE, &ilb );
ok( r == S_OK, "CreateILockBytesOnHGlobal failed\n");
r = StgIsStorageILockBytes( ilb );
ok( r == S_FALSE, "StgIsStorageILockBytes should have failed\n");
mode = STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE;/*0x1012*/
r = StgCreateDocfileOnILockBytes( ilb, mode, 0, &stg );
ok( r == S_OK, "StgCreateDocfileOnILockBytes failed\n");
......@@ -73,6 +76,9 @@ static void test_hglobal_storage_stat(void)
r = WriteClassStg( stg, &test_stg_cls );
ok( r == S_OK, "WriteClassStg failed\n");
r = StgIsStorageILockBytes( ilb );
ok( r == S_OK, "StgIsStorageILockBytes failed\n");
memset( &stat, 0, sizeof stat );
r = IStorage_Stat( stg, &stat, 0 );
......
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