[PATCH] ole32: Use wide-char string literals.

Michael Stefaniuc mstefani at winehq.org
Thu Nov 26 15:20:04 CST 2020


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/ole32/classmoniker.c   |  2 +-
 dlls/ole32/clipboard.c      |  6 ++---
 dlls/ole32/comcat.c         |  8 +++---
 dlls/ole32/compobj.c        | 37 +++++++++-----------------
 dlls/ole32/datacache.c      |  6 ++---
 dlls/ole32/defaulthandler.c |  3 +--
 dlls/ole32/itemmoniker.c    |  3 +--
 dlls/ole32/moniker.c        |  6 ++---
 dlls/ole32/ole2.c           | 53 +++++++++++--------------------------
 dlls/ole32/stg_prop.c       |  6 ++---
 dlls/ole32/storage32.c      | 51 ++++++++++++-----------------------
 11 files changed, 60 insertions(+), 121 deletions(-)

diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c
index 86d954a9c99..662baa3cd39 100644
--- a/dlls/ole32/classmoniker.c
+++ b/dlls/ole32/classmoniker.c
@@ -519,7 +519,7 @@ static HRESULT WINAPI ClassMoniker_GetDisplayName(IMoniker* iface,
                                               LPOLESTR *ppszDisplayName)
 {
     ClassMoniker *This = impl_from_IMoniker(iface);
-    static const WCHAR wszClsidPrefix[] = {'c','l','s','i','d',':',0};
+    static const WCHAR wszClsidPrefix[] = L"clsid:";
 
     TRACE("(%p, %p, %p)\n", pbc, pmkToLeft, ppszDisplayName);
 
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 01cfda831f5..a28dcef9eee 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -198,7 +198,7 @@ static inline HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd)
 /*
  * Name of our registered OLE clipboard window class
  */
-static const WCHAR clipbrd_wndclass[] = {'C','L','I','P','B','R','D','W','N','D','C','L','A','S','S',0};
+static const WCHAR clipbrd_wndclass[] = L"CLIPBRDWNDCLASS";
 
 UINT ownerlink_clipboard_format = 0;
 UINT filename_clipboard_format = 0;
