Commit 48801b6d authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

wtsapi32: Use CRT allocation functions.

parent b1d29765
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "lmcons.h" #include "lmcons.h"
#include "wtsapi32.h" #include "wtsapi32.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(wtsapi); WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
...@@ -149,7 +148,7 @@ BOOL WINAPI WTSEnumerateProcessesExW(HANDLE server, DWORD *level, DWORD session_ ...@@ -149,7 +148,7 @@ BOOL WINAPI WTSEnumerateProcessesExW(HANDLE server, DWORD *level, DWORD session_
nt_process = (SYSTEM_PROCESS_INFORMATION *)((char *)nt_process + nt_process->NextEntryOffset); nt_process = (SYSTEM_PROCESS_INFORMATION *)((char *)nt_process + nt_process->NextEntryOffset);
} }
if (!(info = heap_alloc(size))) if (!(info = malloc(size)))
{ {
free(nt_info); free(nt_info);
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
...@@ -315,7 +314,7 @@ BOOL WINAPI WTSEnumerateSessionsA(HANDLE server, DWORD reserved, DWORD version, ...@@ -315,7 +314,7 @@ BOOL WINAPI WTSEnumerateSessionsA(HANDLE server, DWORD reserved, DWORD version,
size += sizeof(**session_info) + len; size += sizeof(**session_info) + len;
} }
if (!(*session_info = heap_alloc(size))) if (!(*session_info = malloc(size)))
{ {
WTSFreeMemory(infoW); WTSFreeMemory(infoW);
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
...@@ -355,7 +354,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version, ...@@ -355,7 +354,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version,
if (!session_info || !count) return FALSE; if (!session_info || !count) return FALSE;
if (!(*session_info = heap_alloc(sizeof(**session_info) + sizeof(session_name)))) if (!(*session_info = malloc(sizeof(**session_info) + sizeof(session_name))))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
...@@ -378,7 +377,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version, ...@@ -378,7 +377,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version,
*/ */
void WINAPI WTSFreeMemory(PVOID pMemory) void WINAPI WTSFreeMemory(PVOID pMemory)
{ {
heap_free(pMemory); free(pMemory);
} }
/************************************************************ /************************************************************
...@@ -387,7 +386,7 @@ void WINAPI WTSFreeMemory(PVOID pMemory) ...@@ -387,7 +386,7 @@ void WINAPI WTSFreeMemory(PVOID pMemory)
BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
{ {
TRACE("%d %p %ld\n", type, ptr, nmemb); TRACE("%d %p %ld\n", type, ptr, nmemb);
heap_free(ptr); free(ptr);
return TRUE; return TRUE;
} }
...@@ -397,7 +396,7 @@ BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) ...@@ -397,7 +396,7 @@ BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb)
{ {
TRACE("%d %p %ld\n", type, ptr, nmemb); TRACE("%d %p %ld\n", type, ptr, nmemb);
heap_free(ptr); free(ptr);
return TRUE; return TRUE;
} }
...@@ -481,7 +480,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF ...@@ -481,7 +480,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF
return FALSE; return FALSE;
} }
if (!(*buffer = heap_alloc(*count))) if (!(*buffer = malloc(*count)))
{ {
WTSFreeMemory(bufferW); WTSFreeMemory(bufferW);
return FALSE; return FALSE;
...@@ -490,7 +489,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF ...@@ -490,7 +489,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF
if (!(*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, *buffer, *count, NULL, NULL))) if (!(*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, *buffer, *count, NULL, NULL)))
{ {
WTSFreeMemory(bufferW); WTSFreeMemory(bufferW);
heap_free(*buffer); free(*buffer);
return FALSE; return FALSE;
} }
...@@ -515,7 +514,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF ...@@ -515,7 +514,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF
{ {
WTS_CONNECTSTATE_CLASS *state; WTS_CONNECTSTATE_CLASS *state;
if (!(state = heap_alloc(sizeof(*state)))) return FALSE; if (!(state = malloc(sizeof(*state)))) return FALSE;
*state = WTSActive; *state = WTSActive;
*buffer = (WCHAR *)state; *buffer = (WCHAR *)state;
*count = sizeof(*state); *count = sizeof(*state);
...@@ -526,7 +525,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF ...@@ -526,7 +525,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF
{ {
USHORT *protocol; USHORT *protocol;
if (!(protocol = heap_alloc(sizeof(*protocol)))) return FALSE; if (!(protocol = malloc(sizeof(*protocol)))) return FALSE;
FIXME("returning 0 protocol type\n"); FIXME("returning 0 protocol type\n");
*protocol = 0; *protocol = 0;
*buffer = (WCHAR *)protocol; *buffer = (WCHAR *)protocol;
...@@ -539,7 +538,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF ...@@ -539,7 +538,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF
DWORD size = UNLEN + 1; DWORD size = UNLEN + 1;
WCHAR *username; WCHAR *username;
if (!(username = heap_alloc(size * sizeof(WCHAR)))) return FALSE; if (!(username = malloc(size * sizeof(WCHAR)))) return FALSE;
GetUserNameW(username, &size); GetUserNameW(username, &size);
*buffer = username; *buffer = username;
*count = size * sizeof(WCHAR); *count = size * sizeof(WCHAR);
...@@ -551,7 +550,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF ...@@ -551,7 +550,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF
DWORD size = MAX_COMPUTERNAME_LENGTH + 1; DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
WCHAR *computername; WCHAR *computername;
if (!(computername = heap_alloc(size * sizeof(WCHAR)))) return FALSE; if (!(computername = malloc(size * sizeof(WCHAR)))) return FALSE;
GetComputerNameW(computername, &size); GetComputerNameW(computername, &size);
*buffer = computername; *buffer = computername;
/* GetComputerNameW() return size doesn't include terminator */ /* GetComputerNameW() return size doesn't include terminator */
......
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