makefiles: Generate the list of test binaries from configure.
[wine/multimedia.git] / dlls / netapi32 / netapi32.c
blobfb4468f6950577c901983027efcde80049528bc1
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 * NetServerGetInfo (NETAPI32.@)
100 NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
102 NET_API_STATUS ret;
104 TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
105 if (servername)
107 if (!NETAPI_IsLocalComputer(servername))
109 FIXME("remote computers not supported\n");
110 return ERROR_INVALID_LEVEL;
113 if (!bufptr) return ERROR_INVALID_PARAMETER;
115 switch (level)
117 case 100:
118 case 101:
120 DWORD computerNameLen, size;
121 WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
123 computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
124 GetComputerNameW(computerName, &computerNameLen);
125 computerNameLen++; /* include NULL terminator */
127 size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
128 ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
129 if (ret == NERR_Success)
131 /* INFO_100 structure is a subset of INFO_101 */
132 PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
133 OSVERSIONINFOW verInfo;
135 info->sv101_platform_id = PLATFORM_ID_NT;
136 info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
137 memcpy(info->sv101_name, computerName,
138 computerNameLen * sizeof(WCHAR));
139 verInfo.dwOSVersionInfoSize = sizeof(verInfo);
140 GetVersionExW(&verInfo);
141 info->sv101_version_major = verInfo.dwMajorVersion;
142 info->sv101_version_minor = verInfo.dwMinorVersion;
143 /* Use generic type as no wine equivalent of DC / Server */
144 info->sv101_type = SV_TYPE_NT;
145 info->sv101_comment = NULL;
147 break;
150 default:
151 FIXME("level %d unimplemented\n", level);
152 ret = ERROR_INVALID_LEVEL;
154 return ret;
158 /************************************************************
159 * NetStatisticsGet (NETAPI32.@)
161 NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
162 DWORD level, DWORD options,
163 LPBYTE *bufptr)
165 TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
166 return NERR_InternalError;
169 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
171 DWORD ret;
173 switch (nrc)
175 case NRC_GOODRET:
176 ret = NO_ERROR;
177 break;
178 case NRC_NORES:
179 ret = NERR_NoNetworkResource;
180 break;
181 case NRC_DUPNAME:
182 ret = NERR_AlreadyExists;
183 break;
184 case NRC_NAMTFUL:
185 ret = NERR_TooManyNames;
186 break;
187 case NRC_ACTSES:
188 ret = NERR_DeleteLater;
189 break;
190 case NRC_REMTFUL:
191 ret = ERROR_REM_NOT_LIST;
192 break;
193 case NRC_NOCALL:
194 ret = NERR_NameNotFound;
195 break;
196 case NRC_NOWILD:
197 ret = ERROR_INVALID_PARAMETER;
198 break;
199 case NRC_INUSE:
200 ret = NERR_DuplicateName;
201 break;
202 case NRC_NAMERR:
203 ret = ERROR_INVALID_PARAMETER;
204 break;
205 case NRC_NAMCONF:
206 ret = NERR_DuplicateName;
207 break;
208 default:
209 ret = NERR_NetworkError;
211 return ret;
214 NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
215 LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
217 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
218 entriesread, totalentries, resumehandle);
219 return ERROR_NOT_SUPPORTED;