explorer: add a navbar to explorer
[wine/gsoc_explorer.git] / dlls / netapi32 / netapi32.c
blobfafce6be3d4af668d6f5f3644d8f15ec1a921ec7
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
19 #include "config.h"
21 #include "wine/debug.h"
22 #include "lm.h"
23 #include "netbios.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);
35 switch (fdwReason) {
36 case DLL_PROCESS_ATTACH:
38 DisableThreadLibraryCalls(hinstDLL);
39 NETAPI32_hModule = hinstDLL;
40 NetBIOSInit();
41 NetBTInit();
42 break;
44 case DLL_PROCESS_DETACH:
46 NetBIOSShutdown();
47 break;
51 return TRUE;
54 /************************************************************
55 * NetServerEnum (NETAPI32.@)
57 NET_API_STATUS WINAPI NetServerEnum(
58 LMCSTR servername,
59 DWORD level,
60 LPBYTE* bufptr,
61 DWORD prefmaxlen,
62 LPDWORD entriesread,
63 LPDWORD totalentries,
64 DWORD servertype,
65 LMCSTR domain,
66 LPDWORD resume_handle
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(
80 LMCSTR ServerName,
81 DWORD Level,
82 LPBYTE *Bufptr,
83 DWORD PrefMaxlen,
84 LPDWORD EntriesRead,
85 LPDWORD totalentries,
86 DWORD servertype,
87 LMCSTR domain,
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(
101 LMCSTR ServerName,
102 DWORD Level,
103 LPBYTE *Bufptr,
104 DWORD PrefMaxlen,
105 LPDWORD EntriesRead,
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)
120 NET_API_STATUS ret;
122 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
123 if (servername)
125 if (!NETAPI_IsLocalComputer(servername))
127 FIXME("remote computers not supported\n");
128 return ERROR_INVALID_LEVEL;
131 if (!bufptr) return ERROR_INVALID_PARAMETER;
133 switch (level)
135 case 100:
136 case 101:
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;
165 break;
168 default:
169 FIXME("level %d unimplemented\n", level);
170 ret = ERROR_INVALID_LEVEL;
172 return ret;
176 /************************************************************
177 * NetStatisticsGet (NETAPI32.@)
179 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
180 DWORD level, DWORD options,
181 LPBYTE *bufptr)
183 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
184 return NERR_InternalError;
187 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
189 DWORD ret;
191 switch (nrc)
193 case NRC_GOODRET:
194 ret = NO_ERROR;
195 break;
196 case NRC_NORES:
197 ret = NERR_NoNetworkResource;
198 break;
199 case NRC_DUPNAME:
200 ret = NERR_AlreadyExists;
201 break;
202 case NRC_NAMTFUL:
203 ret = NERR_TooManyNames;
204 break;
205 case NRC_ACTSES:
206 ret = NERR_DeleteLater;
207 break;
208 case NRC_REMTFUL:
209 ret = ERROR_REM_NOT_LIST;
210 break;
211 case NRC_NOCALL:
212 ret = NERR_NameNotFound;
213 break;
214 case NRC_NOWILD:
215 ret = ERROR_INVALID_PARAMETER;
216 break;
217 case NRC_INUSE:
218 ret = NERR_DuplicateName;
219 break;
220 case NRC_NAMERR:
221 ret = ERROR_INVALID_PARAMETER;
222 break;
223 case NRC_NAMCONF:
224 ret = NERR_DuplicateName;
225 break;
226 default:
227 ret = NERR_NetworkError;
229 return ret;
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;