1 /* Copyright 2001 Mike McCormack
2 * Copyright 2003 Juan Lang
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
28 static HMODULE NETAPI32_hModule;
30 BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
32 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
34 TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
37 case DLL_PROCESS_ATTACH:
39 DisableThreadLibraryCalls(hinstDLL);
40 NETAPI32_hModule = hinstDLL;
45 case DLL_PROCESS_DETACH:
55 /************************************************************
56 * NetServerEnum (NETAPI32.@)
58 NET_API_STATUS WINAPI NetServerEnum(
70 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
71 level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
72 debugstr_w(domain), resume_handle);
74 return ERROR_NO_BROWSER_SERVERS_FOUND;
77 /************************************************************
78 * NetServerEnumEx (NETAPI32.@)
80 NET_API_STATUS WINAPI NetServerEnumEx(
89 LMCSTR FirstNameToReturn)
91 FIXME("Stub (%s %d %p %d %p %p %d %s %s)\n",
92 debugstr_w(ServerName), Level, Bufptr, PrefMaxlen, EntriesRead, totalentries,
93 servertype, debugstr_w(domain), debugstr_w(FirstNameToReturn));
95 return ERROR_NO_BROWSER_SERVERS_FOUND;
98 /************************************************************
99 * NetServerDiskEnum (NETAPI32.@)
101 NET_API_STATUS WINAPI NetServerDiskEnum(
107 LPDWORD totalentries,
108 LPDWORD Resume_Handle)
110 FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(ServerName),
111 Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, Resume_Handle);
113 return ERROR_NO_BROWSER_SERVERS_FOUND;
116 /************************************************************
117 * NetServerGetInfo (NETAPI32.@)
119 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
123 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
126 if (!NETAPI_IsLocalComputer(servername))
128 FIXME("remote computers not supported\n");
129 return ERROR_INVALID_LEVEL;
132 if (!bufptr) return ERROR_INVALID_PARAMETER;
139 DWORD computerNameLen, size;
140 WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
142 computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
143 GetComputerNameW(computerName, &computerNameLen);
144 computerNameLen++; /* include NULL terminator */
146 size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
147 ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
148 if (ret == NERR_Success)
150 /* INFO_100 structure is a subset of INFO_101 */
151 PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
152 OSVERSIONINFOW verInfo;
154 info->sv101_platform_id = PLATFORM_ID_NT;
155 info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
156 memcpy(info->sv101_name, computerName,
157 computerNameLen * sizeof(WCHAR));
158 verInfo.dwOSVersionInfoSize = sizeof(verInfo);
159 GetVersionExW(&verInfo);
160 info->sv101_version_major = verInfo.dwMajorVersion;
161 info->sv101_version_minor = verInfo.dwMinorVersion;
162 /* Use generic type as no wine equivalent of DC / Server */
163 info->sv101_type = SV_TYPE_NT;
164 info->sv101_comment = NULL;
170 FIXME("level %d unimplemented\n", level);
171 ret = ERROR_INVALID_LEVEL;
177 /************************************************************
178 * NetStatisticsGet (NETAPI32.@)
180 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
181 DWORD level, DWORD options,
184 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
185 return NERR_InternalError;
188 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
198 ret = NERR_NoNetworkResource;
201 ret = NERR_AlreadyExists;
204 ret = NERR_TooManyNames;
207 ret = NERR_DeleteLater;
210 ret = ERROR_REM_NOT_LIST;
213 ret = NERR_NameNotFound;
216 ret = ERROR_INVALID_PARAMETER;
219 ret = NERR_DuplicateName;
222 ret = ERROR_INVALID_PARAMETER;
225 ret = NERR_DuplicateName;
228 ret = NERR_NetworkError;
233 NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
234 LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
236 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
237 entriesread, totalentries, resumehandle);
238 return ERROR_NOT_SUPPORTED;
241 NET_API_STATUS WINAPI NetScheduleJobAdd(LPCWSTR server, LPBYTE bufptr, LPDWORD jobid)
243 FIXME("stub (%s, %p, %p)\n", debugstr_w(server), bufptr, jobid);
247 NET_API_STATUS WINAPI NetScheduleJobEnum(LPCWSTR server, LPBYTE* bufptr, DWORD prefmaxsize, LPDWORD entriesread,
248 LPDWORD totalentries, LPDWORD resumehandle)
250 FIXME("stub (%s, %p, %d, %p, %p, %p)\n", debugstr_w(server), bufptr, prefmaxsize, entriesread, totalentries, resumehandle);
256 NET_API_STATUS WINAPI NetUseGetInfo(LMSTR server, LMSTR name, DWORD level, LPBYTE *bufptr)
258 FIXME("stub (%p, %p, %d, %p)\n", server, name, level, bufptr);
259 return ERROR_NOT_SUPPORTED;