Commit fe6c2516 authored by Alexandre Julliard's avatar Alexandre Julliard

netapi32: Avoid process heap allocations.

parent d327527c
......@@ -183,7 +183,18 @@ NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bu
if (!local)
{
if (samba_init()) return samba_funcs->server_getinfo( servername, level, bufptr );
if (samba_init())
{
ULONG size = 1024;
for (;;)
{
if (!(*bufptr = malloc( size ))) return ERROR_OUTOFMEMORY;
ret = samba_funcs->server_getinfo( servername, level, *bufptr, &size );
if (ret) free( *bufptr );
if (ret != ERROR_INSUFFICIENT_BUFFER) return ret;
}
}
FIXME( "remote computers not supported\n" );
return ERROR_INVALID_LEVEL;
}
......@@ -964,7 +975,18 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LMSTR servername, DWORD level,
if (!local)
{
if (samba_init()) return samba_funcs->wksta_getinfo( servername, level, bufptr );
if (samba_init())
{
ULONG size = 1024;
for (;;)
{
if (!(*bufptr = malloc( size ))) return ERROR_OUTOFMEMORY;
ret = samba_funcs->wksta_getinfo( servername, level, *bufptr, &size );
if (ret) free( *bufptr );
if (ret != ERROR_INSUFFICIENT_BUFFER) return ret;
}
}
FIXME( "remote computers not supported\n" );
return ERROR_INVALID_LEVEL;
}
......
......@@ -20,10 +20,10 @@
struct samba_funcs
{
NET_API_STATUS (WINAPI *server_getinfo)( const WCHAR *server, DWORD level, BYTE **buffer );
NET_API_STATUS (WINAPI *server_getinfo)( const WCHAR *server, DWORD level, void *buffer, ULONG *size );
NET_API_STATUS (WINAPI *share_add)( const WCHAR *server, DWORD level, const BYTE *buffer, DWORD *err );
NET_API_STATUS (WINAPI *share_del)( const WCHAR *server, const WCHAR *share, DWORD reserved );
NET_API_STATUS (WINAPI *wksta_getinfo)( const WCHAR *server, DWORD level, BYTE **buffer );
NET_API_STATUS (WINAPI *wksta_getinfo)( const WCHAR *server, DWORD level, void *buffer, ULONG *size );
NET_API_STATUS (WINAPI *change_password)( const WCHAR *domain, const WCHAR *user,
const WCHAR *old, const WCHAR *new );
};
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