Some advapi HEAP_strdupAtoW fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ChangeLog:
	Remove some calls to HEAP_strdupAtoW from advapi32.

-- 
Matthew Davison <m.davison@virgin.net>
Index: dlls/advapi32/eventlog.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/eventlog.c,v
retrieving revision 1.16
diff -u -r1.16 eventlog.c
--- dlls/advapi32/eventlog.c	25 Oct 2002 19:17:33 -0000	1.16
+++ dlls/advapi32/eventlog.c	16 Jan 2003 19:34:26 -0000
@@ -22,6 +22,7 @@
 #include "windef.h"
 #include "winerror.h"
 #include "heap.h"
+#include "winternl.h"
 
 #include "wine/debug.h"
 
@@ -216,11 +217,14 @@
  */
 HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
 {
-    LPWSTR lpUNCServerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpUNCServerName);
-    LPWSTR lpSourceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpSourceName);
-    HANDLE ret = RegisterEventSourceW(lpUNCServerNameW,lpSourceNameW);
-    HeapFree(GetProcessHeap(),0,lpSourceNameW);
-    HeapFree(GetProcessHeap(),0,lpUNCServerNameW);
+    
+    UNICODE_STRING lpUNCServerNameW;
+    UNICODE_STRING lpSourceNameW;
+    RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
+    RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
+    HANDLE ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
+    RtlFreeUnicodeString (&lpUNCServerNameW);
+    RtlFreeUnicodeString (&lpSourceNameW);
     return ret;
 }
 
Index: dlls/advapi32/registry.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/registry.c,v
retrieving revision 1.49
diff -u -r1.49 registry.c
--- dlls/advapi32/registry.c	25 Nov 2002 02:47:32 -0000	1.49
+++ dlls/advapi32/registry.c	16 Jan 2003 19:34:30 -0000
@@ -36,6 +36,7 @@
 #include "heap.h"
 #include "wine/server.h"
 #include "wine/debug.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(reg);
 
@@ -1636,9 +1637,10 @@
  */
 LONG WINAPI RegRestoreKeyA( HKEY hkey, LPCSTR lpFile, DWORD dwFlags )
 {
-    LPWSTR lpFileW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpFile );
-    LONG ret = RegRestoreKeyW( hkey, lpFileW, dwFlags );
-    HeapFree( GetProcessHeap(), 0, lpFileW );
+    UNICODE_STRING lpFileW;
+    RtlCreateUnicodeStringFromAsciiz( &lpFileW, lpFile );
+    LONG ret = RegRestoreKeyW( hkey, lpFileW.Buffer, dwFlags );
+    RtlFreeUnicodeString( &lpFileW );
     return ret;
 }
 
@@ -1662,9 +1664,10 @@
  */
 LONG WINAPI RegUnLoadKeyA( HKEY hkey, LPCSTR lpSubKey )
 {
-    LPWSTR lpSubKeyW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpSubKey );
-    LONG ret = RegUnLoadKeyW( hkey, lpSubKeyW );
-    if(lpSubKeyW) HeapFree( GetProcessHeap(), 0, lpSubKeyW);
+    UNICODE_STRING lpSubKeyW;
+    RtlCreateUnicodeStringFromAsciiz( &lpSubKeyW, lpSubKey );
+    LONG ret = RegUnLoadKeyW( hkey, lpSubKeyW.Buffer );
+    RtlFreeUnicodeString( &lpSubKeyW );
     return ret;
 }
 
@@ -1693,13 +1696,16 @@
 LONG WINAPI RegReplaceKeyA( HKEY hkey, LPCSTR lpSubKey, LPCSTR lpNewFile,
                               LPCSTR lpOldFile )
 {
-    LPWSTR lpSubKeyW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpSubKey );
-    LPWSTR lpNewFileW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpNewFile );
-    LPWSTR lpOldFileW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpOldFile );
-    LONG ret = RegReplaceKeyW( hkey, lpSubKeyW, lpNewFileW, lpOldFileW );
-    HeapFree( GetProcessHeap(), 0, lpOldFileW );
-    HeapFree( GetProcessHeap(), 0, lpNewFileW );
-    HeapFree( GetProcessHeap(), 0, lpSubKeyW );
+    UNICODE_STRING lpSubKeyW;
+    UNICODE_STRING lpNewFileW;
+    UNICODE_STRING lpOldFileW;
+    RtlCreateUnicodeStringFromAsciiz( &lpSubKeyW, lpSubKey );
+    RtlCreateUnicodeStringFromAsciiz( &lpOldFileW, lpOldFile );
+    RtlCreateUnicodeStringFromAsciiz( &lpNewFileW, lpNewFile );
+    LONG ret = RegReplaceKeyW( hkey, lpSubKeyW.Buffer, lpNewFileW.Buffer, lpOldFileW.Buffer );
+    RtlFreeUnicodeString( &lpOldFileW );
+    RtlFreeUnicodeString( &lpNewFileW );
+    RtlFreeUnicodeString( &lpSubKeyW );
     return ret;
 }
 
