Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than advapi32, prefix the name with the module name and a period.
// Don't use a managed string, you can't securely clean that up.
// Use Marshal.SecureStringToBSTR() and Marshal.ZeroFreeBSTR() to get and clean up a native string pointer.
public IntPtr ClearPassword;
[MarshalAs(UnmanagedType.LPWStr)]
public string UserAccountName;
public NET_VALIDATE_PASSWORD_HASH HashedPassword;
[MarshalAs(UnmanagedType.I1)]
public bool PasswordMatched;
}
[MarshalAs(UnmanagedType.LPWStr)]
public string ClearPassword;
[MarshalAs(UnmanagedType.LPWStr)]
public string UserAccountName;
public NET_VALIDATE_PASSWORD_HASH HashedPassword;
[MarshalAs(UnmanagedType.I1)]
public bool PasswordMustChangeAtNextLogon;
[MarshalAs(UnmanagedType.I1)]
public bool ClearLockout;
public bool PasswordMatched;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct NET_VALIDATE_PERSISTED_FIELDS
internal struct NET_VALIDATE_PASSWORD_RESET_INPUT_ARG
{
public uint PresentFields;
public ComTypes.FILETIME PasswordLastSet;
public ComTypes.FILETIME BadPasswordTime;
public ComTypes.FILETIME LockoutTime;
public uint BadPasswordCount;
public uint PasswordHistoryLength;
public IntPtr PasswordHistory;
}
public NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;
internal enum NET_API_STATUS : uint
[MarshalAs(UnmanagedType.LPWStr)]
public string ClearPassword;
[MarshalAs(UnmanagedType.LPWStr)]
public string UserAccountName;
public NET_VALIDATE_PASSWORD_HASH HashedPassword;
[MarshalAs(UnmanagedType.I1)]
public bool PasswordMustChangeAtNextLogon;
[MarshalAs(UnmanagedType.I1)]
public bool ClearLockout;
}
try
{
inputArgs.ClearPassword = Marshal.StringToBSTR(@"password");
// If using a secure string
//inputArgs.ClearPassword = Marshal.SecureStringToBSTR(secureStringPassword);
NET_API_STATUS status = NetValidatePasswordPolicy(serverName, IntPtr.Zero, NET_VALIDATE_PASSWORD_TYPE.NetValidatePasswordChange, inputPointer, out outputPointerPointer);
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).