Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/tests/defaulthandler.c | 5 +- dlls/ole32/tests/ole2.c | 33 ++-- dlls/ole32/tests/ole_server.c | 6 +- dlls/ole32/tests/propvariant.c | 8 +- dlls/ole32/tests/stg_prop.c | 8 +- dlls/ole32/tests/storage32.c | 258 ++++++++++++++---------------- dlls/ole32/tests/usrmarshal.c | 4 +- 7 files changed, 139 insertions(+), 183 deletions(-)
diff --git a/dlls/ole32/tests/defaulthandler.c b/dlls/ole32/tests/defaulthandler.c index 60bc29c08dd..3853a271d75 100644 --- a/dlls/ole32/tests/defaulthandler.c +++ b/dlls/ole32/tests/defaulthandler.c @@ -96,14 +96,13 @@ static void test_olestream(void) IPersistStorage *persist; IStorage *stg; IStream *stm; - static const WCHAR olestream[] = {1,'O','l','e',0}; ULONG read; ole_stream_header_t header;
hr = create_storage(&stg); ok(hr == S_OK, "got %08x\n", hr);
- hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); + hr = IStorage_OpenStream(stg, L"\1Ole", NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); ok(hr == STG_E_FILENOTFOUND, "got %08x\n", hr);
hr = OleCreateDefaultHandler(&non_existent_class, 0, &IID_IOleObject, (void**)&ole_obj); @@ -115,7 +114,7 @@ static void test_olestream(void) hr = IPersistStorage_InitNew(persist, stg); ok(hr == S_OK, "got %08x\n", hr);
- hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); + hr = IStorage_OpenStream(stg, L"\1Ole", NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); ok(hr == S_OK, "got %08x\n", hr); hr = IStream_Read(stm, &header, sizeof(header), &read); ok(hr == S_OK, "got %08x\n", hr); diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index cd7eb839233..20aa3dac0c2 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -1149,7 +1149,6 @@ static void test_OleLoad(IStorage *pStorage)
for (fmt = CF_TEXT; fmt < CF_MAX; fmt++) { - static const WCHAR olrepres[] = { 2,'O','l','e','P','r','e','s','0','0','0',0 }; IStorage *stg; IStream *stream; IUnknown *obj; @@ -1168,7 +1167,7 @@ static void test_OleLoad(IStorage *pStorage) hr = IStorage_SetClass(stg, &CLSID_WineTest); ok(hr == S_OK, "SetClass error %#x\n", hr);
- hr = IStorage_CreateStream(stg, olrepres, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stream); + hr = IStorage_CreateStream(stg, L"\2OlePres000", STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stream); ok(hr == S_OK, "CreateStream error %#x\n", hr);
data = ~0; @@ -1580,7 +1579,6 @@ static void test_data_cache(void) CLSID clsid; char szSystemDir[MAX_PATH]; WCHAR wszPath[MAX_PATH]; - static const WCHAR wszShell32[] = {'\','s','h','e','l','l','3','2','.','d','l','l',0};
static const struct expected_method methods_cacheinitnew[] = { @@ -1748,7 +1746,7 @@ static void test_data_cache(void) ok_ole_success(hr, "IOleCache_Cache");
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, ARRAY_SIZE(wszPath)); - memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32)); + lstrcatW(wszPath, L"\shell32.dll");
fmtetc.cfFormat = CF_METAFILEPICT; stgmedium.tymed = TYMED_MFPICT; @@ -1948,8 +1946,6 @@ static void test_data_cache(void) IStorage_Release(pStorage); }
-static const WCHAR CONTENTS[] = {'C','O','N','T','E','N','T','S',0}; - /* 2 x 1 x 32 bpp dib. PelsPerMeter = 200x400 */ static BYTE file_dib[] = { @@ -1974,7 +1970,7 @@ static IStorage *create_storage( int num ) ok( hr == S_OK, "got %08x\n", hr); hr = IStorage_SetClass( stg, &CLSID_Picture_Dib ); ok( hr == S_OK, "got %08x\n", hr); - hr = IStorage_CreateStream( stg, CONTENTS, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stm ); + hr = IStorage_CreateStream( stg, L"CONTENTS", STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stm ); ok( hr == S_OK, "got %08x\n", hr); if (num == 1) /* Set biXPelsPerMeter = 0 */ { @@ -2829,9 +2825,6 @@ static void test_default_handler(void) IOleInPlaceObject *pInPlaceObj; IEnumOLEVERB *pEnumVerbs; DWORD dwRegister; - static const WCHAR wszUnknown[] = {'U','n','k','n','o','w','n',0}; - static const WCHAR wszHostName[] = {'W','i','n','e',' ','T','e','s','t',' ','P','r','o','g','r','a','m',0}; - static const WCHAR wszDelim[] = {'!',0};
static const struct expected_method methods_embeddinghelper[] = { @@ -2883,7 +2876,7 @@ static void test_default_handler(void) hr = IOleObject_GetUserType(pObject, USERCLASSTYPE_FULL, &pszUserType); todo_wine { ok_ole_success(hr, "IOleObject_GetUserType"); - ok(!lstrcmpW(pszUserType, wszUnknown), "Retrieved user type was wrong\n"); + ok(!lstrcmpW(pszUserType, L"Unknown"), "Retrieved user type was wrong\n"); }
hr = IOleObject_InitFromData(pObject, NULL, TRUE, 0); @@ -2902,10 +2895,10 @@ static void test_default_handler(void) hr = IOleObject_SetExtent(pObject, DVASPECT_CONTENT, &sizel); ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetExtent should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
- hr = IOleObject_SetHostNames(pObject, wszHostName, NULL); + hr = IOleObject_SetHostNames(pObject, L"Wine Test Program", NULL); ok_ole_success(hr, "IOleObject_SetHostNames");
- hr = CreateItemMoniker(wszDelim, wszHostName, &pMoniker); + hr = CreateItemMoniker(L"!", L"Wine Test Program", &pMoniker); ok_ole_success(hr, "CreateItemMoniker"); hr = IOleObject_SetMoniker(pObject, OLEWHICHMK_CONTAINER, pMoniker); ok_ole_success(hr, "IOleObject_SetMoniker"); @@ -3162,8 +3155,7 @@ static void test_OleDraw(void) ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); }
-static const WCHAR olepres0W[] = {2,'O','l','e','P','r','e','s','0','0','0',0}; -static const WCHAR comp_objW[] = {1,'C','o','m','p','O','b','j',0}; +static const WCHAR olepres0W[] = L"\2OlePres000"; static IStream *comp_obj_stream; static IStream *ole_stream; static IStream *olepres_stream; @@ -3193,7 +3185,7 @@ static HRESULT WINAPI Storage_CreateStream(IStorage *iface, LPCOLESTR pwcsName, LARGE_INTEGER pos = {{0}}; HRESULT hr;
- if (!lstrcmpW(pwcsName, comp_objW)) + if (!lstrcmpW(pwcsName, L"\1CompObj")) { CHECK_EXPECT(Storage_CreateStream_CompObj); *ppstm = comp_obj_stream; @@ -3242,7 +3234,8 @@ static HRESULT WINAPI Storage_OpenStream(IStorage *iface, LPCOLESTR pwcsName, vo ok(!reserved2, "reserved2 = %x\n", reserved2); ok(!!ppstm, "ppstm = NULL\n");
- if(!lstrcmpW(pwcsName, comp_objW)) { + if (!lstrcmpW(pwcsName, L"\1CompObj")) + { CHECK_EXPECT2(Storage_OpenStream_CompObj); ok(grfMode == STGM_SHARE_EXCLUSIVE, "grfMode = %x\n", grfMode);
@@ -3409,7 +3402,6 @@ static IStorage Storage = { &StorageVtbl };
static void test_OleDoAutoConvert(void) { - static const WCHAR clsidW[] = {'C','L','S','I','D','\',0}; static struct { DWORD reserved1; DWORD version; @@ -3471,7 +3463,7 @@ static void test_OleDoAutoConvert(void) CHECK_CALLED(Storage_Stat); ok(IsEqualIID(&clsid, &CLSID_WineTestOld), "clsid = %s\n", wine_dbgstr_guid(&clsid));
- lstrcpyW(buf, clsidW); + lstrcpyW(buf, L"CLSID\"); StringFromGUID2(&CLSID_WineTestOld, buf+6, 39);
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0, @@ -3599,7 +3591,6 @@ static const unsigned char mf_blank_bits[] =
static void test_data_cache_save(void) { - static const WCHAR contentsW[] = { 'C','o','n','t','e','n','t','s',0 }; HRESULT hr; ILockBytes *ilb; IStorage *doc; @@ -3619,7 +3610,7 @@ static void test_data_cache_save(void) hr = IStorage_SetClass(doc, &CLSID_WineTest); ok(hr == S_OK, "unexpected %#x\n", hr);
- hr = IStorage_CreateStream(doc, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + hr = IStorage_CreateStream(doc, L"Contents", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(hr == S_OK, "unexpected %#x\n", hr); hr = IStream_Write(stm, bmpimage, sizeof(bmpimage), NULL); ok(hr == S_OK, "unexpected %#x\n", hr); diff --git a/dlls/ole32/tests/ole_server.c b/dlls/ole32/tests/ole_server.c index b0bf01d96e8..d3633697c97 100644 --- a/dlls/ole32/tests/ole_server.c +++ b/dlls/ole32/tests/ole_server.c @@ -286,7 +286,6 @@ static void ole_server(void) /******************************* OLE client *******************************/ static BOOL register_server(const char *server, BOOL inproc_handler) { - static const WCHAR clsidW[] = {'C','L','S','I','D','\',0}; DWORD ret; HKEY root; WCHAR buf[39 + 6]; @@ -295,7 +294,7 @@ static BOOL register_server(const char *server, BOOL inproc_handler) lstrcpyA(server_path, server); lstrcatA(server_path, " ole_server");
- lstrcpyW(buf, clsidW); + lstrcpyW(buf, L"CLSID\"); StringFromGUID2(&CLSID_WineTestObject, buf + 6, 39);
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0, @@ -319,12 +318,11 @@ static BOOL register_server(const char *server, BOOL inproc_handler)
static void unregister_server(void) { - static const WCHAR clsidW[] = {'C','L','S','I','D','\',0}; DWORD ret; HKEY root; WCHAR buf[39 + 6];
- lstrcpyW(buf, clsidW); + lstrcpyW(buf, L"CLSID\"); StringFromGUID2(&CLSID_WineTestObject, buf + 6, 39);
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0, diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index 2b7e6d72851..f9913607bf7 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -538,7 +538,6 @@ static void test_propertytovariant(void) PMemoryAllocator allocator; struct _PMemoryAllocator_vtable vtable; BOOLEAN ret; - static const WCHAR test_string[] = {'t','e','s','t',0};
hole32 = GetModuleHandleA("ole32");
@@ -577,7 +576,7 @@ static void test_propertytovariant(void)
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret); ok(propvar.vt == VT_BSTR, "unexpected vt %x\n", propvar.vt); - ok(!lstrcmpW(U(propvar).bstrVal, test_string), "unexpected string value\n"); + ok(!lstrcmpW(U(propvar).bstrVal, L"test"), "unexpected string value\n"); PropVariantClear(&propvar);
ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_bstr_mb, @@ -585,7 +584,7 @@ static void test_propertytovariant(void)
ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret); ok(propvar.vt == VT_BSTR, "unexpected vt %x\n", propvar.vt); - ok(!lstrcmpW(U(propvar).bstrVal, test_string), "unexpected string value\n"); + ok(!lstrcmpW(U(propvar).bstrVal, L"test"), "unexpected string value\n"); PropVariantClear(&propvar); }
@@ -597,7 +596,6 @@ static void test_varianttoproperty(void) SERIALIZEDPROPERTYVALUE* (__stdcall *pStgConvertVariantToProperty)( const PROPVARIANT*,USHORT,SERIALIZEDPROPERTYVALUE*,ULONG*,PROPID,BOOLEAN,ULONG*); ULONG len; - static const WCHAR test_string[] = {'t','e','s','t',0}; BSTR test_string_bstr;
hole32 = GetModuleHandleA("ole32"); @@ -658,7 +656,7 @@ static void test_varianttoproperty(void) ok(len == 4, "unexpected length %d\n", len); ok(!memcmp(propvalue, serialized_null, 4), "got wrong data\n");
- test_string_bstr = SysAllocString(test_string); + test_string_bstr = SysAllocString(L"test");
propvar.vt = VT_BSTR; U(propvar).bstrVal = test_string_bstr; diff --git a/dlls/ole32/tests/stg_prop.c b/dlls/ole32/tests/stg_prop.c index 0184693f2a5..d11844db258 100644 --- a/dlls/ole32/tests/stg_prop.c +++ b/dlls/ole32/tests/stg_prop.c @@ -45,8 +45,6 @@ static void init_function_pointers(void) */ static void testPropsHelper(IPropertySetStorage **propSetStorage) { - static const WCHAR szDot[] = { '.',0 }; - static const WCHAR szPrefix[] = { 's','t','g',0 }; static const WCHAR szSummaryInfo[] = { 5,'S','u','m','m','a','r','y', 'I','n','f','o','r','m','a','t','i','o','n',0 }; static WCHAR propName[] = { 'p','r','o','p',0 }; @@ -68,7 +66,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage) else trace("Testing property storage without a set...\n");
- if(!GetTempFileNameW(szDot, szPrefix, 0, filename)) + if(!GetTempFileNameW(L".", L"stg", 0, filename)) return;
DeleteFileW(filename); @@ -432,8 +430,6 @@ static void testProps(void)
static void testCodepage(void) { - static const WCHAR szDot[] = { '.',0 }; - static const WCHAR szPrefix[] = { 's','t','g',0 }; static CHAR aval[] = "hi"; static WCHAR wval[] = { 'h','i',0 }; HRESULT hr; @@ -444,7 +440,7 @@ static void testCodepage(void) PROPVARIANT var; WCHAR fileName[MAX_PATH];
- if(!GetTempFileNameW(szDot, szPrefix, 0, fileName)) + if(!GetTempFileNameW(L".", L"stg", 0, fileName)) return;
hr = StgCreateDocfile(fileName, diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 9d2c970e867..58493a6d088 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -38,15 +38,17 @@ DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0); static CHAR filenameA[MAX_PATH]; static WCHAR filename[MAX_PATH];
-static const char file1_nameA[] = {'c','o','p','y','t','e','s','t','A',0}; -static const WCHAR file1_name[] = {'c','o','p','y','t','e','s','t','A',0}; -static const char file2_nameA[] = {'c','o','p','y','t','e','s','t','B',0}; -static const WCHAR file2_name[] = {'c','o','p','y','t','e','s','t','B',0}; -static const WCHAR stgA_name[] = {'S','t','o','r','a','g','e','A',0}; -static const WCHAR stgB_name[] = {'S','t','o','r','a','g','e','B',0}; -static const WCHAR strmA_name[] = {'S','t','r','e','a','m','A',0}; -static const WCHAR strmB_name[] = {'S','t','r','e','a','m','B',0}; -static const WCHAR strmC_name[] = {'S','t','r','e','a','m','C',0}; +static const char file1_nameA[] = "copytestA"; +static const WCHAR file1_name[] = L"copytestA"; +static const char file2_nameA[] = "copytestB"; +static const WCHAR file2_name[] = L"copytestB"; +static const WCHAR stgA_name[] = L"StorageA"; +static const WCHAR stgB_name[] = L"StorageB"; +static const WCHAR strmA_name[] = L"StreamA"; +static const WCHAR strmB_name[] = L"StreamB"; +static const WCHAR strmC_name[] = L"StreamC"; + +static const WCHAR contentsW[] = L"CONTENTS";
/* Win9x and WinMe don't have lstrcmpW */ static int strcmp_ww(LPCWSTR strw1, LPCWSTR strw2) @@ -200,7 +202,7 @@ static HRESULT WINAPI TestLockBytes_Stat(ILockBytes *iface, STATSTG *pstatstg, DWORD grfStatFlag) { TestLockBytes *This = impl_from_ILockBytes(iface); - static const WCHAR dummy_name[] = {'d','u','m','m','y',0}; + static const WCHAR dummy_name[] = L"dummy";
if (!pstatstg) return E_INVALIDARG;
@@ -499,11 +501,7 @@ static void test_stgcreatestorageex(void)
static void test_storage_stream(void) { - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR longname[] = { - 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', - 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',0 - }; + static const WCHAR longname[] = L"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; IStorage *stg = NULL; HRESULT r; IStream *stm = NULL; @@ -521,30 +519,30 @@ static void test_storage_stream(void) ok(r==S_OK, "StgCreateDocfile failed\n");
/* try create some invalid streams */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 1, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 1, 0, &stm ); ok(r==STG_E_INVALIDPARAMETER, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 1, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 1, &stm ); ok(r==STG_E_INVALIDPARAMETER, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, NULL ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, NULL ); ok(r==STG_E_INVALIDPOINTER, "IStorage->CreateStream wrong error\n"); r = IStorage_CreateStream(stg, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDNAME, "IStorage->CreateStream wrong error\n"); r = IStorage_CreateStream(stg, longname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDNAME || broken(r==S_OK) /* nt4 */, "IStorage->CreateStream wrong error, got %d GetLastError()=%d\n", r, GetLastError()); - r = IStorage_CreateStream(stg, stmname, STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_READ, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_READ, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_WRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_WRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_DENY_NONE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_DENY_NONE | STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n"); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_DENY_NONE | STGM_READ, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_DENY_NONE | STGM_READ, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n");
/* now really create a stream and delete it */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
/* test for support interfaces */ @@ -555,13 +553,13 @@ static void test_storage_stream(void)
r = IStream_Release(stm); ok(r == 0, "wrong ref count\n"); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_FILEALREADYEXISTS, "IStorage->CreateStream failed\n"); - r = IStorage_DestroyElement(stg,stmname); + r = IStorage_DestroyElement(stg, contentsW); ok(r==S_OK, "IStorage->DestroyElement failed\n");
/* create a stream and write to it */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStream_Clone(stm, &stm2); @@ -666,7 +664,7 @@ static void test_storage_stream(void) ok(r == 0, "wrong ref count\n");
/* create a stream and write to it */ - r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm2 ); + r = IStorage_CreateStream(stg, contentsW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm2 ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &p); @@ -687,7 +685,7 @@ static void test_storage_stream(void) ok(r == S_OK, "should succeed\n"); if (stg) { - r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm); ok(r == STG_E_INVALIDFLAG, "IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08x\n", r); IStorage_Release(stg); } @@ -736,7 +734,6 @@ static BOOL is_existing_file(LPCSTR filename)
static void test_open_storage(void) { - static const WCHAR szNonExist[] = { 'n','o','n','e','x','i','s','t',0 }; IStorage *stg = NULL, *stg2 = NULL; HRESULT r; DWORD stgm; @@ -777,7 +774,7 @@ static void test_open_storage(void) ok(r==STG_E_INVALIDPOINTER, "StgOpenStorage wrong error\n"); r = StgOpenStorage( filename, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, NULL, 1, &stg); ok(r==STG_E_INVALIDPARAMETER, "StgOpenStorage wrong error\n"); - r = StgOpenStorage( szNonExist, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, NULL, 0, &stg); + r = StgOpenStorage( L"nonexist", NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, NULL, 0, &stg); ok(r==STG_E_FILENOTFOUND, "StgOpenStorage failed\n"); r = StgOpenStorage( filename, NULL, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, NULL, 0, &stg); ok(r==STG_E_INVALIDFLAG, "StgOpenStorage failed\n"); @@ -830,14 +827,13 @@ static void test_open_storage(void) ok(r==S_OK, "StgOpenStorage failed\n"); if(stg) { - static const WCHAR stmname[] = { 'w','i','n','e','t','e','s','t',0}; IStream *stm = NULL; IStorage *stg2 = NULL;
- r = IStorage_CreateStream( stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, + r = IStorage_CreateStream( stg, L"winetest", STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm ); ok(r == STG_E_ACCESSDENIED, "CreateStream should fail\n"); - r = IStorage_CreateStorage( stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); + r = IStorage_CreateStorage( stg, L"winetest", STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); ok(r == STG_E_ACCESSDENIED, "CreateStream should fail\n");
r = IStorage_Release(stg); @@ -1018,7 +1014,6 @@ static void test_storage_refcount(void) IStorage *stgprio = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; LARGE_INTEGER pos; ULARGE_INTEGER upos; STATSTG stat; @@ -1038,7 +1033,7 @@ static void test_storage_refcount(void) ok( r == S_OK, "IStorage_Commit failed\n");
/* now create a stream */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStorage_Release( stg ); @@ -1078,9 +1073,7 @@ static void test_storage_refcount(void) ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r); if(stg) { - static const WCHAR stgname[] = { ' ',' ',' ','2','9',0 }; - static const WCHAR stgname2[] = { 'C','V','_','i','e','w',0 }; - static const WCHAR stmname2[] = { 'V','a','r','2','D','a','t','a',0 }; + static const WCHAR stgname[] = L" 29"; IStorage *stg2; IStorage *stg3; STATSTG statstg; @@ -1115,10 +1108,10 @@ static void test_storage_refcount(void) ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved); CoTaskMemFree(statstg.pwcsName);
- r = IStorage_CreateStorage( stg2, stgname2, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stg3 ); + r = IStorage_CreateStorage( stg2, L"CV_iew", STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stg3 ); ok(r == STG_E_ACCESSDENIED, "CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08x\n", r);
- r = IStorage_CreateStream( stg2, stmname2, STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm ); + r = IStorage_CreateStream( stg2, L"Var2Data", STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm ); ok(r == STG_E_ACCESSDENIED, "CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08x\n", r);
IStorage_Release(stg2); @@ -1227,9 +1220,8 @@ static void test_streamenum(void) IStorage *stg = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'A','B','C','D','E','F','G','H','I',0 }; - static const WCHAR stmname3[] = { 'A','B','C','D','E','F','G','H','I','J',0 }; + static const WCHAR stmname2[] = L"ABCDEFGHI"; + static const WCHAR stmname3[] = L"ABCDEFGHIJ"; static const STATSTG stat_null; STATSTG stat; IEnumSTATSTG *ee = NULL; @@ -1249,7 +1241,7 @@ static void test_streamenum(void) ok( r == S_OK, "IStorage_Commit failed\n");
/* now create a stream */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
IStream_Release(stm); @@ -1273,7 +1265,7 @@ static void test_streamenum(void) r = IStorage_EnumElements(stg, 0, NULL, 0, &ee); ok(r==S_OK, "IStorage->EnumElements failed\n");
- r = IStorage_DestroyElement(stg, stmname); + r = IStorage_DestroyElement(stg, contentsW); ok(r==S_OK, "IStorage->DestroyElement failed\n");
memset(&stat, 0xad, sizeof(stat)); @@ -1296,7 +1288,7 @@ static void test_streamenum(void) r = IEnumSTATSTG_Reset(ee); ok(r==S_OK, "IEnumSTATSTG->Reset failed\n");
- r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStream_Release(stm); @@ -1309,7 +1301,7 @@ static void test_streamenum(void)
if (r == S_OK) { - ok(lstrcmpiW(stat.pwcsName, stmname) == 0, "expected CONTENTS, got %s\n", wine_dbgstr_w(stat.pwcsName)); + ok(!lstrcmpiW(stat.pwcsName, contentsW), "expected CONTENTS, got %s\n", wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); }
@@ -1347,11 +1339,11 @@ static void test_streamenum(void)
if (r == S_OK) { - ok(lstrcmpiW(stat.pwcsName, stmname) == 0, "expected CONTENTS, got %s\n", wine_dbgstr_w(stat.pwcsName)); + ok(!lstrcmpiW(stat.pwcsName, contentsW), "expected CONTENTS, got %s\n", wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); }
- r = IStorage_DestroyElement(stg, stmname); + r = IStorage_DestroyElement(stg, contentsW); ok(r==S_OK, "IStorage->DestroyElement failed\n");
r = IStorage_DestroyElement(stg, stmname2); @@ -1404,10 +1396,9 @@ static void test_transact(void) IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'F','O','O',0 }; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; - static const WCHAR stgname2[] = { 'T','E','M','P','S','T','G',0 }; + static const WCHAR stmname2[] = L"FOO"; + static const WCHAR stgname[] = L"PERMSTG"; + static const WCHAR stgname2[] = L"TEMPSTG"; BOOL ret;
DeleteFileA(filenameA); @@ -1452,7 +1443,7 @@ static void test_transact(void)
/* now create a stream and storage, but don't commit them */ stm = NULL; - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStream_Write(stm, "this is stream 2\n", 16, NULL); @@ -1480,19 +1471,19 @@ static void test_transact(void) if (!stg) return;
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStorage(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 ); + r = IStorage_OpenStorage(stg, contentsW, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 ); ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r); if (r == S_OK) IStream_Release(stm); @@ -1538,9 +1529,8 @@ static void test_substorage_share(void) IStorage *stg, *stg2, *stg3; IStream *stm, *stm2; HRESULT r; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR othername[] = { 'N','E','W','N','A','M','E',0 }; + static const WCHAR stgname[] = L"PERMSTG"; + static const WCHAR othername[] = L"NEWNAME"; BOOL ret;
DeleteFileA(filenameA); @@ -1577,7 +1567,7 @@ static void test_substorage_share(void) r = IStorage_DestroyElement(stg, stgname); ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
- r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + r = IStorage_CreateStream(stg2, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r);
if (r == S_OK) @@ -1587,30 +1577,30 @@ static void test_substorage_share(void) }
/* create a read/write stream and try to open it again */ - r = IStorage_CreateStream(stg, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + r = IStorage_CreateStream(stg, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r);
if (r == S_OK) { - r = IStorage_OpenStream(stg, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm2); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm2); ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
if (r == S_OK) IStream_Release(stm2);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm2); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm2); ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
if (r == S_OK) IStream_Release(stm2);
/* cannot rename the stream while it's open */ - r = IStorage_RenameElement(stg, stmname, othername); + r = IStorage_RenameElement(stg, contentsW, othername); ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r); - if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stmname); + if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, contentsW);
/* destroying an object while it's open invalidates it */ - r = IStorage_DestroyElement(stg, stmname); + r = IStorage_DestroyElement(stg, contentsW); ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
r = IStream_Write(stm, "this shouldn't work\n", 20, NULL); @@ -1630,10 +1620,9 @@ static void test_revert(void) IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL; HRESULT r; IStream *stm = NULL, *stm2 = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'F','O','O',0 }; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; - static const WCHAR stgname2[] = { 'T','E','M','P','S','T','G',0 }; + static const WCHAR stmname2[] = L"FOO"; + static const WCHAR stgname[] = L"PERMSTG"; + static const WCHAR stgname2[] = L"TEMPSTG"; STATSTG statstg; BOOL ret;
@@ -1674,7 +1663,7 @@ static void test_revert(void) }
/* now create a stream and storage, then revert */ - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm2 ); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm2 ); ok(r==S_OK, "IStorage->CreateStream failed\n");
r = IStream_Write(stm2, "this is stream 2\n", 16, NULL); @@ -1704,19 +1693,19 @@ static void test_revert(void) IStorage_Release(stg2); IStorage_Release(stg3);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStorage(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 ); + r = IStorage_OpenStorage(stg, contentsW, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 ); ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r); if (r == S_OK) IStream_Release(stm); @@ -1782,8 +1771,7 @@ static void test_parent_free(void) IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; + static const WCHAR stgname[] = L"PERMSTG"; ULONG ref; STATSTG statstg; BOOL ret; @@ -1802,7 +1790,7 @@ static void test_parent_free(void) if (r == S_OK) { /* now create a stream inside the new storage */ - r = IStorage_CreateStream(stg2, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg2, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n");
if (r == S_OK) @@ -1845,9 +1833,8 @@ static void test_nonroot_transacted(void) IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'F','O','O',0 }; + static const WCHAR stgname[] = L"PERMSTG"; + static const WCHAR stmname2[] = L"FOO"; BOOL ret;
DeleteFileA(filenameA); @@ -1864,7 +1851,7 @@ static void test_nonroot_transacted(void) if (r == S_OK) { /* create and commit stmname */ - r = IStorage_CreateStream(stg2, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg2, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n"); if (r == S_OK) IStream_Release(stm); @@ -1880,7 +1867,7 @@ static void test_nonroot_transacted(void) IStorage_Revert(stg2);
/* check that Commit and Revert really worked */ - r = IStorage_OpenStream(stg2, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg2, contentsW, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r); if (r == S_OK) IStream_Release(stm); @@ -1926,7 +1913,7 @@ static void test_nonroot_transacted(void) if (r == S_OK) { /* create and commit stmname */ - r = IStorage_CreateStream(stg2, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); + r = IStorage_CreateStream(stg2, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n"); if (r == S_OK) IStream_Release(stm); @@ -1942,7 +1929,7 @@ static void test_nonroot_transacted(void) IStorage_Revert(stg2);
/* check that Commit and Revert really worked */ - r = IStorage_OpenStream(stg2, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + r = IStorage_OpenStream(stg2, contentsW, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r); if (r == S_OK) IStream_Release(stm); @@ -2119,7 +2106,7 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD
static void test_access(void) { - static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; + static const WCHAR fileW[] = L"winetest"; static const char fileA[] = "winetest"; IStorage *stg; HRESULT hr; @@ -2237,9 +2224,9 @@ static void test_readonly(void) IStorage *stg, *stg2, *stg3; IStream *stream; HRESULT hr; - static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; - static const WCHAR storageW[] = {'s','t','o','r','a','g','e',0}; - static const WCHAR streamW[] = {'s','t','r','e','a','m',0}; + static const WCHAR fileW[] = L"winetest"; + static const WCHAR storageW[] = L"storage"; + static const WCHAR streamW[] = L"stream";
hr = StgCreateDocfile( fileW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); ok(hr == S_OK, "should succeed, res=%x\n", hr); @@ -2315,9 +2302,8 @@ static void test_simple(void) IStorage *stg, *stg2; HRESULT r; IStream *stm; - static const WCHAR stgname[] = { 'S','t','g',0 }; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'S','m','a','l','l',0 }; + static const WCHAR stgname[] = L"Stg"; + static const WCHAR stmname2[] = L"Small"; LARGE_INTEGER pos; ULARGE_INTEGER upos; DWORD count; @@ -2332,9 +2318,9 @@ static void test_simple(void) ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r); if (SUCCEEDED(r)) IStorage_Release(stg2);
- r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); + r = IStorage_CreateStream(stg, contentsW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); ok(r == STG_E_INVALIDFLAG, "got %08x\n", r); - r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); ok(r == S_OK, "got %08x\n", r);
upos.QuadPart = 6000; @@ -2400,7 +2386,7 @@ static void test_simple(void) ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r); if (SUCCEEDED(r)) IStorage_Release(stg2);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm); ok(r == S_OK, "got %08x\n", r);
r = IStream_Stat(stm, &stat, STATFLAG_NONAME); @@ -2429,13 +2415,11 @@ static void test_fmtusertypestg(void) IStorage *stg; IEnumSTATSTG *stat; HRESULT hr; - static const char fileA[] = {'f','m','t','t','e','s','t',0}; - static const WCHAR fileW[] = {'f','m','t','t','e','s','t',0}; - static WCHAR userTypeW[] = {'S','t','g','U','s','r','T','y','p','e',0}; - static const WCHAR strmNameW[] = {1,'C','o','m','p','O','b','j',0}; + static WCHAR userTypeW[] = L"StgUsrType"; + static const WCHAR strmNameW[] = L"\1CompObj"; static const STATSTG statstg_null;
- hr = StgCreateDocfile( fileW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); + hr = StgCreateDocfile( L"fmttest", STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); ok(hr == S_OK, "should succeed, res=%x\n", hr);
if (SUCCEEDED(hr)) @@ -2493,7 +2477,7 @@ static void test_fmtusertypestg(void) }
IStorage_Release(stg); - DeleteFileA( fileA ); + DeleteFileW( L"fmttest" ); } }
@@ -2502,7 +2486,6 @@ static void test_references(void) IStorage *stg,*stg2; HRESULT hr; unsigned c1,c2; - static const WCHAR StorName[] = { 'D','a','t','a','S','p','a','c','e','I','n','f','o',0 };
DeleteFileA(filenameA);
@@ -2518,7 +2501,7 @@ static void test_references(void)
if (SUCCEEDED(hr)) { - hr = IStorage_CreateStorage(stg,StorName,STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,0,&stg2); + hr = IStorage_CreateStorage(stg, L"DataSpaceInfo", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); ok(hr == S_OK, "IStorage_CreateStorage failed (result=%x)\n",hr);
if (SUCCEEDED(hr)) @@ -2948,10 +2931,9 @@ static void test_rename(void) IStorage *stg, *stg2; IStream *stm; HRESULT r; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; - static const WCHAR stgname2[] = { 'S','T','G',0 }; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'E','N','T','S',0 }; + static const WCHAR stgname[] = L"PERMSTG"; + static const WCHAR stgname2[] = L"STG"; + static const WCHAR stmname2[] = L"ENTS"; BOOL ret;
DeleteFileA(filenameA); @@ -2966,16 +2948,16 @@ static void test_rename(void) ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* create a stream in the substorage */ - r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + r = IStorage_CreateStream(stg2, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r); IStream_Release(stm);
/* rename the stream */ - r = IStorage_RenameElement(stg2, stmname, stmname2); + r = IStorage_RenameElement(stg2, contentsW, stmname2); ok(r==S_OK, "IStorage->RenameElement failed, hr=%08x\n", r);
/* cannot open stream with old name */ - r = IStorage_OpenStream(stg2, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); + r = IStorage_OpenStream(stg2, contentsW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); ok(r==STG_E_FILENOTFOUND, "IStorage_OpenStream should fail, hr=%08x\n", r); if (SUCCEEDED(r)) IStream_Release(stm);
@@ -3095,7 +3077,7 @@ static void test_substorage_enum(void) IEnumSTATSTG *ee; HRESULT r; ULONG ref; - static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; + static const WCHAR stgname[] = L"PERMSTG"; BOOL ret;
DeleteFileA(filenameA); @@ -3141,9 +3123,6 @@ static void test_copyto_locking(void) IStorage *stg, *stg2, *stg3, *stg4; IStream *stm; HRESULT r; - static const WCHAR stgname[] = { 'S','T','G','1',0 }; - static const WCHAR stgname2[] = { 'S','T','G','2',0 }; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; BOOL ret;
DeleteFileA(filenameA); @@ -3154,15 +3133,15 @@ static void test_copyto_locking(void) ok(r==S_OK, "StgCreateDocfile failed\n");
/* create a substorage */ - r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); + r = IStorage_CreateStorage(stg, L"STG1", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* create another substorage */ - r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3); + r = IStorage_CreateStorage(stg, L"STG2", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* add a stream, and leave it open */ - r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + r = IStorage_CreateStream(stg2, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r);
/* Try to copy the storage while the stream is open */ @@ -3172,7 +3151,7 @@ static void test_copyto_locking(void) IStream_Release(stm);
/* create a substorage */ - r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg4); + r = IStorage_CreateStorage(stg2, L"STG", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg4); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* Try to copy the storage while the substorage is open */ @@ -3192,8 +3171,6 @@ static void test_copyto_recursive(void) { IStorage *stg, *stg2, *stg3, *stg4; HRESULT r; - static const WCHAR stgname[] = { 'S','T','G','1',0 }; - static const WCHAR stgname2[] = { 'S','T','G','2',0 }; BOOL ret;
DeleteFileA(filenameA); @@ -3204,7 +3181,7 @@ static void test_copyto_recursive(void) ok(r==S_OK, "StgCreateDocfile failed\n");
/* create a substorage */ - r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); + r = IStorage_CreateStorage(stg, L"STG1", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* copy the parent to the child */ @@ -3212,7 +3189,7 @@ static void test_copyto_recursive(void) ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08x\n", r);
/* create a transacted substorage */ - r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg3); + r = IStorage_CreateStorage(stg, L"STG2", STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg3); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* copy the parent to the transacted child */ @@ -3220,7 +3197,7 @@ static void test_copyto_recursive(void) ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08x\n", r);
/* create a transacted subsubstorage */ - r = IStorage_CreateStorage(stg3, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg4); + r = IStorage_CreateStorage(stg3, L"STG2", STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg4); ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
/* copy the parent to the transacted child of the transacted child */ @@ -3288,7 +3265,7 @@ static void test_hglobal_storage_creation(void)
static void test_convert(void) { - static const WCHAR filename[] = {'s','t','o','r','a','g','e','.','s','t','g',0}; + static const WCHAR filename[] = L"storage.stg"; IStorage *stg; HRESULT hr;
@@ -3317,7 +3294,7 @@ static void test_convert(void)
static void test_direct_swmr(void) { - static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; + static const WCHAR fileW[] = L"winetest"; IDirectWriterLock *dwlock; ULONG ref, ref2; IStorage *stg; @@ -3485,7 +3462,7 @@ static void check_access(LPCWSTR filename, const struct lock_test *current,
static void test_locking(void) { - static const WCHAR filename[] = {'w','i','n','e','t','e','s','t',0}; + static const WCHAR filename[] = L"winetest"; int i; IStorage *stg; HRESULT hr; @@ -3645,7 +3622,6 @@ static void test_transacted_shared(void) IStorage *stgrw = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; LARGE_INTEGER pos; ULARGE_INTEGER upos; char buffer[10]; @@ -3661,7 +3637,7 @@ static void test_transacted_shared(void) r = WriteClassStg(stg, &test_stg_cls); ok(r == S_OK, "WriteClassStg failed %x\n", r);
- r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
pos.QuadPart = 0; @@ -3700,7 +3676,7 @@ static void test_transacted_shared(void) IStream_Release(stm);
/* we can still read the old content from the second storage */ - r = IStorage_OpenStream(stgrw, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); + r = IStorage_OpenStream(stgrw, contentsW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); ok(r==S_OK, "IStorage->OpenStream failed %x\n", r);
pos.QuadPart = 0; @@ -3734,7 +3710,7 @@ static void test_transacted_shared(void) r = IStorage_Revert(stg); ok(r==S_OK, "IStorage->Revert failed %x\n", r);
- r = IStorage_OpenStream(stg, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); + r = IStorage_OpenStream(stg, contentsW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
pos.QuadPart = 0; @@ -3763,8 +3739,7 @@ static void test_overwrite(void) IStorage *stg = NULL; HRESULT r; IStream *stm = NULL; - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; - static const WCHAR stmname2[] = { 'C','O','N','T','E','N','T','2',0 }; + static const WCHAR stmname2[] = L"CONTENTS2"; LARGE_INTEGER pos; ULARGE_INTEGER upos; char buffer[4096]; @@ -3781,7 +3756,7 @@ static void test_overwrite(void) r = WriteClassStg(stg, &test_stg_cls); ok(r == S_OK, "WriteClassStg failed %x\n", r);
- r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); + r = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
pos.QuadPart = 0; @@ -3821,7 +3796,7 @@ static void test_overwrite(void)
IStream_Release(stm);
- IStorage_RenameElement(stg, stmname, stmname2); + IStorage_RenameElement(stg, contentsW, stmname2);
r = IStorage_Commit(stg, STGC_OVERWRITE); ok(r==S_OK, "IStorage->Commit failed %x\n", r); @@ -3873,7 +3848,6 @@ static void test_overwrite(void)
static void test_custom_lockbytes(void) { - static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; TestLockBytes* lockbytes; HRESULT hr; IStorage* stg; @@ -3884,7 +3858,7 @@ static void test_custom_lockbytes(void) hr = StgCreateDocfileOnILockBytes(&lockbytes->ILockBytes_iface, STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED, 0, &stg); ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %x\n", hr);
- hr = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm); + hr = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm); ok(hr==S_OK, "IStorage_CreateStream failed %x\n", hr);
IStream_Release(stm); @@ -3900,7 +3874,7 @@ static void test_custom_lockbytes(void) hr = StgCreateDocfileOnILockBytes(&lockbytes->ILockBytes_iface, STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED, 0, &stg); ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %x\n", hr);
- hr = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm); + hr = IStorage_CreateStream(stg, contentsW, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm); ok(hr==S_OK, "IStorage_CreateStream failed %x\n", hr);
IStream_Release(stm); diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c index bbe7fb5da7f..b176588133b 100644 --- a/dlls/ole32/tests/usrmarshal.c +++ b/dlls/ole32/tests/usrmarshal.c @@ -996,8 +996,8 @@ static void test_marshal_STGMEDIUM(void)
static void test_marshal_SNB(void) { - static const WCHAR str1W[] = {'s','t','r','i','n','g','1',0}; - static const WCHAR str2W[] = {'s','t','r','2',0}; + static const WCHAR str1W[] = L"string1"; + static const WCHAR str2W[] = L"str2"; unsigned char *buffer, *src, *mbuf; MIDL_STUB_MESSAGE stub_msg; WCHAR **ptrW, *dataW;