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
21 #include "wine/debug.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
);
36 case DLL_PROCESS_ATTACH
:
38 DisableThreadLibraryCalls(hinstDLL
);
39 NETAPI32_hModule
= hinstDLL
;
44 case DLL_PROCESS_DETACH
:
54 /************************************************************
55 * NetServerEnum (NETAPI32.@)
57 NET_API_STATUS WINAPI
NetServerEnum(
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(
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
)
104 TRACE("%s %d %p\n", debugstr_w( servername
), level
, bufptr
);
107 if (!NETAPI_IsLocalComputer(servername
))
109 FIXME("remote computers not supported\n");
110 return ERROR_INVALID_LEVEL
;
113 if (!bufptr
) return ERROR_INVALID_PARAMETER
;
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
;
151 FIXME("level %d unimplemented\n", level
);
152 ret
= ERROR_INVALID_LEVEL
;
158 /************************************************************
159 * NetStatisticsGet (NETAPI32.@)
161 NET_API_STATUS WINAPI
NetStatisticsGet(LMSTR server
, LMSTR service
,
162 DWORD level
, DWORD options
,
165 TRACE("(%p, %p, %d, %d, %p)\n", server
, service
, level
, options
, bufptr
);
166 return NERR_InternalError
;
169 DWORD WINAPI
NetpNetBiosStatusToApiStatus(DWORD nrc
)
179 ret
= NERR_NoNetworkResource
;
182 ret
= NERR_AlreadyExists
;
185 ret
= NERR_TooManyNames
;
188 ret
= NERR_DeleteLater
;
191 ret
= ERROR_REM_NOT_LIST
;
194 ret
= NERR_NameNotFound
;
197 ret
= ERROR_INVALID_PARAMETER
;
200 ret
= NERR_DuplicateName
;
203 ret
= ERROR_INVALID_PARAMETER
;
206 ret
= NERR_DuplicateName
;
209 ret
= NERR_NetworkError
;
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
;