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 #define WIN32_NO_STATUS
22 #include <wine/debug.h>
26 #define NTOS_MODE_USER
27 #include <ndk/rtlfuncs.h>
30 WINE_DEFAULT_DEBUG_CHANNEL(netbios
);
32 static HMODULE NETAPI32_hModule
;
34 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
36 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
39 case DLL_PROCESS_ATTACH
:
41 DisableThreadLibraryCalls(hinstDLL
);
42 NETAPI32_hModule
= hinstDLL
;
47 case DLL_PROCESS_DETACH
:
57 /************************************************************
58 * NetServerEnum (NETAPI32.@)
60 NET_API_STATUS WINAPI
NetServerEnum(
72 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername
),
73 level
, bufptr
, prefmaxlen
, entriesread
, totalentries
, servertype
,
74 debugstr_w(domain
), resume_handle
);
76 return ERROR_NO_BROWSER_SERVERS_FOUND
;
79 /************************************************************
80 * NetServerEnumEx (NETAPI32.@)
82 NET_API_STATUS WINAPI
NetServerEnumEx(
91 LMCSTR FirstNameToReturn
)
93 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName
),
94 Level
, Bufptr
, PrefMaxlen
, EntriesRead
, totalentries
, servertype
,
95 debugstr_w(domain
), debugstr_w(FirstNameToReturn
));
97 return ERROR_NO_BROWSER_SERVERS_FOUND
;
100 /************************************************************
101 * NetServerGetInfo (NETAPI32.@)
103 NET_API_STATUS WINAPI
NetServerGetInfo(LMSTR servername
, DWORD level
, LPBYTE
* bufptr
)
107 TRACE("%s %d %p\n", debugstr_w( servername
), level
, bufptr
);
110 if (!NETAPI_IsLocalComputer(servername
))
112 FIXME("remote computers not supported\n");
113 return ERROR_INVALID_LEVEL
;
116 if (!bufptr
) return ERROR_INVALID_PARAMETER
;
123 DWORD computerNameLen
, size
;
124 WCHAR computerName
[MAX_COMPUTERNAME_LENGTH
+ 1];
126 computerNameLen
= MAX_COMPUTERNAME_LENGTH
+ 1;
127 GetComputerNameW(computerName
, &computerNameLen
);
128 computerNameLen
++; /* include NULL terminator */
130 size
= sizeof(SERVER_INFO_101
) + computerNameLen
* sizeof(WCHAR
);
131 ret
= NetApiBufferAllocate(size
, (LPVOID
*)bufptr
);
132 if (ret
== NERR_Success
)
134 /* INFO_100 structure is a subset of INFO_101 */
135 PSERVER_INFO_101 info
= (PSERVER_INFO_101
)*bufptr
;
136 OSVERSIONINFOW verInfo
;
138 info
->sv101_platform_id
= PLATFORM_ID_NT
;
139 info
->sv101_name
= (LMSTR
)(*bufptr
+ sizeof(SERVER_INFO_101
));
140 memcpy(info
->sv101_name
, computerName
,
141 computerNameLen
* sizeof(WCHAR
));
142 verInfo
.dwOSVersionInfoSize
= sizeof(verInfo
);
143 GetVersionExW(&verInfo
);
144 info
->sv101_version_major
= verInfo
.dwMajorVersion
;
145 info
->sv101_version_minor
= verInfo
.dwMinorVersion
;
146 /* Use generic type as no wine equivalent of DC / Server */
147 info
->sv101_type
= SV_TYPE_NT
;
148 info
->sv101_comment
= NULL
;
154 FIXME("level %d unimplemented\n", level
);
155 ret
= ERROR_INVALID_LEVEL
;
161 /************************************************************
162 * NetStatisticsGet (NETAPI32.@)
164 NET_API_STATUS WINAPI
NetStatisticsGet(LMSTR server
, LMSTR service
,
165 DWORD level
, DWORD options
,
168 TRACE("(%p, %p, %d, %d, %p)\n", server
, service
, level
, options
, bufptr
);
169 return NERR_InternalError
;
172 DWORD WINAPI
NetpNetBiosStatusToApiStatus(DWORD nrc
)
182 ret
= NERR_NoNetworkResource
;
185 ret
= NERR_AlreadyExists
;
188 ret
= NERR_TooManyNames
;
191 ret
= NERR_DeleteLater
;
194 ret
= ERROR_REM_NOT_LIST
;
197 ret
= NERR_NameNotFound
;
200 ret
= ERROR_INVALID_PARAMETER
;
203 ret
= NERR_DuplicateName
;
206 ret
= ERROR_INVALID_PARAMETER
;
209 ret
= NERR_DuplicateName
;
212 ret
= NERR_NetworkError
;
219 NetpNtStatusToApiStatus(NTSTATUS Status
)
221 NET_API_STATUS ApiStatus
;
226 ApiStatus
= NERR_Success
;
229 case STATUS_INVALID_ACCOUNT_NAME
:
230 ApiStatus
= NERR_BadUsername
;
233 case STATUS_PASSWORD_RESTRICTION
:
234 ApiStatus
= NERR_PasswordTooShort
;
238 ApiStatus
= RtlNtStatusToDosError(Status
);
245 NET_API_STATUS WINAPI
NetUseEnum(LMSTR server
, DWORD level
, LPBYTE
* bufptr
, DWORD prefmaxsize
,
246 LPDWORD entriesread
, LPDWORD totalentries
, LPDWORD resumehandle
)
248 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server
, level
, bufptr
, prefmaxsize
,
249 entriesread
, totalentries
, resumehandle
);
250 return ERROR_NOT_SUPPORTED
;