Commit 6f2a071d authored by Matthew Davison's avatar Matthew Davison Committed by Alexandre Julliard

Remove some calls to HEAP_strdupAtoW from advapi32.

parent 0c391fe3
......@@ -22,6 +22,7 @@
#include "windef.h"
#include "winerror.h"
#include "heap.h"
#include "winternl.h"
#include "wine/debug.h"
......@@ -216,11 +217,15 @@ ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
*/
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;
HANDLE ret;
RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
RtlFreeUnicodeString (&lpUNCServerNameW);
RtlFreeUnicodeString (&lpSourceNameW);
return ret;
}
......
......@@ -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,12 @@ LONG WINAPI RegRestoreKeyW( HKEY hkey, LPCWSTR lpFile, DWORD dwFlags )
*/
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;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &lpFileW, lpFile );
ret = RegRestoreKeyW( hkey, lpFileW.Buffer, dwFlags );
RtlFreeUnicodeString( &lpFileW );
return ret;
}
......@@ -1662,9 +1666,12 @@ LONG WINAPI RegUnLoadKeyW( HKEY hkey, LPCWSTR lpSubKey )
*/
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;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &lpSubKeyW, lpSubKey );
ret = RegUnLoadKeyW( hkey, lpSubKeyW.Buffer );
RtlFreeUnicodeString( &lpSubKeyW );
return ret;
}
......@@ -1693,13 +1700,18 @@ LONG WINAPI RegReplaceKeyW( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpNewFile,
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;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &lpSubKeyW, lpSubKey );
RtlCreateUnicodeStringFromAsciiz( &lpOldFileW, lpOldFile );
RtlCreateUnicodeStringFromAsciiz( &lpNewFileW, lpNewFile );
ret = RegReplaceKeyW( hkey, lpSubKeyW.Buffer, lpNewFileW.Buffer, lpOldFileW.Buffer );
RtlFreeUnicodeString( &lpOldFileW );
RtlFreeUnicodeString( &lpNewFileW );
RtlFreeUnicodeString( &lpSubKeyW );
return ret;
}
......@@ -1820,9 +1832,12 @@ LONG WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey,
*/
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;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &machineW, machine );
ret = RegConnectRegistryW( machineW.Buffer, hkey, reskey );
RtlFreeUnicodeString( &machineW );
return ret;
}
......
......@@ -634,13 +634,15 @@ LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid )
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;
BOOL ret;
ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
HeapFree(GetProcessHeap(), 0, lpNameW);
HeapFree(GetProcessHeap(), 0, lpSystemNameW);
RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
RtlCreateUnicodeStringFromAsciiz(&lpNameW,lpName);
ret = LookupPrivilegeValueW(lpSystemNameW.Buffer, lpNameW.Buffer, lpLuid);
RtlFreeUnicodeString(&lpNameW);
RtlFreeUnicodeString(&lpSystemNameW);
return ret;
}
......
......@@ -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,15 @@ SC_HANDLE WINAPI
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,
dwDesiredAccess);
HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
HeapFree(GetProcessHeap(),0,lpMachineNameW);
UNICODE_STRING lpMachineNameW;
UNICODE_STRING lpDatabaseNameW;
SC_HANDLE ret;
RtlCreateUnicodeStringFromAsciiz (&lpMachineNameW,lpMachineName);
RtlCreateUnicodeStringFromAsciiz (&lpDatabaseNameW,lpDatabaseName);
ret = OpenSCManagerW(lpMachineNameW.Buffer,lpDatabaseNameW.Buffer, dwDesiredAccess);
RtlFreeUnicodeString(&lpDatabaseNameW);
RtlFreeUnicodeString(&lpMachineNameW);
return ret;
}
......@@ -347,15 +351,15 @@ SC_HANDLE WINAPI
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment