Commit c6be6a4b authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

netapi31: Add basic support for NetServerGetInfo.

Based on code from NetWkstaGetInfo, and retrieves the basic system information. Note the 'type' field is a little generic as there is currently no concept of domain controllers, servers or workstation so I used the most accurate value I could.
parent 516d54bf
...@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(netbios); ...@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(netbios);
static HMODULE NETAPI32_hModule; static HMODULE NETAPI32_hModule;
BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved); TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
...@@ -97,8 +99,59 @@ NET_API_STATUS WINAPI NetServerEnumEx( ...@@ -97,8 +99,59 @@ NET_API_STATUS WINAPI NetServerEnumEx(
*/ */
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr) NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
{ {
FIXME("stub (%s, %d, %p)\n", debugstr_w(servername), level, bufptr); NET_API_STATUS ret;
return ERROR_ACCESS_DENIED;
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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment