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

Alexandre Julliard julliard at winehq.org
Thu Oct 1 15:50:30 CDT 2020


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Sep 30 23:14:56 2020 +0200

dplayx: Use wide-char string literals.

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

---

 dlls/dplayx/dplay.c        | 18 +++++-------------
 dlls/dplayx/tests/dplayx.c | 14 +++-----------
 2 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index e2464f8013..7a796735ce 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -5770,14 +5770,6 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
                                      LPVOID lpContext)
 {
     HKEY   hkResult;
-    static const WCHAR searchSubKey[] = {
-	'S', 'O', 'F', 'T', 'W', 'A', 'R', 'E', '\\',
-	'M', 'i', 'c', 'r', 'o', 's', 'o', 'f', 't', '\\',
-	'D', 'i', 'r', 'e', 'c', 't', 'P', 'l', 'a', 'y', '\\',
-	'S', 'e', 'r', 'v', 'i', 'c', 'e', ' ', 'P', 'r', 'o', 'v', 'i', 'd', 'e', 'r', 's', 0 };
-    static const WCHAR guidKey[] = { 'G', 'u', 'i', 'd', 0 };
-    static const WCHAR descW[] = { 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', 'W', 0 };
-    
     DWORD  dwIndex;
     FILETIME filetime;
 
@@ -5797,7 +5789,7 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
     }
     
     /* Need to loop over the service providers in the registry */
-    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, searchSubKey,
+    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectPlay\\Service Providers",
 		      0, KEY_READ, &hkResult) != ERROR_SUCCESS)
     {
 	/* Hmmm. Does this mean that there are no service providers? */
@@ -5854,7 +5846,7 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
 	}
 	
 	/* Get the GUID from the registry */
-	if (RegQueryValueExW(hkServiceProvider, guidKey,
+        if (RegQueryValueExW(hkServiceProvider, L"Guid",
 			     NULL, NULL, (LPBYTE) guidKeyContent, &sizeOfGuidKeyContent) != ERROR_SUCCESS)
 	{
 	    ERR(": missing GUID registry data member for service provider %s.\n", debugstr_w(subKeyName));
@@ -5899,8 +5891,8 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
 	else
 	{
 	    DWORD sizeOfDescription = 0;
-	    
-	    if (RegQueryValueExW(hkServiceProvider, descW,
+
+            if (RegQueryValueExW(hkServiceProvider, L"DescriptionW",
 				 NULL, NULL, NULL, &sizeOfDescription) != ERROR_SUCCESS)
 	    {
 		ERR(": missing 'DescriptionW' registry data member for service provider %s.\n", debugstr_w(subKeyName));
@@ -5912,7 +5904,7 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
 		max_sizeOfDescriptionW = sizeOfDescription;
 	    }
 	    descriptionW = HeapAlloc(GetProcessHeap(), 0, sizeOfDescription);
-	    RegQueryValueExW(hkServiceProvider, descW,
+            RegQueryValueExW(hkServiceProvider, L"DescriptionW",
 			     NULL, NULL, (LPBYTE) descriptionW, &sizeOfDescription);
 
 	    if (!lpEnumCallbackW(&guid_cache[dwIndex], descriptionW, 6, 0, lpContext))
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c
index ea6525fa38..d71df8838f 100644
--- a/dlls/dplayx/tests/dplayx.c
+++ b/dlls/dplayx/tests/dplayx.c
@@ -6764,13 +6764,6 @@ done:
 
 static HRESULT set_firewall( enum firewall_op op )
 {
-    static const WCHAR dplaysvrW[] =
-        {'d','p','l','a','y','s','v','r','.','e','x','e',0};
-    static const WCHAR separator[] = {'\\',0};
-    static const WCHAR clientW[] =
-        {'d','p','l','a','y','_','c','l','i','e','n','t',0};
-    static const WCHAR serverW[] =
-        {'d','p','l','a','y','_','s','e','r','v','e','r',0};
     HRESULT hr, init;
     INetFwMgr *mgr = NULL;
     INetFwPolicy *policy = NULL;
@@ -6791,8 +6784,7 @@ static HRESULT set_firewall( enum firewall_op op )
         SysFreeString( image );
         return E_FAIL;
     }
-    lstrcatW(path, separator);
-    lstrcatW(path, dplaysvrW);
+    lstrcatW( path, L"\\dplaysvr.exe" );
 
     init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
 
@@ -6820,7 +6812,7 @@ static HRESULT set_firewall( enum firewall_op op )
     hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
     if (hr != S_OK) goto done;
 
-    name = SysAllocString( clientW );
+    name = SysAllocString( L"dplay_client" );
     hr = INetFwAuthorizedApplication_put_Name( app, name );
     SysFreeString( name );
     ok( hr == S_OK, "got %08x\n", hr );
@@ -6845,7 +6837,7 @@ static HRESULT set_firewall( enum firewall_op op )
     hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
     if (hr != S_OK) goto done;
 
-    name = SysAllocString( serverW );
+    name = SysAllocString( L"dplay_server" );
     hr = INetFwAuthorizedApplication_put_Name( app, name );
     SysFreeString( name );
     ok( hr == S_OK, "got %08x\n", hr );




More information about the wine-cvs mailing list