Jason Edmeades : netapi31: Add basic support for NetServerGetInfo.
Alexandre Julliard
julliard at winehq.org
Mon Jan 18 10:58:55 CST 2010
Module: wine
Branch: master
Commit: c6be6a4bfefe9c9ff8849a91531df3d5dc56df69
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c6be6a4bfefe9c9ff8849a91531df3d5dc56df69
Author: Jason Edmeades <jason.edmeades at googlemail.com>
Date: Sat Jan 16 14:55:20 2010 -0800
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.
---
dlls/netapi32/netapi32.c | 57 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/dlls/netapi32/netapi32.c b/dlls/netapi32/netapi32.c
index 12218fc..fb4468f 100644
--- a/dlls/netapi32/netapi32.c
+++ b/dlls/netapi32/netapi32.c
@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(netbios);
static HMODULE NETAPI32_hModule;
+BOOL NETAPI_IsLocalComputer(LMCSTR ServerName);
+
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
@@ -97,8 +99,59 @@ NET_API_STATUS WINAPI NetServerEnumEx(
*/
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr)
{
- FIXME("stub (%s, %d, %p)\n", debugstr_w(servername), level, bufptr);
- return ERROR_ACCESS_DENIED;
+ 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;
}
More information about the wine-cvs
mailing list