po: Update Portuguese translation.
[wine/multimedia.git] / dlls / netapi32 / netapi32.c
blob58cd0140b793f56e28ef61d00247f290fe74d94a
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 "lmat.h"
24 #include "netbios.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);
36 switch (fdwReason) {
37 case DLL_PROCESS_ATTACH:
39 DisableThreadLibraryCalls(hinstDLL);
40 NETAPI32_hModule = hinstDLL;
41 NetBIOSInit();
42 NetBTInit();
43 break;
45 case DLL_PROCESS_DETACH:
47 NetBIOSShutdown();
48 break;
52 return TRUE;
55 /************************************************************
56 * NetServerEnum (NETAPI32.@)
58 NET_API_STATUS WINAPI NetServerEnum(
59 LMCSTR servername,
60 DWORD level,
61 LPBYTE* bufptr,
62 DWORD prefmaxlen,
63 LPDWORD entriesread,
64 LPDWORD totalentries,
65 DWORD servertype,
66 LMCSTR domain,
67 LPDWORD resume_handle
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(
81 LMCSTR ServerName,
82 DWORD Level,
83 LPBYTE *Bufptr,
84 DWORD PrefMaxlen,
85 LPDWORD EntriesRead,
86 LPDWORD totalentries,
87 DWORD servertype,
88 LMCSTR domain,
89 LMCSTR FirstNameToReturn)
91 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName),
92 Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype,
93 debugstr_w(domain), debugstr_w(FirstNameToReturn));
95 return ERROR_NO_BROWSER_SERVERS_FOUND;
98 /************************************************************
99 * NetServerDiskEnum (NETAPI32.@)
101 NET_API_STATUS WINAPI NetServerDiskEnum(
102 LMCSTR ServerName,
103 DWORD Level,
104 LPBYTE *Bufptr,
105 DWORD PrefMaxlen,
106 LPDWORD EntriesRead,
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)
121 NET_API_STATUS ret;
123 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
124 if (servername)
126 if (!NETAPI_IsLocalComputer(servername))
128 FIXME("remote computers not supported\n");
129 return ERROR_INVALID_LEVEL;
132 if (!bufptr) return ERROR_INVALID_PARAMETER;
134 switch (level)
136 case 100:
137 case 101:
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;
166 break;
169 default:
170 FIXME("level %d unimplemented\n", level);
171 ret = ERROR_INVALID_LEVEL;
173 return ret;
177 /************************************************************
178 * NetStatisticsGet (NETAPI32.@)
180 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
181 DWORD level, DWORD options,
182 LPBYTE *bufptr)
184 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
185 return NERR_InternalError;
188 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
190 DWORD ret;
192 switch (nrc)
194 case NRC_GOODRET:
195 ret = NO_ERROR;
196 break;
197 case NRC_NORES:
198 ret = NERR_NoNetworkResource;
199 break;
200 case NRC_DUPNAME:
201 ret = NERR_AlreadyExists;
202 break;
203 case NRC_NAMTFUL:
204 ret = NERR_TooManyNames;
205 break;
206 case NRC_ACTSES:
207 ret = NERR_DeleteLater;
208 break;
209 case NRC_REMTFUL:
210 ret = ERROR_REM_NOT_LIST;
211 break;
212 case NRC_NOCALL:
213 ret = NERR_NameNotFound;
214 break;
215 case NRC_NOWILD:
216 ret = ERROR_INVALID_PARAMETER;
217 break;
218 case NRC_INUSE:
219 ret = NERR_DuplicateName;
220 break;
221 case NRC_NAMERR:
222 ret = ERROR_INVALID_PARAMETER;
223 break;
224 case NRC_NAMCONF:
225 ret = NERR_DuplicateName;
226 break;
227 default:
228 ret = NERR_NetworkError;
230 return ret;
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 NetScheduleJobEnum(LPCWSTR server, LPBYTE* bufptr, DWORD prefmaxsize, LPDWORD entriesread,
242 LPDWORD totalentries, LPDWORD resumehandle)
244 FIXME("stub (%s, %p, %d, %p, %p, %p)\n", debugstr_w(server), bufptr, prefmaxsize, entriesread, totalentries, resumehandle);
245 *entriesread = 0;
246 *totalentries = 0;
247 return NERR_Success;
250 NET_API_STATUS WINAPI NetUseGetInfo(LMSTR server, LMSTR name, DWORD level, LPBYTE *bufptr)
252 FIXME("stub (%p, %p, %d, %p)\n", server, name, level, bufptr);
253 return ERROR_NOT_SUPPORTED;