msacm32: Don't clear DONE flag in Un,PrepareHeader.
[wine.git] / dlls / netapi32 / netapi32.c
bloba5f1c03e474d4f2dac6fc38479feacc1c3214949
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 BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
30 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
32 TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
34 switch (fdwReason) {
35 case DLL_PROCESS_ATTACH:
36 DisableThreadLibraryCalls(hinstDLL);
37 NetBIOSInit();
38 NetBTInit();
39 break;
40 case DLL_PROCESS_DETACH:
41 if (lpvReserved) break;
42 NetBIOSShutdown();
43 break;
46 return TRUE;
49 /************************************************************
50 * NetServerEnum (NETAPI32.@)
52 NET_API_STATUS WINAPI NetServerEnum(
53 LMCSTR servername,
54 DWORD level,
55 LPBYTE* bufptr,
56 DWORD prefmaxlen,
57 LPDWORD entriesread,
58 LPDWORD totalentries,
59 DWORD servertype,
60 LMCSTR domain,
61 LPDWORD resume_handle
64 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
65 level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
66 debugstr_w(domain), resume_handle);
68 return ERROR_NO_BROWSER_SERVERS_FOUND;
71 /************************************************************
72 * NetServerEnumEx (NETAPI32.@)
74 NET_API_STATUS WINAPI NetServerEnumEx(
75 LMCSTR ServerName,
76 DWORD Level,
77 LPBYTE *Bufptr,
78 DWORD PrefMaxlen,
79 LPDWORD EntriesRead,
80 LPDWORD totalentries,
81 DWORD servertype,
82 LMCSTR domain,
83 LMCSTR FirstNameToReturn)
85 FIXME("Stub (%s %d %p %d %p %p %d %s %s)\n",
86 debugstr_w(ServerName), Level, Bufptr, PrefMaxlen, EntriesRead, totalentries,
87 servertype, debugstr_w(domain), debugstr_w(FirstNameToReturn));
89 return ERROR_NO_BROWSER_SERVERS_FOUND;
92 /************************************************************
93 * NetServerDiskEnum (NETAPI32.@)
95 NET_API_STATUS WINAPI NetServerDiskEnum(
96 LMCSTR ServerName,
97 DWORD Level,
98 LPBYTE *Bufptr,
99 DWORD PrefMaxlen,
100 LPDWORD EntriesRead,
101 LPDWORD totalentries,
102 LPDWORD Resume_Handle)
104 FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(ServerName),
105 Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, Resume_Handle);
107 return ERROR_NO_BROWSER_SERVERS_FOUND;
110 /************************************************************
111 * NetServerGetInfo (NETAPI32.@)
113 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
115 NET_API_STATUS ret;
117 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
118 if (servername)
120 if (!NETAPI_IsLocalComputer(servername))
122 FIXME("remote computers not supported\n");
123 return ERROR_INVALID_LEVEL;
126 if (!bufptr) return ERROR_INVALID_PARAMETER;
128 switch (level)
130 case 100:
131 case 101:
133 DWORD computerNameLen, size;
134 WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
136 computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
137 GetComputerNameW(computerName, &computerNameLen);
138 computerNameLen++; /* include NULL terminator */
140 size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
141 ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
142 if (ret == NERR_Success)
144 /* INFO_100 structure is a subset of INFO_101 */
145 PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
146 OSVERSIONINFOW verInfo;
148 info->sv101_platform_id = PLATFORM_ID_NT;
149 info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
150 memcpy(info->sv101_name, computerName,
151 computerNameLen * sizeof(WCHAR));
152 verInfo.dwOSVersionInfoSize = sizeof(verInfo);
153 GetVersionExW(&verInfo);
154 info->sv101_version_major = verInfo.dwMajorVersion;
155 info->sv101_version_minor = verInfo.dwMinorVersion;
156 /* Use generic type as no wine equivalent of DC / Server */
157 info->sv101_type = SV_TYPE_NT;
158 info->sv101_comment = NULL;
160 break;
163 default:
164 FIXME("level %d unimplemented\n", level);
165 ret = ERROR_INVALID_LEVEL;
167 return ret;
171 /************************************************************
172 * NetStatisticsGet (NETAPI32.@)
174 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
175 DWORD level, DWORD options,
176 LPBYTE *bufptr)
178 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
179 return NERR_InternalError;
182 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
184 DWORD ret;
186 switch (nrc)
188 case NRC_GOODRET:
189 ret = NO_ERROR;
190 break;
191 case NRC_NORES:
192 ret = NERR_NoNetworkResource;
193 break;
194 case NRC_DUPNAME:
195 ret = NERR_AlreadyExists;
196 break;
197 case NRC_NAMTFUL:
198 ret = NERR_TooManyNames;
199 break;
200 case NRC_ACTSES:
201 ret = NERR_DeleteLater;
202 break;
203 case NRC_REMTFUL:
204 ret = ERROR_REM_NOT_LIST;
205 break;
206 case NRC_NOCALL:
207 ret = NERR_NameNotFound;
208 break;
209 case NRC_NOWILD:
210 ret = ERROR_INVALID_PARAMETER;
211 break;
212 case NRC_INUSE:
213 ret = NERR_DuplicateName;
214 break;
215 case NRC_NAMERR:
216 ret = ERROR_INVALID_PARAMETER;
217 break;
218 case NRC_NAMCONF:
219 ret = NERR_DuplicateName;
220 break;
221 default:
222 ret = NERR_NetworkError;
224 return ret;
227 NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
228 LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
230 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
231 entriesread, totalentries, resumehandle);
232 return ERROR_NOT_SUPPORTED;
235 NET_API_STATUS WINAPI NetScheduleJobAdd(LPCWSTR server, LPBYTE bufptr, LPDWORD jobid)
237 FIXME("stub (%s, %p, %p)\n", debugstr_w(server), bufptr, jobid);
238 return NERR_Success;
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;