1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/* Copyright 2001 Mike McCormack
* Copyright 2003 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/debug.h"
#include "lm.h"
#include "netbios.h"
WINE_DEFAULT_DEBUG_CHANNEL(netbios);
static HMODULE NETAPI32_hModule;
BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hinstDLL);
NETAPI32_hModule = hinstDLL;
NetBIOSInit();
NetBTInit();
break;
}
case DLL_PROCESS_DETACH:
{
NetBIOSShutdown();
break;
}
}
return TRUE;
}
/************************************************************
* NetServerEnum (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetServerEnum(
LMCSTR servername,
DWORD level,
LPBYTE* bufptr,
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
DWORD servertype,
LMCSTR domain,
LPDWORD resume_handle
)
{
FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
debugstr_w(domain), resume_handle);
return ERROR_NO_BROWSER_SERVERS_FOUND;
}
/************************************************************
* NetServerEnumEx (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetServerEnumEx(
LMCSTR ServerName,
DWORD Level,
LPBYTE *Bufptr,
DWORD PrefMaxlen,
LPDWORD EntriesRead,
LPDWORD totalentries,
DWORD servertype,
LMCSTR domain,
LMCSTR FirstNameToReturn)
{
FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
debugstr_w(domain), debugstr_w(FirstNameToReturn));
return ERROR_NO_BROWSER_SERVERS_FOUND;
}
/************************************************************
* NetServerGetInfo (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
{
NET_API_STATUS ret;
TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
if (servername)
{
if (!NETAPI_IsLocalComputer(servername))
{
FIXME("remote computers not supported\n");
return ERROR_INVALID_LEVEL;
}
}
if (!bufptr) return ERROR_INVALID_PARAMETER;
switch (level)
{
case 100:
case 101:
{
DWORD computerNameLen, size;
WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
GetComputerNameW(computerName, &computerNameLen);
computerNameLen++; /* include NULL terminator */
size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
if (ret == NERR_Success)
{
/* INFO_100 structure is a subset of INFO_101 */
PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
OSVERSIONINFOW verInfo;
info->sv101_platform_id = PLATFORM_ID_NT;
info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
memcpy(info->sv101_name, computerName,
computerNameLen * sizeof(WCHAR));
verInfo.dwOSVersionInfoSize = sizeof(verInfo);
GetVersionExW(&verInfo);
info->sv101_version_major = verInfo.dwMajorVersion;
info->sv101_version_minor = verInfo.dwMinorVersion;
/* Use generic type as no wine equivalent of DC / Server */
info->sv101_type = SV_TYPE_NT;
info->sv101_comment = NULL;
}
break;
}
default:
FIXME("level %d unimplemented\n", level);
ret = ERROR_INVALID_LEVEL;
}
return ret;
}
/************************************************************
* NetStatisticsGet (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
DWORD level, DWORD options,
LPBYTE *bufptr)
{
TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
return NERR_InternalError;
}
DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
{
DWORD ret;
switch (nrc)
{
case NRC_GOODRET:
ret = NO_ERROR;
break;
case NRC_NORES:
ret = NERR_NoNetworkResource;
break;
case NRC_DUPNAME:
ret = NERR_AlreadyExists;
break;
case NRC_NAMTFUL:
ret = NERR_TooManyNames;
break;
case NRC_ACTSES:
ret = NERR_DeleteLater;
break;
case NRC_REMTFUL:
ret = ERROR_REM_NOT_LIST;
break;
case NRC_NOCALL:
ret = NERR_NameNotFound;
break;
case NRC_NOWILD:
ret = ERROR_INVALID_PARAMETER;
break;
case NRC_INUSE:
ret = NERR_DuplicateName;
break;
case NRC_NAMERR:
ret = ERROR_INVALID_PARAMETER;
break;
case NRC_NAMCONF:
ret = NERR_DuplicateName;
break;
default:
ret = NERR_NetworkError;
}
return ret;
}
NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
{
FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
entriesread, totalentries, resumehandle);
return ERROR_NOT_SUPPORTED;
}