[DllImport("netapi32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
static extern uint NetUserModalsGet(
string server,
int level,
out IntPtr BufPtr);
None.
Do you know one? Please contribute it!
None.
Please add some!
USER_MODALS_INFO_0 objUserModalsInfo0 = new USER_MODALS_INFO_0();
IntPtr bufPtr; // because it's an OUT, we don't need to Alloc
uint lngReturn = NetUserModalsGet(@"\\" + Environment.MachineName, 0, out bufPtr);
if (lngReturn == 0)
{
objUserModalsInfo0 = (USER_MODALS_INFO_0)Marshal.PtrToStructure(bufPtr, typeof(USER_MODALS_INFO_0));
int maxPassAge = objUserModalsInfo0.usrmod0_max_passwd_age;
}
NetApiBufferFree(bufPtr);
bufPtr = IntPtr.Zero;