@@ -1820,9 +1826,10 @@
  */
 LONG WINAPI RegConnectRegistryA( LPCSTR machine, HKEY hkey, PHKEY reskey )
 {
-    LPWSTR machineW = HEAP_strdupAtoW( GetProcessHeap(), 0, machine );
-    DWORD ret = RegConnectRegistryW( machineW, hkey, reskey );
-    HeapFree( GetProcessHeap(), 0, machineW );
+    UNICODE_STRING machineW;
+    RtlCreateUnicodeStringFromAsciiz( &machineW, machine );
+    DWORD ret = RegConnectRegistryW( machineW.Buffer, hkey, reskey );
+    RtlFreeUnicodeString( &machineW );
     return ret;
 }
 
Index: dlls/advapi32/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/security.c,v
retrieving revision 1.48
diff -u -r1.48 security.c
--- dlls/advapi32/security.c	19 Dec 2002 04:15:23 -0000	1.48
+++ dlls/advapi32/security.c	16 Jan 2003 19:34:32 -0000
@@ -634,13 +634,15 @@
 BOOL WINAPI
 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid )
 {
-    LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
-    LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
+    UNICODE_STRING lpSystemNameW;
+    UNICODE_STRING lpNameW;
+    RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
+    RtlCreateUnicodeStringFromAsciiz(&lpNameW,lpName);
     BOOL ret;
 
-    ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
-    HeapFree(GetProcessHeap(), 0, lpNameW);
-    HeapFree(GetProcessHeap(), 0, lpSystemNameW);
+    ret = LookupPrivilegeValueW(lpSystemNameW.Buffer, lpNameW.Buffer, lpLuid);
+    RtlFreeUnicodeString(&lpNameW);
+    RtlFreeUnicodeString(&lpSystemNameW);
     return ret;
 }
 
Index: dlls/advapi32/service.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/service.c,v
retrieving revision 1.33
diff -u -r1.33 service.c
--- dlls/advapi32/service.c	14 Jan 2003 19:31:44 -0000	1.33
+++ dlls/advapi32/service.c	16 Jan 2003 19:34:33 -0000
@@ -28,6 +28,7 @@
 #include "wine/unicode.h"
 #include "heap.h"
 #include "wine/debug.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
 
@@ -234,12 +235,14 @@
 OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName,
                   DWORD dwDesiredAccess )
 {
-    LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName);
-    LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName);
-    SC_HANDLE ret = OpenSCManagerW(lpMachineNameW,lpDatabaseNameW,
+    UNICODE_STRING lpMachineNameW;
+    UNICODE_STRING lpDatabaseNameW;
+    RtlCreateUnicodeStringFromAsciiz (&lpMachineNameW,lpMachineName);
+    RtlCreateUnicodeStringFromAsciiz (&lpDatabaseNameW,lpDatabaseName);
+    SC_HANDLE ret = OpenSCManagerW(lpMachineNameW.Buffer,lpDatabaseNameW.Buffer,
                                  dwDesiredAccess);
-    HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
-    HeapFree(GetProcessHeap(),0,lpMachineNameW);
+    RtlFreeUnicodeString(&lpDatabaseNameW);
+    RtlFreeUnicodeString(&lpMachineNameW);
     return ret;
 }
 
@@ -347,15 +350,15 @@
 OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
                 DWORD dwDesiredAccess )
 {
-    LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName);
+    UNICODE_STRING lpServiceNameW;
     SC_HANDLE ret;
-
+    RtlCreateUnicodeStringFromAsciiz (&lpServiceNameW,lpServiceName);
     if(lpServiceName)
         TRACE("Request for service %s\n",lpServiceName);
     else
         return FALSE;
-    ret = OpenServiceW( hSCManager, lpServiceNameW, dwDesiredAccess);
-    HeapFree(GetProcessHeap(),0,lpServiceNameW);
+    ret = OpenServiceW( hSCManager, lpServiceNameW.Buffer, dwDesiredAccess);
+    RtlFreeUnicodeString(&lpServiceNameW);
     return ret;
 }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux