Subject: | enhancement to GetServer |
I needed additional information from GetServer(...)
I added fields to the hash returned when using GetServer(...,\%hash)
The keys are the names of the properties in the SERVERINFO_101 structure.
I imported the source for v 0.26 into subversion, checked it out, made changes and then did a diff. Attached is that diff.
Index: NetAdmin/NetAdmin.xs
===================================================================
--- NetAdmin/NetAdmin.xs (revision 1)
+++ NetAdmin/NetAdmin.xs (working copy)
@@ -1939,20 +1939,56 @@
AllocWideName((char*)SvPV(ST(0),n_a), lpwServer);
AllocWideName((char*)SvPV(ST(1),n_a), lpwDomain);
do {
- lastError = NetServerEnum(lpwServer, 101,
+ lastError = NetServerEnum(lpwServer,
+ 101,
(LPBYTE*) &pwzServerInfo101,
- PREFLEN, &entriesRead,
- &totalEntries, (DWORD)SvIV(ST(2)),
- lpwDomain, &resumeHandle);
+ PREFLEN,
+ &entriesRead,
+ &totalEntries,
+ (DWORD)SvIV(ST(2)),
+ lpwDomain,
+ &resumeHandle);
+
if (lastError != 0 && lastError != ERROR_MORE_DATA)
break;
+
+
for (index = 0; index < entriesRead; ++index) {
+ HV* inHV;
+ inHV=newHV();
W2AHELPER(pwzServerInfo101[index].sv101_name, buffer,
sizeof(buffer));
W2AHELPER(pwzServerInfo101[index].sv101_comment, buffer1,
sizeof(buffer1));
+
+ hv_store((HV*)inHV,
+ "sv101_name",strlen("sv101_name"),
+ newSVpv(buffer,0),0);
+
+ hv_store((HV*)inHV,
+ "sv101_comment",strlen("sv101_comment"),
+ newSVpv(buffer1,0),0);
+
+ hv_store((HV*)inHV,
+ "sv101_platform_id",strlen("sv101_platform_id"),
+ newSVuv(pwzServerInfo101[index].sv101_platform_id),0);
+
+ hv_store((HV*)inHV,
+ "sv101_version_major",strlen("sv101_version_major"),
+ newSVuv(pwzServerInfo101[index].sv101_version_major),0);
+
+ hv_store((HV*)inHV,
+ "sv101_version_minor",strlen("sv101_version_minor"),
+ newSVuv(pwzServerInfo101[index].sv101_version_minor),0);
+
+ hv_store((HV*)inHV,
+ "sv101_type",strlen("sv101_type"),
+ newSVuv(pwzServerInfo101[index].sv101_type),0);
+
+
hv_store((HV*)sv, buffer, strlen(buffer),
- newSVpv(buffer1,0), 0 );
+ newRV(inHV),0);
+
}
NetApiBufferFree(pwzServerInfo101);
} while(lastError == ERROR_MORE_DATA);