@@ -619,7 +619,6 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
 
         if (mfp)
         {
-            OLECHAR name[]={ 2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
             IStream *pStream = 0;
             void *mfBits;
             PresentationDataHeader pdh;
@@ -644,7 +643,8 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
             pdh.dwObjectExtentY = mfp->yExt;
             pdh.dwSize = nSize;
 
-            hr = IStorage_CreateStream(std.u.pstg, name, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &pStream);
+            hr = IStorage_CreateStream(std.u.pstg, L"\2OlePres000",
+                    STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &pStream);
 
             hr = IStream_Write(pStream, &pdh, sizeof(PresentationDataHeader), NULL);
 
diff --git a/dlls/ole32/comcat.c b/dlls/ole32/comcat.c
index e258f8835b0..0b97b00d908 100644
--- a/dlls/ole32/comcat.c
+++ b/dlls/ole32/comcat.c
@@ -129,7 +129,7 @@ static HRESULT COMCAT_UnRegisterClassCategories(
     ULONG cCategories,
     const CATID *rgcatid)
 {
-    WCHAR keyname[68] = { 'C', 'L', 'S', 'I', 'D', '\\' };
+    WCHAR keyname[68] = L"CLSID\\";
     HRESULT res;
     HKEY type_key;
 
@@ -501,9 +501,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_GetCategoryDesc(
     LCID lcid,
     PWCHAR *ppszDesc)
 {
-    WCHAR keyname[60] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
-			  't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
-			  'r', 'i', 'e', 's', '\\', 0 };
+    WCHAR keyname[60] = L"Component Categories\\";
     HKEY key;
     HRESULT res;
 
@@ -584,7 +582,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_IsClassOfCategories(
     ULONG cRequired,
     CATID *rgcatidReq)
 {
-    WCHAR keyname[45] = { 'C', 'L', 'S', 'I', 'D', '\\', 0 };
+    WCHAR keyname[45] = L"CLSID\\";
     HRESULT res;
     struct class_categories *categories;
     HKEY key;
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index c37a8ac6098..51db61414dc 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -245,10 +245,6 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES
     return status;
 }
 
-static const WCHAR classes_rootW[] =
-    {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e',
-     '\\','S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s',0};
-
 static HKEY classes_root_hkey;
 
 /* create the special HKEY_CLASSES_ROOT key */
@@ -264,7 +260,7 @@ static HKEY create_classes_root_hkey(DWORD access)
     attr.Attributes = 0;
     attr.SecurityDescriptor = NULL;
     attr.SecurityQualityOfService = NULL;
-    RtlInitUnicodeString( &name, classes_rootW );
+    RtlInitUnicodeString( &name, L"\\Registry\\Machine\\Software\\Classes" );
     if (create_key( &hkey, access, &attr )) return 0;
     TRACE( "%s -> %p\n", debugstr_w(attr.ObjectName->Buffer), hkey );
 
@@ -292,9 +288,8 @@ static inline HKEY get_classes_root_hkey( HKEY hkey, REGSAM access )
         ret = create_classes_root_hkey(MAXIMUM_ALLOWED | (access & KEY_WOW64_64KEY));
     if (force_wow32 && ret && ret == classes_root_hkey)
     {
-        static const WCHAR wow6432nodeW[] = {'W','o','w','6','4','3','2','N','o','d','e',0};
         access &= ~KEY_WOW64_32KEY;
-        if (create_classes_key(classes_root_hkey, wow6432nodeW, access, &hkey))
+        if (create_classes_key(classes_root_hkey, L"Wow6432Node", access, &hkey))
             return 0;
         ret = hkey;
     }
@@ -530,13 +525,12 @@ HRESULT WINAPI CoInitialize(LPVOID lpReserved)
 /* open HKCR\\CLSID\\{string form of clsid}\\{keyname} key */
 HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
 {
-    static const WCHAR wszCLSIDSlash[] = {'C','L','S','I','D','\\',0};
-    WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(wszCLSIDSlash) - 1];
+    WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(L"CLSID\\") - 1];
     LONG res;
     HKEY key;
 
-    lstrcpyW(path, wszCLSIDSlash);
-    StringFromGUID2(clsid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID);
+    lstrcpyW(path, L"CLSID\\");
+    StringFromGUID2(clsid, path + lstrlenW(L"CLSID\\"), CHARS_IN_GUID);
     res = open_classes_key(HKEY_CLASSES_ROOT, path, keyname ? KEY_READ : access, &key);
     if (res == ERROR_FILE_NOT_FOUND)
         return REGDB_E_CLASSNOTREG;
@@ -707,8 +701,6 @@ HRESULT WINAPI CoSetState(IUnknown * pv)
  */
 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
 {
-    static const WCHAR wszAutoTreatAs[] = {'A','u','t','o','T','r','e','a','t','A','s',0};
-    static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
     HKEY hkey = NULL;
     WCHAR szClsidNew[CHARS_IN_GUID];
     HRESULT res = S_OK;
@@ -722,10 +714,10 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
 
     if (IsEqualGUID( clsidOld, clsidNew ))
     {
-       if (!RegQueryValueW(hkey, wszAutoTreatAs, auto_treat_as, &auto_treat_as_size) &&
+       if (!RegQueryValueW(hkey, L"AutoTreatAs", auto_treat_as, &auto_treat_as_size) &&
            CLSIDFromString(auto_treat_as, &id) == S_OK)
        {
-           if (RegSetValueW(hkey, wszTreatAs, REG_SZ, auto_treat_as, sizeof(auto_treat_as)))
+           if (RegSetValueW(hkey, L"TreatAs", REG_SZ, auto_treat_as, sizeof(auto_treat_as)))
            {
                res = REGDB_E_WRITEREGDB;
                goto done;
@@ -733,7 +725,7 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
        }
        else
        {
-           if(RegDeleteKeyW(hkey, wszTreatAs))
+           if (RegDeleteKeyW(hkey, L"TreatAs"))
                res = REGDB_E_WRITEREGDB;
            goto done;
        }
@@ -741,7 +733,7 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
     else
     {
         if(IsEqualGUID(clsidNew, &CLSID_NULL)){
-           RegDeleteKeyW(hkey, wszTreatAs);
+           RegDeleteKeyW(hkey, L"TreatAs");
         }else{
             if(!StringFromGUID2(clsidNew, szClsidNew, ARRAY_SIZE(szClsidNew))){
                 WARN("StringFromGUID2 failed\n");
@@ -749,7 +741,7 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
                 goto done;
             }
 
-            if(RegSetValueW(hkey, wszTreatAs, REG_SZ, szClsidNew, sizeof(szClsidNew)) != ERROR_SUCCESS){
+            if (RegSetValueW(hkey, L"TreatAs", REG_SZ, szClsidNew, sizeof(szClsidNew)) != ERROR_SUCCESS){
                 WARN("RegSetValue failed\n");
                 res = REGDB_E_WRITEREGDB;
                 goto done;
@@ -892,12 +884,11 @@ static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst
     }
     else
     {
-        static const WCHAR dllW[] = {'.','d','l','l',0};
         ULONG_PTR cookie;
 
         *dst = 0;
         ActivateActCtx(regdata->u.actctx.hactctx, &cookie);
-        ret = SearchPathW(NULL, regdata->u.actctx.module_name, dllW, dstlen, dst, NULL);
+        ret = SearchPathW(NULL, regdata->u.actctx.module_name, L".dll", dstlen, dst, NULL);
         DeactivateActCtx(0, cookie);
         return *dst != 0;
     }
@@ -905,11 +896,10 @@ static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst
 
 HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
-    static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
     HKEY hkey;
     HRESULT hres;
 
-    hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey);
+    hres = COM_OpenKeyForCLSID(rclsid, L"InprocHandler32", KEY_READ, &hkey);
     if (SUCCEEDED(hres))
     {
         struct class_reg_data regdata;
@@ -920,8 +910,7 @@ HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
         if (get_object_dll_path(&regdata, dllpath, ARRAY_SIZE(dllpath)))
         {
-            static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
-            if (!wcsicmp(dllpath, wszOle32))
+            if (!wcsicmp(dllpath, L"ole32.dll"))
             {
                 RegCloseKey(hkey);
                 return HandlerCF_Create(rclsid, riid, ppv);
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 4e4f264860a..a536f829515 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -530,8 +530,6 @@ static HRESULT write_clipformat(IStream *stream, CLIPFORMAT clipformat)
     return hr;
 }
 
-static const WCHAR CONTENTS[] = {'C','O','N','T','E','N','T','S',0};
-
 static HRESULT open_pres_stream( IStorage *stg, int stream_number, IStream **stm )
 {
     WCHAR pres[] = {2,'O','l','e','P','r','e','s',
@@ -541,7 +539,7 @@ static HRESULT open_pres_stream( IStorage *stg, int stream_number, IStream **stm
     const WCHAR *name = pres;
 
     if (stream_number == STREAM_NUMBER_NOT_SET) return E_FAIL;
-    if (stream_number == STREAM_NUMBER_CONTENTS) name = CONTENTS;
+    if (stream_number == STREAM_NUMBER_CONTENTS) name = L"CONTENTS";
 
     return IStorage_OpenStream( stg, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, stm );
 }
@@ -1089,7 +1087,7 @@ static HRESULT create_stream(DataCacheEntry *cache_entry, IStorage *storage,
     const WCHAR *name;
 
     if (contents)
-        name = CONTENTS;
+        name = L"CONTENTS";
     else
         name = pres;
 
diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c
index c1045c15466..81ffa1e6dbc 100644
--- a/dlls/ole32/defaulthandler.c
+++ b/dlls/ole32/defaulthandler.c
@@ -1758,7 +1758,6 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty(
  * BYTE  data[] - moniker data for a link
  */
 
-static const WCHAR OleStream[] = {1,'O','l','e',0};
 typedef struct
 {
     DWORD version;
@@ -1774,7 +1773,7 @@ static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
     IStream *stream;
     HRESULT hr;
 
-    hr = IStorage_OpenStream(storage, OleStream, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
+    hr = IStorage_OpenStream(storage, L"\1Ole", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
 
     if(SUCCEEDED(hr))
     {
diff --git a/dlls/ole32/itemmoniker.c b/dlls/ole32/itemmoniker.c
index dee4fc0bf2d..786d183d598 100644
--- a/dlls/ole32/itemmoniker.c
+++ b/dlls/ole32/itemmoniker.c
@@ -1055,7 +1055,6 @@ failed:
 
 HRESULT WINAPI ItemMoniker_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 {
-    static const WCHAR emptyW[] = { 0 };
     IMoniker *moniker;
     HRESULT hr;
 
@@ -1066,7 +1065,7 @@ HRESULT WINAPI ItemMoniker_CreateInstance(IClassFactory *iface, IUnknown *outer,
     if (outer)
         return CLASS_E_NOAGGREGATION;
 
-    if (FAILED(hr = CreateItemMoniker(emptyW, emptyW, &moniker)))
+    if (FAILED(hr = CreateItemMoniker(L"", L"", &moniker)))
         return hr;
 
     hr = IMoniker_QueryInterface(moniker, riid, ppv);
diff --git a/dlls/ole32/moniker.c b/dlls/ole32/moniker.c
index 251c3c47849..be78eb90cf3 100644
--- a/dlls/ole32/moniker.c
+++ b/dlls/ole32/moniker.c
@@ -915,8 +915,6 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
     LONG sizeProgId, ret;
     LPOLESTR *pathDec=0,absFile=0,progId=0;
     LPWSTR extension;
-    static const WCHAR bkslashW[] = {'\\',0};
-    static const WCHAR dotW[] = {'.',0};
 
     TRACE("%s, %p\n", debugstr_w(filePathName), pclsid);
 
@@ -962,7 +960,7 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
     absFile=pathDec[nbElm-1];
 
     /* failed if the path represents a directory and not an absolute file name*/
-    if (!wcscmp(absFile, bkslashW)) {
+    if (!wcscmp(absFile, L"\\")) {
         CoTaskMemFree(pathDec);
         return MK_E_INVALIDEXTENSION;
     }
@@ -973,7 +971,7 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
     for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--)
         /* nothing */;
 
-    if (!extension || !wcscmp(extension, dotW)) {
+    if (!extension || !wcscmp(extension, L".")) {
         CoTaskMemFree(pathDec);
         return MK_E_INVALIDEXTENSION;
     }
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 4464ba07144..f2224ad5b6a 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -101,24 +101,18 @@ static LONG OLE_moduleLockCount = 0;
 /*
  * Name of our registered window class.
  */
-static const WCHAR OLEDD_DRAGTRACKERCLASS[] =
-  {'W','i','n','e','D','r','a','g','D','r','o','p','T','r','a','c','k','e','r','3','2',0};
+static const WCHAR OLEDD_DRAGTRACKERCLASS[] = L"WineDragDropTracker32";
 
 /*
  * Name of menu descriptor property.
  */
-static const WCHAR prop_olemenuW[] =
-  {'P','R','O','P','_','O','L','E','M','e','n','u','D','e','s','c','r','i','p','t','o','r',0};
+static const WCHAR prop_olemenuW[] = L"PROP_OLEMenuDescriptor";
 
 /* property to store IDropTarget pointer */
-static const WCHAR prop_oledroptarget[] =
-  {'O','l','e','D','r','o','p','T','a','r','g','e','t','I','n','t','e','r','f','a','c','e',0};
+static const WCHAR prop_oledroptarget[] = L"OleDropTargetInterface";
 
 /* property to store Marshalled IDropTarget pointer */
-static const WCHAR prop_marshalleddroptarget[] =
-  {'W','i','n','e','M','a','r','s','h','a','l','l','e','d','D','r','o','p','T','a','r','g','e','t',0};
-
-static const WCHAR emptyW[] = { 0 };
+static const WCHAR prop_marshalleddroptarget[] = L"WineMarshalledDropTarget";
 
 /******************************************************************************
  * These are the prototypes of miscellaneous utility methods
@@ -669,7 +663,6 @@ HRESULT WINAPI RevokeDragDrop(HWND hwnd)
  */
 HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
 {
-  static const WCHAR auxusertypeW[] = {'A','u','x','U','s','e','r','T','y','p','e','\\','%','d',0};
   DWORD valuetype, valuelen;
   WCHAR auxkeynameW[16];
   HKEY    usertypekey;
@@ -695,10 +688,10 @@ HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
   {
     HKEY auxkey;
 
-    swprintf(auxkeynameW, ARRAY_SIZE(auxkeynameW), auxusertypeW, form);
+    swprintf(auxkeynameW, ARRAY_SIZE(auxkeynameW), L"AuxUserType\\%d", form);
     if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK)
     {
-      if (!RegQueryValueExW(auxkey, emptyW, NULL, &valuetype, NULL, &valuelen) && valuelen)
+      if (!RegQueryValueExW(auxkey, L"", NULL, &valuetype, NULL, &valuelen) && valuelen)
       {
         RegCloseKey(usertypekey);
         usertypekey = auxkey;
@@ -709,7 +702,7 @@ HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
   }
 
   valuelen = 0;
-  if (RegQueryValueExW(usertypekey, emptyW, NULL, &valuetype, NULL, &valuelen))
+  if (RegQueryValueExW(usertypekey, L"", NULL, &valuetype, NULL, &valuelen))
   {
     RegCloseKey(usertypekey);
     return REGDB_E_READREGDB;
@@ -722,12 +715,7 @@ HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
     return E_OUTOFMEMORY;
   }
 
-  ret = RegQueryValueExW(usertypekey,
-			  emptyW,
-			  NULL,
-			  &valuetype,
-			  (LPBYTE)*usertype,
-			  &valuelen);
+  ret = RegQueryValueExW(usertypekey, L"", NULL, &valuetype, (BYTE *)*usertype, &valuelen);
   RegCloseKey(usertypekey);
   if (ret != ERROR_SUCCESS)
   {
@@ -748,7 +736,6 @@ HRESULT WINAPI DoDragDrop (
   DWORD       dwOKEffect,    /* [in] effects allowed by the source */
   DWORD       *pdwEffect)    /* [out] ptr to effects of the source */
 {
-  static const WCHAR trackerW[] = {'T','r','a','c','k','e','r','W','i','n','d','o','w',0};
   TrackerWindowInfo trackerInfo;
   HWND            hwndTrackWindow;
   MSG             msg;
@@ -772,7 +759,7 @@ HRESULT WINAPI DoDragDrop (
   trackerInfo.curTargetHWND     = 0;
   trackerInfo.curDragTarget     = 0;
 
-  hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, trackerW,
+  hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, L"TrackerWindow",
                                   WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
                                   CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0,
                                   &trackerInfo);
@@ -856,8 +843,6 @@ HRESULT WINAPI OleRegGetMiscStatus(
   DWORD    dwAspect,
   DWORD*   pdwStatus)
 {
-  static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
-  static const WCHAR dfmtW[] = {'%','d',0};
   WCHAR   keyName[16];
   HKEY    miscStatusKey;
   HKEY    aspectKey;
@@ -872,7 +857,7 @@ HRESULT WINAPI OleRegGetMiscStatus(
 
   if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
 
-  hr = COM_OpenKeyForCLSID(clsid, miscstatusW, KEY_READ, &miscStatusKey);
+  hr = COM_OpenKeyForCLSID(clsid, L"MiscStatus", KEY_READ, &miscStatusKey);
   if (FAILED(hr))
     /* missing key is not a failure */
     return hr == REGDB_E_KEYMISSING ? S_OK : hr;
@@ -882,7 +867,7 @@ HRESULT WINAPI OleRegGetMiscStatus(
   /*
    * Open the key specific to the requested aspect.
    */
-  swprintf(keyName, ARRAY_SIZE(keyName), dfmtW, dwAspect);
+  swprintf(keyName, ARRAY_SIZE(keyName), L"%d", dwAspect);
 
   result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
   if (result == ERROR_SUCCESS)
@@ -1117,11 +1102,10 @@ HRESULT WINAPI OleRegEnumVerbs (REFCLSID clsid, LPENUMOLEVERB* ppenum)
     LONG res;
     HKEY hkeyVerb;
     DWORD dwSubKeys;
-    static const WCHAR wszVerb[] = {'V','e','r','b',0};
 
     TRACE("(%s, %p)\n", debugstr_guid(clsid), ppenum);
 
-    res = COM_OpenKeyForCLSID(clsid, wszVerb, KEY_READ, &hkeyVerb);
+    res = COM_OpenKeyForCLSID(clsid, L"Verb", KEY_READ, &hkeyVerb);
     if (FAILED(res))
     {
         if (res == REGDB_E_CLASSNOTREG)
@@ -2402,12 +2386,7 @@ static void OLEUTL_ReadRegistryDWORDValue(
   DWORD dwKeyType;
   LONG  lres;
 
-  lres = RegQueryValueExW(regKey,
-			  emptyW,
-			  NULL,
-			  &dwKeyType,
-			  (LPBYTE)buffer,
-			  &cbData);
+  lres = RegQueryValueExW(regKey, L"", NULL, &dwKeyType, (BYTE *)buffer, &cbData);
 
   if (lres==ERROR_SUCCESS)
   {
@@ -2573,13 +2552,12 @@ HRESULT WINAPI OleCreate(
  */
 HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
 {
-    static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
     HKEY hkey = NULL;
     WCHAR buf[CHARS_IN_GUID];
     LONG len;
     HRESULT res = S_OK;
 
-    res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey);
+    res = COM_OpenKeyForCLSID(clsidOld, L"AutoConvertTo", KEY_READ, &hkey);
     if (FAILED(res))
         goto done;
 
@@ -2600,7 +2578,6 @@ done:
  */
 HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
 {
-    static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
     HKEY hkey = NULL;
     WCHAR szClsidNew[CHARS_IN_GUID];
     HRESULT res = S_OK;
@@ -2611,7 +2588,7 @@ HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
     if (FAILED(res))
         goto done;
     StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
-    if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR)))
+    if (RegSetValueW(hkey, L"AutoConvertTo", REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR)))
     {
         res = REGDB_E_WRITEREGDB;
 	goto done;
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index 27794c739ee..7b1cd801cf1 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -2991,10 +2991,8 @@ static const IPropertyStorageVtbl IPropertyStorage_Vtbl =
 /***********************************************************************
  * Format ID <-> name conversion
  */
-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 const WCHAR szDocSummaryInfo[] = { 5,'D','o','c','u','m','e','n','t',
- 'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0 };
+static const WCHAR szSummaryInfo[] = L"\5SummaryInformation";
+static const WCHAR szDocSummaryInfo[] = L"\5DocumentSummaryInformation";
 
 #define BITS_PER_BYTE    8
 #define CHARMASK         0x1f
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 58fb055993f..3d372af83f5 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4761,14 +4761,13 @@ static HRESULT StorageImpl_Refresh(StorageImpl *This, BOOL new_object, BOOL crea
    */
   if (create)
   {
-    static const WCHAR rootentryW[] = {'R','o','o','t',' ','E','n','t','r','y',0};
     DirEntry rootEntry;
     /*
      * Initialize the directory table
      */
     memset(&rootEntry, 0, sizeof(rootEntry));
-    lstrcpyW(rootEntry.name, rootentryW);
-    rootEntry.sizeOfNameString = sizeof(rootentryW);
+    lstrcpyW(rootEntry.name, L"Root Entry");
+    rootEntry.sizeOfNameString = sizeof(L"Root Entry");
     rootEntry.stgType          = STGTY_ROOT;
     rootEntry.leftChild        = DIRENTRY_NULL;
     rootEntry.rightChild       = DIRENTRY_NULL;
@@ -8533,7 +8532,6 @@ static HRESULT create_storagefile(
   if (pwcsName == 0)
   {
     WCHAR tempPath[MAX_PATH];
-    static const WCHAR prefix[] = { 'S', 'T', 'O', 0 };
 
     memset(tempPath, 0, sizeof(tempPath));
     memset(tempFileName, 0, sizeof(tempFileName));
@@ -8541,7 +8539,7 @@ static HRESULT create_storagefile(
     if ((GetTempPathW(MAX_PATH, tempPath)) == 0 )
       tempPath[0] = '.';
 
-    if (GetTempFileNameW(tempPath, prefix, 0, tempFileName) != 0)
+    if (GetTempFileNameW(tempPath, L"STO", 0, tempFileName) != 0)
       pwcsName = tempFileName;
     else
     {
@@ -9205,12 +9203,11 @@ HRESULT  WINAPI OleSaveToStream(IPersistStream *pPStm,IStream *pStm)
  */
 HRESULT STORAGE_CreateOleStream(IStorage *storage, DWORD flags)
 {
-    static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
     static const DWORD version_magic = 0x02000001;
     IStream *stream;
     HRESULT hr;
 
-    hr = IStorage_CreateStream(storage, stream_1oleW, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
+    hr = IStorage_CreateStream(storage, L"\1Ole", STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
     if (hr == S_OK)
     {
         struct empty_1ole_stream {
@@ -9310,7 +9307,6 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
 {
     IStream *pstm;
     HRESULT r = S_OK;
-    static const WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
 
     static const BYTE unknown1[12] =
        { 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
@@ -9324,7 +9320,7 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
            debugstr_w(szProgIDName));
 
     /*  Create a CompObj stream */
-    r = IStorage_CreateStream(pstg, szwStreamName,
+    r = IStorage_CreateStream(pstg, L"\1CompObj",
         STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pstm );
     if( FAILED (r) )
         return r;
@@ -9399,7 +9395,6 @@ HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lp
 {
     HRESULT r;
     IStream *stm = 0;
-    static const WCHAR szCompObj[] = { 1, 'C','o','m','p','O','b','j', 0 };
     unsigned char unknown1[12];
     unsigned char unknown2[16];
     DWORD count;
@@ -9408,8 +9403,7 @@ HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lp
 
     TRACE("(%p,%p,%p)\n", pstg, pcf, lplpszUserType);
 
-    r = IStorage_OpenStream( pstg, szCompObj, NULL,
-                    STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm );
+    r = IStorage_OpenStream( pstg, L"\1CompObj", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm );
     if( FAILED ( r ) )
     {
         WARN("Failed to open stream r = %08x\n", r);
@@ -9922,11 +9916,10 @@ static void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, const BYTE *pBu
     IStorage *pTempStorage;
     DWORD dwNumOfBytesWritten;
     WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH];
-    static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0};
 
     /* Create a temp File */
     GetTempPathW(MAX_PATH, wstrTempDir);
-    GetTempFileNameW(wstrTempDir, wstrPrefix, 0, wstrTempFile);
+    GetTempFileNameW(wstrTempDir, L"sis", 0, wstrTempFile);
     hFile = CreateFileW(wstrTempFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
 
     if(hFile != INVALID_HANDLE_VALUE)
@@ -9972,13 +9965,12 @@ static DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData)
     DWORD nDataLength = 0;
     IStorage *pTempStorage;
     WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH];
-    static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0};
 
     *pData = NULL;
 
     /* Create temp Storage */
     GetTempPathW(MAX_PATH, wstrTempDir);
-    GetTempFileNameW(wstrTempDir, wstrPrefix, 0, wstrTempFile);
+    GetTempFileNameW(wstrTempDir, L"sis", 0, wstrTempFile);
     hRes = StgCreateDocfile(wstrTempFile, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pTempStorage);
 
     if(hRes == S_OK)
@@ -10029,7 +10021,6 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
     IStream *pStream;
     HRESULT hStorageRes, hRes = S_OK;
     OLECONVERT_ISTORAGE_COMPOBJ IStorageCompObj;
-    static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
     WCHAR bufferW[OLESTREAM_MAX_STR_LEN];
 
     static const BYTE pCompObjUnknown1[] = {0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF};
@@ -10042,7 +10033,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
 
 
     /*  Create a CompObj stream if it doesn't exist */
-    hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName,
+    hStorageRes = IStorage_CreateStream(pStorage, L"\1CompObj",
         STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
     if(hStorageRes == S_OK)
     {
@@ -10130,7 +10121,6 @@ static void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX,
 {
     HRESULT hRes;
     IStream *pStream;
-    static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
     static const BYTE pOlePresStreamHeader[] =
     {
         0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
@@ -10148,7 +10138,7 @@ static void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX,
     };
 
     /* Create the OlePres000 Stream */
-    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
+    hRes = IStorage_CreateStream(pStorage, L"\2OlePres000",
         STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
 
     if(hRes == S_OK)
@@ -10214,10 +10204,9 @@ static void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, const BYTE *p
 {
     HRESULT hRes;
     IStream *pStream;
-    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
 
     /* Create the Ole10Native Stream */
-    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
+    hRes = IStorage_CreateStream(pStorage, L"\1Ole10Native",
         STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
 
     if(hRes == S_OK)
@@ -10255,10 +10244,9 @@ static HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DW
     IStream *pStream;
     LARGE_INTEGER iSeekPos;
     OLECONVERT_ISTORAGE_COMPOBJ CompObj;
-    static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
 
     /* Open the CompObj Stream */
-    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
+    hRes = IStorage_OpenStream(pStorage, L"\1CompObj", NULL,
         STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
     if(hRes == S_OK)
     {
@@ -10325,7 +10313,6 @@ static void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM
 
     HRESULT hRes;
     IStream *pStream;
-    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
 
     /* Initialize Default data for OLESTREAM */
     pOleStreamData[0].dwOleID = OLESTREAM_ID;
@@ -10338,7 +10325,7 @@ static void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM
     pOleStreamData[1].pData = NULL;
 
     /* Open Ole10Native Stream */
-    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
+    hRes = IStorage_OpenStream(pStorage, L"\1Ole10Native", NULL,
         STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
     if(hRes == S_OK)
     {
@@ -10378,7 +10365,6 @@ static void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM
     HRESULT hRes;
     IStream *pStream;
     OLECONVERT_ISTORAGE_OLEPRES olePress;
-    static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
 
     /* Initialize Default data for OLESTREAM */
     pOleStreamData[0].dwOleID = OLESTREAM_ID;
@@ -10397,7 +10383,7 @@ static void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM
 
 
     /* Open OlePress000 stream */
-    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
+    hRes = IStorage_OpenStream(pStorage, L"\2OlePres000", NULL,
         STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
     if(hRes == S_OK)
     {
@@ -10555,7 +10541,6 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM (
     HRESULT hRes = S_OK;
     IStream *pStream;
     OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
-    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
 
     TRACE("%p %p\n", pstg, pOleStream);
 
@@ -10574,7 +10559,7 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM (
     if(hRes == S_OK)
     {
         /* Was it originally Ole10 */
-        hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
+        hRes = IStorage_OpenStream(pstg, L"\1Ole10Native", 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
         if(hRes == S_OK)
         {
             IStream_Release(pStream);
@@ -10615,7 +10600,6 @@ enum stream_1ole_flags {
  */
 HRESULT WINAPI GetConvertStg(IStorage *stg)
 {
-    static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
     static const DWORD version_magic = 0x02000001;
     DWORD header[2];
     IStream *stream;
@@ -10625,7 +10609,7 @@ HRESULT WINAPI GetConvertStg(IStorage *stg)
 
     if (!stg) return E_INVALIDARG;
 
-    hr = IStorage_OpenStream(stg, stream_1oleW, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
+    hr = IStorage_OpenStream(stg, L"\1Ole", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
     if (FAILED(hr)) return hr;
 
     hr = IStream_Read(stream, header, sizeof(header), NULL);
@@ -10646,7 +10630,6 @@ HRESULT WINAPI GetConvertStg(IStorage *stg)
  */
 HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
 {
-    static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
     DWORD flags = convert ? OleStream_Convert : 0;
     IStream *stream;
     DWORD header[2];
@@ -10654,7 +10637,7 @@ HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
 
     TRACE("(%p, %d)\n", storage, convert);
 
-    hr = IStorage_OpenStream(storage, stream_1oleW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream);
+    hr = IStorage_OpenStream(storage, L"\1Ole", NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream);
     if (FAILED(hr))
     {
         if (hr != STG_E_FILENOTFOUND)
-- 
2.26.2




More information about the wine-devel mailing list