ole32: Make sure StgIsStorageILockBytes tests real data.

This commit is contained in:
Bruno Jesus 2012-04-15 05:07:11 -03:00 committed by Alexandre Julliard
parent 30d18c1165
commit 2cd2628c7b
2 changed files with 10 additions and 3 deletions

View File

@ -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;

View File

@ -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 );