[IDL][NETAPI32][SRVSVC] Hack around another midl/rpcrt4 bug

NETAPI32: Get rid of the old WINE NetServerGetInfo and replace it by a proper call to NetrServerGetInfo.
SRVSVC: Implement parts of NetrServerGetInfo.
srvsvc.idl: Hack around a bug in midl or rpcrt4. They are not able to handle a pointer to a union of pointers to structs. A pointer to a union of structs works a advertised.
This commit is contained in:
Eric Kohl 2018-05-06 16:49:24 +02:00
parent 93edd2a185
commit 12bdbe5710
4 changed files with 143 additions and 70 deletions

View file

@ -18,8 +18,6 @@
#include "netapi32.h"
#include <lmserver.h>
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
@ -40,64 +38,3 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
/************************************************************
* NetServerGetInfo (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
{
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;
}

View file

@ -364,7 +364,6 @@ NetServerDiskEnum(
}
#if 0
NET_API_STATUS
WINAPI
NetServerGetInfo(
@ -383,7 +382,7 @@ NetServerGetInfo(
{
status = NetrServerGetInfo(servername,
level,
(LPSERVER_INFO)bufptr);
(LPSERVER_INFO *)bufptr);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
@ -393,7 +392,6 @@ NetServerGetInfo(
return status;
}
#endif
NET_API_STATUS