Michael Stefaniuc : shdocvw: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 15:40:36 CST 2020


Module: wine
Branch: master
Commit: 447924a6d68f7919bd451661314a52aa99cab709
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=447924a6d68f7919bd451661314a52aa99cab709

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Sun Nov 29 23:30:31 2020 +0100

shdocvw: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shdocvw/shdocvw_main.c   |  7 ++-----
 dlls/shdocvw/shlinstobj.c     | 11 +++--------
 dlls/shdocvw/tests/shortcut.c |  4 +---
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/dlls/shdocvw/shdocvw_main.c b/dlls/shdocvw/shdocvw_main.c
index ac3913dd239..8c5dd8279c7 100644
--- a/dlls/shdocvw/shdocvw_main.c
+++ b/dlls/shdocvw/shdocvw_main.c
@@ -43,10 +43,8 @@ static HINSTANCE ieframe_instance;
 
 static HINSTANCE get_ieframe_instance(void)
 {
-    static const WCHAR ieframe_dllW[] = {'i','e','f','r','a','m','e','.','d','l','l',0};
-
     if(!ieframe_instance)
-        ieframe_instance = LoadLibraryW(ieframe_dllW);
+        ieframe_instance = LoadLibraryW(L"ieframe.dll");
 
     return ieframe_instance;
 }
@@ -276,10 +274,9 @@ DWORD WINAPI SetQueryNetSessionCount(DWORD arg)
 
 static void* fetch_shlwapi_ordinal(UINT_PTR ord)
 {
-    static const WCHAR shlwapiW[] = {'s','h','l','w','a','p','i','.','d','l','l','\0'};
     static HANDLE h;
 
-    if (!h && !(h = GetModuleHandleW(shlwapiW))) return NULL;
+    if (!h && !(h = GetModuleHandleW(L"shlwapi.dll"))) return NULL;
     return (void*)GetProcAddress(h, (const char*)ord);
 }
 
diff --git a/dlls/shdocvw/shlinstobj.c b/dlls/shdocvw/shlinstobj.c
index 189c27cad58..f148a27619e 100644
--- a/dlls/shdocvw/shlinstobj.c
+++ b/dlls/shdocvw/shlinstobj.c
@@ -357,12 +357,7 @@ static HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *
 HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, REFIID riid, 
     LPVOID *ppvClassObj)
 {
-    WCHAR wszInstanceKey[] = { 'C','L','S','I','D','\\','{','0','0','0','0','0','0','0','0','-',
-        '0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0',
-        '0','0','0','0','}','\\','I','n','s','t','a','n','c','e', 0 };
-    static const WCHAR wszCLSID[] = { 'C','L','S','I','D',0 };
-    static const WCHAR wszInitPropertyBag[] =
-        { 'I','n','i','t','P','r','o','p','e','r','t','y','B','a','g',0 };
+    WCHAR wszInstanceKey[] = L"CLSID\\{00000000-0000-0000-0000-000000000000}\\Instance";
     WCHAR wszCLSIDInstance[CHARS_IN_GUID];
     CLSID clsidInstance;
     HKEY hInstanceKey, hInitPropertyBagKey;
@@ -382,7 +377,7 @@ HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, REFIID riid,
         /* If there is no 'Instance' subkey, then it's not a Shell Instance Object. */
         return CLASS_E_CLASSNOTAVAILABLE;
 
-    if (ERROR_SUCCESS != RegQueryValueExW(hInstanceKey, wszCLSID, NULL, &dwType, (LPBYTE)wszCLSIDInstance, &cbBytes) ||
+    if (ERROR_SUCCESS != RegQueryValueExW(hInstanceKey, L"CLSID", NULL, &dwType, (BYTE *)wszCLSIDInstance, &cbBytes) ||
         FAILED(CLSIDFromString(wszCLSIDInstance, &clsidInstance)))
     {
         /* 'Instance' should have a 'CLSID' value with a well-formed clsid-string. */
@@ -392,7 +387,7 @@ HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, REFIID riid,
     }
 
     /* Try to open the 'InitPropertyBag' subkey. */
-    res = RegOpenKeyExW(hInstanceKey, wszInitPropertyBag, 0, KEY_READ, &hInitPropertyBagKey);
+    res = RegOpenKeyExW(hInstanceKey, L"InitPropertyBag", 0, KEY_READ, &hInitPropertyBagKey);
     RegCloseKey(hInstanceKey);
     if (res != ERROR_SUCCESS) {
         /* Besides 'InitPropertyBag's, shell instance objects might be initialized by streams.
diff --git a/dlls/shdocvw/tests/shortcut.c b/dlls/shdocvw/tests/shortcut.c
index cb62c25892a..5cf1c4bad7f 100644
--- a/dlls/shdocvw/tests/shortcut.c
+++ b/dlls/shdocvw/tests/shortcut.c
@@ -165,9 +165,7 @@ static void test_ShortcutFolder(void) {
     CLSID clsid;
     const CLSID CLSID_WineTest = 
         { 0x9b352ebf, 0x2765, 0x45c1, { 0xb4, 0xc6, 0x85, 0xcc, 0x7f, 0x7a, 0xbc, 0x64 } };
-    WCHAR wszWineTestFolder[] = {
-        ':',':','{','9','B','3','5','2','E','B','F','-','2','7','6','5','-','4','5','C','1','-',
-        'B','4','C','6','-','8','5','C','C','7','F','7','A','B','C','6','4','}',0 };
+    static WCHAR wszWineTestFolder[] = L"::{9B352EBF-2765-45C1-B4C6-85CC7F7ABC64}";
 
     /* First, we register all the necessary registry keys/values for our 'WineTest'
      * shell object. */




More information about the wine-cvs mailing list