Lei Zhang : advapi32: Replace UuidToStringW call with a sprintfW.

Alexandre Julliard julliard at winehq.org
Tue Apr 29 08:54:17 CDT 2008


Module: wine
Branch: master
Commit: 9fca0f27d02d88c6e8f1f8ef870ae59838eeb51d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9fca0f27d02d88c6e8f1f8ef870ae59838eeb51d

Author: Lei Zhang <thestig at google.com>
Date:   Mon Apr 28 11:36:39 2008 -0700

advapi32: Replace UuidToStringW call with a sprintfW.

---

 dlls/advapi32/crypt.c |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
index 0fadc78..5dcb709 100644
--- a/dlls/advapi32/crypt.c
+++ b/dlls/advapi32/crypt.c
@@ -294,20 +294,31 @@ static void CRYPT_CreateMachineGuid(void)
 			if (lib)
 			{
 				RPC_STATUS (RPC_ENTRY *pUuidCreate)(UUID *);
-				RPC_STATUS (RPC_ENTRY *pUuidToString)(UUID *, WCHAR **);
-				RPC_STATUS (RPC_ENTRY *pRpcStringFree)(WCHAR **);
 				UUID uuid;
-				WCHAR *uuidStr;
+                                WCHAR buf[37];
+                                RPC_STATUS rs;
+                                static const WCHAR uuidFmt[] = {
+                                    '%','0','8','x','-','%','0','4','x','-',
+                                    '%','0','4','x','-','%','0','2','x',
+                                    '%','0','2','x','-','%','0','2','x',
+                                    '%','0','2','x','%','0','2','x',
+                                    '%','0','2','x','%','0','2','x',
+                                    '%','0','2','x',0 };
 
 				pUuidCreate = GetProcAddress(lib, "UuidCreate");
-				pUuidToString = GetProcAddress(lib, "UuidToStringW");
-				pRpcStringFree = GetProcAddress(lib, "RpcStringFreeW");
-				pUuidCreate(&uuid);
-				pUuidToString(&uuid, &uuidStr);
-				RegSetValueExW(key, machineGuidW, 0, REG_SZ,
-					       (const BYTE *)uuidStr,
-					       (lstrlenW(uuidStr)+1)*sizeof(WCHAR));
-				pRpcStringFree(&uuidStr);
+                                rs = pUuidCreate(&uuid);
+                                if (rs == S_OK)
+                                {
+                                    sprintfW(buf, uuidFmt,
+                                             uuid.Data1, uuid.Data2, uuid.Data3,
+                                             uuid.Data4[0], uuid.Data4[1],
+                                             uuid.Data4[2], uuid.Data4[3],
+                                             uuid.Data4[4], uuid.Data4[5],
+                                             uuid.Data4[6], uuid.Data4[7] );
+                                    RegSetValueExW(key, machineGuidW, 0, REG_SZ,
+                                                   (const BYTE *)buf,
+                                                   (lstrlenW(buf)+1)*sizeof(WCHAR));
+                                }
 				FreeLibrary(lib);
 			}
 		}




More information about the wine-cvs mailing list