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
23 WINE_DEFAULT_DEBUG_CHANNEL(netbios
);
25 static HMODULE NETAPI32_hModule
;
27 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
29 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
32 case DLL_PROCESS_ATTACH
:
34 DisableThreadLibraryCalls(hinstDLL
);
35 NETAPI32_hModule
= hinstDLL
;
40 case DLL_PROCESS_DETACH
:
50 /************************************************************
51 * NetServerEnum (NETAPI32.@)
53 NET_API_STATUS WINAPI
NetServerEnum(
65 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername
),
66 level
, bufptr
, prefmaxlen
, entriesread
, totalentries
, servertype
,
67 debugstr_w(domain
), resume_handle
);
69 return ERROR_NO_BROWSER_SERVERS_FOUND
;
72 /************************************************************
73 * NetServerEnumEx (NETAPI32.@)
75 NET_API_STATUS WINAPI
NetServerEnumEx(
84 LMCSTR FirstNameToReturn
)
86 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName
),
87 Level
, Bufptr
, PrefMaxlen
, EntriesRead
, totalentries
, servertype
,
88 debugstr_w(domain
), debugstr_w(FirstNameToReturn
));
90 return ERROR_NO_BROWSER_SERVERS_FOUND
;
93 /************************************************************
94 * NetServerGetInfo (NETAPI32.@)
96 NET_API_STATUS WINAPI
NetServerGetInfo(LMSTR servername
, DWORD level
, LPBYTE
* bufptr
)
100 TRACE("%s %d %p\n", debugstr_w( servername
), level
, bufptr
);
103 if (!NETAPI_IsLocalComputer(servername
))
105 FIXME("remote computers not supported\n");
106 return ERROR_INVALID_LEVEL
;
109 if (!bufptr
) return ERROR_INVALID_PARAMETER
;
116 DWORD computerNameLen
, size
;
117 WCHAR computerName
[MAX_COMPUTERNAME_LENGTH
+ 1];
119 computerNameLen
= MAX_COMPUTERNAME_LENGTH
+ 1;
120 GetComputerNameW(computerName
, &computerNameLen
);
121 computerNameLen
++; /* include NULL terminator */
123 size
= sizeof(SERVER_INFO_101
) + computerNameLen
* sizeof(WCHAR
);
124 ret
= NetApiBufferAllocate(size
, (LPVOID
*)bufptr
);
125 if (ret
== NERR_Success
)
127 /* INFO_100 structure is a subset of INFO_101 */
128 PSERVER_INFO_101 info
= (PSERVER_INFO_101
)*bufptr
;
129 OSVERSIONINFOW verInfo
;
131 info
->sv101_platform_id
= PLATFORM_ID_NT
;
132 info
->sv101_name
= (LMSTR
)(*bufptr
+ sizeof(SERVER_INFO_101
));
133 memcpy(info
->sv101_name
, computerName
,
134 computerNameLen
* sizeof(WCHAR
));
135 verInfo
.dwOSVersionInfoSize
= sizeof(verInfo
);
136 GetVersionExW(&verInfo
);
137 info
->sv101_version_major
= verInfo
.dwMajorVersion
;
138 info
->sv101_version_minor
= verInfo
.dwMinorVersion
;
139 /* Use generic type as no wine equivalent of DC / Server */
140 info
->sv101_type
= SV_TYPE_NT
;
141 info
->sv101_comment
= NULL
;
147 FIXME("level %d unimplemented\n", level
);
148 ret
= ERROR_INVALID_LEVEL
;
154 /************************************************************
155 * NetStatisticsGet (NETAPI32.@)
157 NET_API_STATUS WINAPI
NetStatisticsGet(LMSTR server
, LMSTR service
,
158 DWORD level
, DWORD options
,
161 TRACE("(%p, %p, %d, %d, %p)\n", server
, service
, level
, options
, bufptr
);
162 return NERR_InternalError
;
165 DWORD WINAPI
NetpNetBiosStatusToApiStatus(DWORD nrc
)
175 ret
= NERR_NoNetworkResource
;
178 ret
= NERR_AlreadyExists
;
181 ret
= NERR_TooManyNames
;
184 ret
= NERR_DeleteLater
;
187 ret
= ERROR_REM_NOT_LIST
;
190 ret
= NERR_NameNotFound
;
193 ret
= ERROR_INVALID_PARAMETER
;
196 ret
= NERR_DuplicateName
;
199 ret
= ERROR_INVALID_PARAMETER
;
202 ret
= NERR_DuplicateName
;
205 ret
= NERR_NetworkError
;
212 NetpNtStatusToApiStatus(NTSTATUS Status
)
214 NET_API_STATUS ApiStatus
;
219 ApiStatus
= NERR_Success
;
222 case STATUS_INVALID_ACCOUNT_NAME
:
223 ApiStatus
= NERR_BadUsername
;
226 case STATUS_PASSWORD_RESTRICTION
:
227 ApiStatus
= NERR_PasswordTooShort
;
231 ApiStatus
= RtlNtStatusToDosError(Status
);
238 NET_API_STATUS WINAPI
NetUseEnum(LMSTR server
, DWORD level
, LPBYTE
* bufptr
, DWORD prefmaxsize
,
239 LPDWORD entriesread
, LPDWORD totalentries
, LPDWORD resumehandle
)
241 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server
, level
, bufptr
, prefmaxsize
,
242 entriesread
, totalentries
, resumehandle
);
243 return ERROR_NOT_SUPPORTED
;