public static string GetMachineDomainMembership()
{
IntPtr buffer = IntPtr.Zero;
pInvokes.SafeNativeMethods.WKSTA_INFO_100 wksta_info = new pInvokes.SafeNativeMethods.WKSTA_INFO_100();
int result = pInvokes.SafeNativeMethods.NetWkstaGetInfo(null, 100, out buffer);
if (result == 0)
{
wksta_info = (pInvokes.SafeNativeMethods.WKSTA_INFO_100)Marshal.PtrToStructure(buffer, typeof(pInvokes.SafeNativeMethods.WKSTA_INFO_100));
}
else
{
LibraryLogging.Error("GetMachineDomainMembership() Error:{0} {1}", result, LastError(result));
}
if (buffer != IntPtr.Zero)
{
pInvokes.SafeNativeMethods.NetApiBufferFree(buffer);
}
return wksta_info.lan_group;
}