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>
28 //#include "netapi32.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(netbios
);
32 static HMODULE NETAPI32_hModule
;
34 BOOL
NETAPI_IsLocalComputer(LMCSTR ServerName
);
36 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
38 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
41 case DLL_PROCESS_ATTACH
:
43 DisableThreadLibraryCalls(hinstDLL
);
44 NETAPI32_hModule
= hinstDLL
;
49 case DLL_PROCESS_DETACH
:
59 /************************************************************
60 * NetServerEnum (NETAPI32.@)
62 NET_API_STATUS WINAPI
NetServerEnum(
74 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername
),
75 level
, bufptr
, prefmaxlen
, entriesread
, totalentries
, servertype
,
76 debugstr_w(domain
), resume_handle
);
78 return ERROR_NO_BROWSER_SERVERS_FOUND
;
81 /************************************************************
82 * NetServerEnumEx (NETAPI32.@)
84 NET_API_STATUS WINAPI
NetServerEnumEx(
93 LMCSTR FirstNameToReturn
)
95 FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName
),
96 Level
, Bufptr
, PrefMaxlen
, EntriesRead
, totalentries
, servertype
,
97 debugstr_w(domain
), debugstr_w(FirstNameToReturn
));
99 return ERROR_NO_BROWSER_SERVERS_FOUND
;
102 /************************************************************
103 * NetServerGetInfo (NETAPI32.@)
105 NET_API_STATUS WINAPI
NetServerGetInfo(LMSTR servername
, DWORD level
, LPBYTE
* bufptr
)
109 TRACE("%s %d %p\n", debugstr_w( servername
), level
, bufptr
);
112 if (!NETAPI_IsLocalComputer(servername
))
114 FIXME("remote computers not supported\n");
115 return ERROR_INVALID_LEVEL
;
118 if (!bufptr
) return ERROR_INVALID_PARAMETER
;
125 DWORD computerNameLen
, size
;
126 WCHAR computerName
[MAX_COMPUTERNAME_LENGTH
+ 1];
128 computerNameLen
= MAX_COMPUTERNAME_LENGTH
+ 1;
129 GetComputerNameW(computerName
, &computerNameLen
);
130 computerNameLen
++; /* include NULL terminator */
132 size
= sizeof(SERVER_INFO_101
) + computerNameLen
* sizeof(WCHAR
);
133 ret
= NetApiBufferAllocate(size
, (LPVOID
*)bufptr
);
134 if (ret
== NERR_Success
)
136 /* INFO_100 structure is a subset of INFO_101 */
137 PSERVER_INFO_101 info
= (PSERVER_INFO_101
)*bufptr
;
138 OSVERSIONINFOW verInfo
;
140 info
->sv101_platform_id
= PLATFORM_ID_NT
;
141 info
->sv101_name
= (LMSTR
)(*bufptr
+ sizeof(SERVER_INFO_101
));
142 memcpy(info
->sv101_name
, computerName
,
143 computerNameLen
* sizeof(WCHAR
));
144 verInfo
.dwOSVersionInfoSize
= sizeof(verInfo
);
145 GetVersionExW(&verInfo
);
146 info
->sv101_version_major
= verInfo
.dwMajorVersion
;
147 info
->sv101_version_minor
= verInfo
.dwMinorVersion
;
148 /* Use generic type as no wine equivalent of DC / Server */
149 info
->sv101_type
= SV_TYPE_NT
;
150 info
->sv101_comment
= NULL
;
156 FIXME("level %d unimplemented\n", level
);
157 ret
= ERROR_INVALID_LEVEL
;
163 /************************************************************
164 * NetStatisticsGet (NETAPI32.@)
166 NET_API_STATUS WINAPI
NetStatisticsGet(LMSTR server
, LMSTR service
,
167 DWORD level
, DWORD options
,
170 TRACE("(%p, %p, %d, %d, %p)\n", server
, service
, level
, options
, bufptr
);
171 return NERR_InternalError
;
174 DWORD WINAPI
NetpNetBiosStatusToApiStatus(DWORD nrc
)
184 ret
= NERR_NoNetworkResource
;
187 ret
= NERR_AlreadyExists
;
190 ret
= NERR_TooManyNames
;
193 ret
= NERR_DeleteLater
;
196 ret
= ERROR_REM_NOT_LIST
;
199 ret
= NERR_NameNotFound
;
202 ret
= ERROR_INVALID_PARAMETER
;
205 ret
= NERR_DuplicateName
;
208 ret
= ERROR_INVALID_PARAMETER
;
211 ret
= NERR_DuplicateName
;
214 ret
= NERR_NetworkError
;
221 NetpNtStatusToApiStatus(NTSTATUS Status
)
223 return RtlNtStatusToDosError(Status
);
226 NET_API_STATUS WINAPI
NetUseEnum(LMSTR server
, DWORD level
, LPBYTE
* bufptr
, DWORD prefmaxsize
,
227 LPDWORD entriesread
, LPDWORD totalentries
, LPDWORD resumehandle
)
229 FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server
, level
, bufptr
, prefmaxsize
,
230 entriesread
, totalentries
, resumehandle
);
231 return ERROR_NOT_SUPPORTED
;