2006-02-17 00:04:10 +00:00
|
|
|
/* Copyright 2001 Mike McCormack
|
|
|
|
* Copyright 2003 Juan Lang
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2007-07-27 09:46:28 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-02-17 00:04:10 +00:00
|
|
|
*/
|
|
|
|
|
2013-06-13 21:20:45 +00:00
|
|
|
#include "netapi32.h"
|
2012-11-05 22:51:08 +00:00
|
|
|
|
2014-01-24 20:24:47 +00:00
|
|
|
#include <lmserver.h>
|
|
|
|
|
2014-05-03 12:53:58 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
2007-07-27 09:46:28 +00:00
|
|
|
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
switch (fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
NetBIOSInit();
|
|
|
|
NetBTInit();
|
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
2014-05-03 12:53:58 +00:00
|
|
|
if (lpvReserved) break;
|
2006-02-17 00:04:10 +00:00
|
|
|
NetBIOSShutdown();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-07-27 09:46:28 +00:00
|
|
|
/************************************************************
|
|
|
|
* NetServerEnum (NETAPI32.@)
|
|
|
|
*/
|
2006-02-17 00:04:10 +00:00
|
|
|
NET_API_STATUS WINAPI NetServerEnum(
|
2007-11-29 11:02:32 +00:00
|
|
|
LMCSTR servername,
|
2006-02-17 00:04:10 +00:00
|
|
|
DWORD level,
|
|
|
|
LPBYTE* bufptr,
|
|
|
|
DWORD prefmaxlen,
|
|
|
|
LPDWORD entriesread,
|
|
|
|
LPDWORD totalentries,
|
|
|
|
DWORD servertype,
|
2007-11-29 11:02:32 +00:00
|
|
|
LMCSTR domain,
|
2006-02-17 00:04:10 +00:00
|
|
|
LPDWORD resume_handle
|
|
|
|
)
|
|
|
|
{
|
2007-07-27 09:46:28 +00:00
|
|
|
FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername),
|
2006-02-17 00:04:10 +00:00
|
|
|
level, bufptr, prefmaxlen, entriesread, totalentries, servertype,
|
|
|
|
debugstr_w(domain), resume_handle);
|
|
|
|
|
|
|
|
return ERROR_NO_BROWSER_SERVERS_FOUND;
|
|
|
|
}
|
|
|
|
|
2007-07-27 09:46:28 +00:00
|
|
|
/************************************************************
|
|
|
|
* NetServerEnumEx (NETAPI32.@)
|
|
|
|
*/
|
|
|
|
NET_API_STATUS WINAPI NetServerEnumEx(
|
2007-11-29 11:02:32 +00:00
|
|
|
LMCSTR ServerName,
|
2007-07-27 09:46:28 +00:00
|
|
|
DWORD Level,
|
|
|
|
LPBYTE *Bufptr,
|
|
|
|
DWORD PrefMaxlen,
|
|
|
|
LPDWORD EntriesRead,
|
|
|
|
LPDWORD totalentries,
|
|
|
|
DWORD servertype,
|
2007-11-29 11:02:32 +00:00
|
|
|
LMCSTR domain,
|
|
|
|
LMCSTR FirstNameToReturn)
|
2007-07-27 09:46:28 +00:00
|
|
|
{
|
2014-05-03 12:53:58 +00:00
|
|
|
FIXME("Stub (%s %d %p %d %p %p %d %s %s)\n",
|
|
|
|
debugstr_w(ServerName), Level, Bufptr, PrefMaxlen, EntriesRead, totalentries,
|
|
|
|
servertype, debugstr_w(domain), debugstr_w(FirstNameToReturn));
|
|
|
|
|
|
|
|
return ERROR_NO_BROWSER_SERVERS_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
* NetServerDiskEnum (NETAPI32.@)
|
|
|
|
*/
|
|
|
|
NET_API_STATUS WINAPI NetServerDiskEnum(
|
|
|
|
LMSTR ServerName,
|
|
|
|
DWORD Level,
|
|
|
|
LPBYTE *Bufptr,
|
|
|
|
DWORD PrefMaxlen,
|
|
|
|
LPDWORD EntriesRead,
|
|
|
|
LPDWORD totalentries,
|
|
|
|
LPDWORD Resume_Handle)
|
|
|
|
{
|
|
|
|
FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(ServerName),
|
|
|
|
Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, Resume_Handle);
|
|
|
|
|
2007-07-27 09:46:28 +00:00
|
|
|
return ERROR_NO_BROWSER_SERVERS_FOUND;
|
|
|
|
}
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
* NetServerGetInfo (NETAPI32.@)
|
|
|
|
*/
|
|
|
|
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
|
|
|
|
{
|
2010-03-04 12:28:24 +00:00
|
|
|
NET_API_STATUS ret;
|
|
|
|
|
|
|
|
TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
|
|
|
|
if (servername)
|
|
|
|
{
|
|
|
|
if (!NETAPI_IsLocalComputer(servername))
|
|
|
|
{
|
|
|
|
FIXME("remote computers not supported\n");
|
|
|
|
return ERROR_INVALID_LEVEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!bufptr) return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case 100:
|
|
|
|
case 101:
|
|
|
|
{
|
|
|
|
DWORD computerNameLen, size;
|
|
|
|
WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
|
|
|
|
|
|
|
|
computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
|
|
|
|
GetComputerNameW(computerName, &computerNameLen);
|
|
|
|
computerNameLen++; /* include NULL terminator */
|
|
|
|
|
|
|
|
size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
|
|
|
|
ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
|
|
|
|
if (ret == NERR_Success)
|
|
|
|
{
|
|
|
|
/* INFO_100 structure is a subset of INFO_101 */
|
|
|
|
PSERVER_INFO_101 info = (PSERVER_INFO_101)*bufptr;
|
|
|
|
OSVERSIONINFOW verInfo;
|
|
|
|
|
|
|
|
info->sv101_platform_id = PLATFORM_ID_NT;
|
|
|
|
info->sv101_name = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101));
|
|
|
|
memcpy(info->sv101_name, computerName,
|
|
|
|
computerNameLen * sizeof(WCHAR));
|
|
|
|
verInfo.dwOSVersionInfoSize = sizeof(verInfo);
|
|
|
|
GetVersionExW(&verInfo);
|
|
|
|
info->sv101_version_major = verInfo.dwMajorVersion;
|
|
|
|
info->sv101_version_minor = verInfo.dwMinorVersion;
|
|
|
|
/* Use generic type as no wine equivalent of DC / Server */
|
|
|
|
info->sv101_type = SV_TYPE_NT;
|
|
|
|
info->sv101_comment = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("level %d unimplemented\n", level);
|
|
|
|
ret = ERROR_INVALID_LEVEL;
|
|
|
|
}
|
|
|
|
return ret;
|
2006-02-17 00:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
* NetStatisticsGet (NETAPI32.@)
|
|
|
|
*/
|
2007-11-29 11:02:32 +00:00
|
|
|
NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
|
2006-02-17 00:04:10 +00:00
|
|
|
DWORD level, DWORD options,
|
|
|
|
LPBYTE *bufptr)
|
|
|
|
{
|
2007-07-27 09:46:28 +00:00
|
|
|
TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
|
2006-02-17 00:04:10 +00:00
|
|
|
return NERR_InternalError;
|
|
|
|
}
|
|
|
|
|
2012-11-05 22:51:08 +00:00
|
|
|
NET_API_STATUS
|
|
|
|
WINAPI
|
|
|
|
NetpNtStatusToApiStatus(NTSTATUS Status)
|
|
|
|
{
|
2013-07-27 18:53:52 +00:00
|
|
|
NET_API_STATUS ApiStatus;
|
|
|
|
|
|
|
|
switch (Status)
|
|
|
|
{
|
|
|
|
case STATUS_SUCCESS:
|
|
|
|
ApiStatus = NERR_Success;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STATUS_INVALID_ACCOUNT_NAME:
|
|
|
|
ApiStatus = NERR_BadUsername;
|
|
|
|
break;
|
|
|
|
|
2013-08-04 10:55:09 +00:00
|
|
|
case STATUS_PASSWORD_RESTRICTION:
|
|
|
|
ApiStatus = NERR_PasswordTooShort;
|
|
|
|
break;
|
|
|
|
|
2013-07-27 18:53:52 +00:00
|
|
|
default:
|
|
|
|
ApiStatus = RtlNtStatusToDosError(Status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus;
|
2012-11-05 22:51:08 +00:00
|
|
|
}
|
|
|
|
|
2007-11-29 11:02:32 +00:00
|
|
|
NET_API_STATUS WINAPI NetUseEnum(LMSTR server, DWORD level, LPBYTE* bufptr, DWORD prefmaxsize,
|
|
|
|
LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
|
|
|
|
{
|
|
|
|
FIXME("stub (%p, %d, %p, %d, %p, %p, %p)\n", server, level, bufptr, prefmaxsize,
|
|
|
|
entriesread, totalentries, resumehandle);
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
|
|
|
}
|
2014-05-03 12:53:58 +00:00
|
|
|
|
|
|
|
NET_API_STATUS WINAPI NetScheduleJobAdd(LPCWSTR server, LPBYTE bufptr, LPDWORD jobid)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s, %p, %p)\n", debugstr_w(server), bufptr, jobid);
|
|
|
|
return NERR_Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
NET_API_STATUS WINAPI NetScheduleJobDel(LPCWSTR server, DWORD minjobid, DWORD maxjobid)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s, %d, %d)\n", debugstr_w(server), minjobid, maxjobid);
|
|
|
|
return NERR_Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
NET_API_STATUS WINAPI NetScheduleJobEnum(LPCWSTR server, LPBYTE* bufptr, DWORD prefmaxsize, LPDWORD entriesread,
|
|
|
|
LPDWORD totalentries, LPDWORD resumehandle)
|
|
|
|
{
|
|
|
|
FIXME("stub (%s, %p, %d, %p, %p, %p)\n", debugstr_w(server), bufptr, prefmaxsize, entriesread, totalentries, resumehandle);
|
|
|
|
*entriesread = 0;
|
|
|
|
*totalentries = 0;
|
|
|
|
return NERR_Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
NET_API_STATUS WINAPI NetUseGetInfo(LMSTR server, LMSTR name, DWORD level, LPBYTE *bufptr)
|
|
|
|
{
|
|
|
|
FIXME("stub (%p, %p, %d, %p)\n", server, name, level, bufptr);
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
|
|
|
|
|
|
|
}
|