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"
25 WINE_DEFAULT_DEBUG_CHANNEL(netbios);
27 static HMODULE NETAPI32_hModule;
29 BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
31 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
33 TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
36 case DLL_PROCESS_ATTACH:
38 DisableThreadLibraryCalls(hinstDLL);
39 NETAPI32_hModule = hinstDLL;
44 case DLL_PROCESS_DETACH:
54 /************************************************************
55 * NetServerEnum (NETAPI32.@)
57 NET_API_STATUS WINAPI NetServerEnum(
69 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
70 level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
71 debugstr_w(domain), resume_handle);
73 return ERROR_NO_BROWSER_SERVERS_FOUND;
76 /************************************************************
77 * NetServerEnumEx (NETAPI32.@)
79 NET_API_STATUS WINAPI NetServerEnumEx(
88 LMCSTR FirstNameToReturn)
90 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
91 Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
92 debugstr_w(domain), debugstr_w(FirstNameToReturn));
94 return ERROR_NO_BROWSER_SERVERS_FOUND;
97 /************************************************************
98 * NetServerDiskEnum (NETAPI32.@)
100 NET_API_STATUS WINAPI NetServerDiskEnum(
106 LPDWORD totalentries,
107 LPDWORD Resume_Handle)
109 FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(ServerName),
110 Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, Resume_Handle);
112 return ERROR_NO_BROWSER_SERVERS_FOUND;
115 /************************************************************
116 * NetServerGetInfo (NETAPI32.@)
118 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
122 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
125 if (!NETAPI_IsLocalComputer(servername))
127 FIXME("remote computers not supported\n");
128 return ERROR_INVALID_LEVEL;
131 if (!bufptr) return ERROR_INVALID_PARAMETER;
138 DWORD computerNameLen, size;
139 WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
141 computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
142 GetComputerNameW(computerName, &computerNameLen);
143 computerNameLen++; /* include NULL terminator */
145 size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
146 ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
147 if (ret == NERR_Success)
149 /* INFO_100 structure is a subset of INFO_101 */
150 PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
151 OSVERSIONINFOW verInfo;
153 info->sv101_platform_id = PLATFORM_ID_NT;
154 info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
155 memcpy(info->sv101_name, computerName,
156 computerNameLen * sizeof(WCHAR));
157 verInfo.dwOSVersionInfoSize = sizeof(verInfo);
158 GetVersionExW(&verInfo);
159 info->sv101_version_major = verInfo.dwMajorVersion;
160 info->sv101_version_minor = verInfo.dwMinorVersion;
161 /* Use generic type as no wine equivalent of DC / Server */
162 info->sv101_type = SV_TYPE_NT;
163 info->sv101_comment = NULL;
169 FIXME("level %d unimplemented\n", level);
170 ret = ERROR_INVALID_LEVEL;
176 /************************************************************
177 * NetStatisticsGet (NETAPI32.@)
179 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
180 DWORD level, DWORD options,
183 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
184 return NERR_InternalError;
187 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
197 ret = NERR_NoNetworkResource;
200 ret = NERR_AlreadyExists;
203 ret = NERR_TooManyNames;
206 ret = NERR_DeleteLater;
209 ret = ERROR_REM_NOT_LIST;
212 ret = NERR_NameNotFound;
215 ret = ERROR_INVALID_PARAMETER;
218 ret = NERR_DuplicateName;
221 ret = ERROR_INVALID_PARAMETER;
224 ret = NERR_DuplicateName;
227 ret = NERR_NetworkError;
232 NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
233 LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
235 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
236 entriesread, totalentries, resumehandle);
237 return ERROR_NOT_SUPPORTED;