From: Alex Henrie alexhenrie24@gmail.com
--- dlls/nsi/nsi.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/dlls/nsi/nsi.c b/dlls/nsi/nsi.c index 5dc54d0035f..499d58ee79d 100644 --- a/dlls/nsi/nsi.c +++ b/dlls/nsi/nsi.c @@ -25,7 +25,6 @@ #include "iptypes.h" #include "netiodef.h" #include "wine/nsi.h" -#include "wine/heap.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi); @@ -82,7 +81,7 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR { if (sizes[i]) { - data[i] = heap_alloc( sizes[i] * num ); + data[i] = malloc( sizes[i] * num ); if (!data[i]) { err = ERROR_OUTOFMEMORY; @@ -174,7 +173,7 @@ DWORD WINAPI NsiEnumerateObjectsAllParametersEx( struct nsi_enumerate_all_ex *pa out_size = sizeof(DWORD) + (params->key_size + params->rw_size + params->dynamic_size + params->static_size) * params->count;
- out = heap_alloc( out_size ); + out = malloc( out_size ); if (!out) return ERROR_OUTOFMEMORY;
in.module = *params->module; @@ -202,7 +201,7 @@ DWORD WINAPI NsiEnumerateObjectsAllParametersEx( struct nsi_enumerate_all_ex *pa if (params->static_size) memcpy( params->static_data, ptr, params->static_size * params->count ); }
- heap_free( out ); + free( out );
return err; } @@ -210,10 +209,10 @@ DWORD WINAPI NsiEnumerateObjectsAllParametersEx( struct nsi_enumerate_all_ex *pa void WINAPI NsiFreeTable( void *key_data, void *rw_data, void *dynamic_data, void *static_data ) { TRACE( "%p %p %p %p\n", key_data, rw_data, dynamic_data, static_data ); - heap_free( key_data ); - heap_free( rw_data ); - heap_free( dynamic_data ); - heap_free( static_data ); + free( key_data ); + free( rw_data ); + free( dynamic_data ); + free( static_data ); }
DWORD WINAPI NsiGetAllParameters( DWORD unk, const NPI_MODULEID *module, DWORD table, const void *key, DWORD key_size, @@ -254,8 +253,8 @@ DWORD WINAPI NsiGetAllParametersEx( struct nsi_get_all_parameters_ex *params )
if (device == INVALID_HANDLE_VALUE) return GetLastError();
- in = heap_alloc( in_size ); - out = heap_alloc( out_size ); + in = malloc( in_size ); + out = malloc( out_size ); if (!in || !out) { err = ERROR_OUTOFMEMORY; @@ -284,8 +283,8 @@ DWORD WINAPI NsiGetAllParametersEx( struct nsi_get_all_parameters_ex *params ) }
err: - heap_free( out ); - heap_free( in ); + free( out ); + free( in ); return err; }
@@ -321,7 +320,7 @@ DWORD WINAPI NsiGetParameterEx( struct nsi_get_parameter_ex *params )
if (device == INVALID_HANDLE_VALUE) return GetLastError();
- in = heap_alloc( in_size ); + in = malloc( in_size ); if (!in) return ERROR_OUTOFMEMORY; in->module = *params->module; in->first_arg = params->first_arg; @@ -334,7 +333,7 @@ DWORD WINAPI NsiGetParameterEx( struct nsi_get_parameter_ex *params ) if (!DeviceIoControl( device, IOCTL_NSIPROXY_WINE_GET_PARAMETER, in, in_size, params->data, params->data_size, &received, NULL )) err = GetLastError();
- heap_free( in ); + free( in ); return err; }
Huw Davies (@huw) commented about dlls/nsi/nsi.c:
{ if (sizes[i]) {
data[i] = heap_alloc( sizes[i] * num );
data[i] = malloc( sizes[i] * num );
These are returned to the caller, so this is changing the ABI.
On Tue Nov 7 08:28:50 2023 +0000, Huw Davies wrote:
These are returned to the caller, so this is changing the ABI.
That's an interesting point. These values are presumably supposed to be freed with NsiFreeTable, but the caller could try to free them with HeapFree instead. Is there any good way to tell which allocation function Windows is internally using here?
On Tue Nov 7 15:14:50 2023 +0000, Alex Henrie wrote:
That's an interesting point. These values are presumably supposed to be freed with NsiFreeTable, but the caller could try to free them with HeapFree instead. Is there any good way to tell which allocation function Windows is internally using here?
Quick test shows that HeapSize() does return reasonable values for those allocations.