ReactOS 0.4.16-dev-2528-g7139e57
main.c
Go to the documentation of this file.
1/*
2 * Copyright 2001 Mike McCormack
3 * Copyright 2002 Andriy Palamarchuk
4 * Copyright 2003 Juan Lang
5 * Copyright 2005,2006 Paul Vriens
6 * Copyright 2006 Robert Reif
7 * Copyright 2013 Hans Leidekker for CodeWeavers
8 * Copyright 2020 Dmitry Timoshkov
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25 #include <stdarg.h>
26
27 #include "ntstatus.h"
28 #define WIN32_NO_STATUS
29 #include "windef.h"
30 #include "winbase.h"
31 #ifndef __REACTOS__
32 #include "winternl.h"
33 #endif
34 #include "lm.h"
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "initguid.h"
38
40
41 /************************************************************
42 * NetApiBufferAllocate (NETUTILS.@)
43 */
45 {
46 TRACE("(%ld, %p)\n", ByteCount, Buffer);
47
48 if (Buffer == NULL) return ERROR_INVALID_PARAMETER;
50 if (*Buffer)
51 return NERR_Success;
52 else
53 return GetLastError();
54 }
55
56 /************************************************************
57 * NetApiBufferFree (NETUTILS.@)
58 */
60 {
61 TRACE("(%p)\n", Buffer);
63 return NERR_Success;
64 }
65
66 /************************************************************
67 * NetApiBufferReallocate (NETUTILS.@)
68 */
70 LPVOID* NewBuffer)
71 {
72 TRACE("(%p, %ld, %p)\n", OldBuffer, NewByteCount, NewBuffer);
73 if (NewByteCount)
74 {
75 if (OldBuffer)
76 *NewBuffer = HeapReAlloc(GetProcessHeap(), 0, OldBuffer, NewByteCount);
77 else
78 *NewBuffer = HeapAlloc(GetProcessHeap(), 0, NewByteCount);
79 return *NewBuffer ? NERR_Success : GetLastError();
80 }
81 else
82 {
83 if (!HeapFree(GetProcessHeap(), 0, OldBuffer)) return GetLastError();
84 *NewBuffer = 0;
85 return NERR_Success;
86 }
87 }
88
89 /************************************************************
90 * NetApiBufferSize (NETUTILS.@)
91 */
93 {
94 DWORD dw;
95
96 TRACE("(%p, %p)\n", Buffer, ByteCount);
97 if (Buffer == NULL)
100 TRACE("size: %ld\n", dw);
101 if (dw != 0xFFFFFFFF)
102 *ByteCount = dw;
103 else
104 *ByteCount = 0;
105
106 return NERR_Success;
107 }
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
NET_API_STATUS WINAPI NetApiBufferSize(LPVOID Buffer, LPDWORD ByteCount)
Definition: main.c:92
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: main.c:59
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: main.c:44
NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount, LPVOID *NewBuffer)
Definition: main.c:69
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define NERR_Success
Definition: lmerr.h:5
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t * LPDWORD
Definition: typedefs.h:59
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099