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

Alexandre Julliard julliard at winehq.org
Thu Dec 3 15:35:58 CST 2020


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu Dec  3 00:32:51 2020 +0100

mapi32: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mapi32/tests/prop.c | 10 +++++-----
 dlls/mapi32/util.c       | 20 ++++++--------------
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/dlls/mapi32/tests/prop.c b/dlls/mapi32/tests/prop.c
index 5bbddb3809c..61ec5f16a9f 100644
--- a/dlls/mapi32/tests/prop.c
+++ b/dlls/mapi32/tests/prop.c
@@ -102,7 +102,7 @@ static ULONG ptTypes[] = {
 static void test_PropCopyMore(void)
 {
     static char szHiA[] = "Hi!";
-    static WCHAR szHiW[] = { 'H', 'i', '!', '\0' };
+    static WCHAR szHiW[] = L"Hi!";
     SPropValue *lpDest = NULL, *lpSrc = NULL;
     ULONG i;
     SCODE scode;
@@ -182,7 +182,7 @@ static void test_PropCopyMore(void)
 static void test_UlPropSize(void)
 {
     static char szHiA[] = "Hi!";
-    static WCHAR szHiW[] = { 'H', 'i', '!', '\0' };
+    static WCHAR szHiW[] = L"Hi!";
     LPSTR  buffa[2];
     LPWSTR buffw[2];
     SBinary buffbin[2];
@@ -702,7 +702,7 @@ static void test_PpropFindProp(void)
 static void test_ScCountProps(void)
 {
     static char szHiA[] = "Hi!";
-    static WCHAR szHiW[] = { 'H', 'i', '!', '\0' };
+    static WCHAR szHiW[] = L"Hi!";
     static const ULONG ULHILEN = 4; /* chars in szHiA/W incl. NUL */
     LPSTR  buffa[3];
     LPWSTR buffw[3];
@@ -971,7 +971,7 @@ static void test_FBadRglpszA(void)
 static void test_FBadRglpszW(void)
 {
     LPWSTR lpStrs[4];
-    static WCHAR szString[] = { 'A',' ','S','t','r','i','n','g','\0' };
+    static WCHAR szString[] = L"A String";
     BOOL bRet;
 
     if (!pFBadRglpszW)
@@ -1063,7 +1063,7 @@ static void test_FBadRow(void)
 
 static void test_FBadProp(void)
 {
-    static WCHAR szEmpty[] = { '\0' };
+    static WCHAR szEmpty[] = L"";
     GUID iid;
     ULONG pt, res;
     SPropValue pv;
diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c
index 7e324a0e650..8f0036e6873 100644
--- a/dlls/mapi32/util.c
+++ b/dlls/mapi32/util.c
@@ -966,8 +966,6 @@ static HMODULE mapi_ex_provider;
  */
 static void load_mapi_provider(HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_provider)
 {
-    static const WCHAR mapi32_dll[] = {'m','a','p','i','3','2','.','d','l','l',0 };
-
     DWORD dwType, dwLen = 0;
     LPWSTR dllPath;
 
@@ -982,7 +980,7 @@ static void load_mapi_provider(HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_p
             RegQueryValueExW(hkeyMail, valueName, NULL, NULL, (LPBYTE)dllPath, &dwLen);
 
             /* Check that this value doesn't refer to mapi32.dll (eg, as Outlook does) */
-            if (lstrcmpiW(dllPath, mapi32_dll) != 0)
+            if (lstrcmpiW(dllPath, L"mapi32.dll") != 0)
             {
                 if (dwType == REG_EXPAND_SZ)
                 {
@@ -1022,13 +1020,7 @@ static void load_mapi_provider(HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_p
  */
 void load_mapi_providers(void)
 {
-    static const WCHAR regkey_mail[] = {
-        'S','o','f','t','w','a','r','e','\\','C','l','i','e','n','t','s','\\',
-        'M','a','i','l',0 };
-
-    static const WCHAR regkey_dllpath[] = {'D','L','L','P','a','t','h',0 };
-    static const WCHAR regkey_dllpath_ex[] = {'D','L','L','P','a','t','h','E','x',0 };
-    static const WCHAR regkey_backslash[] = { '\\', 0 };
+    static const WCHAR regkey_mail[] = L"Software\\Clients\\Mail";
 
     HKEY hkeyMail;
     DWORD dwType, dwLen = 0;
@@ -1056,13 +1048,13 @@ void load_mapi_providers(void)
     TRACE("appName: %s\n", debugstr_w(appName));
 
     appKey = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(regkey_mail) +
-        lstrlenW(regkey_backslash) + lstrlenW(appName) + 1));
+        lstrlenW(L"\\") + lstrlenW(appName) + 1));
 
     if (!appKey)
         goto cleanUp;
 
     lstrcpyW(appKey, regkey_mail);
-    lstrcatW(appKey, regkey_backslash);
+    lstrcatW(appKey, L"\\");
     lstrcatW(appKey, appName);
 
     RegCloseKey(hkeyMail);
@@ -1074,8 +1066,8 @@ void load_mapi_providers(void)
         goto cleanUp;
 
     /* Try to load the providers */
-    load_mapi_provider(hkeyMail, regkey_dllpath, &mapi_provider);
-    load_mapi_provider(hkeyMail, regkey_dllpath_ex, &mapi_ex_provider);
+    load_mapi_provider(hkeyMail, L"DLLPath", &mapi_provider);
+    load_mapi_provider(hkeyMail, L"DLLPathEx", &mapi_ex_provider);
 
     /* Now try to load our function pointers */
     ZeroMemory(&mapiFunctions, sizeof(mapiFunctions));




More information about the wine-cvs mailing list