How to use NetValidatePasswordPolicy API?  
Author Message
stevenzhang123





PostPosted: Visual C++ Language, How to use NetValidatePasswordPolicy API? Top

Hello,

Thank you in advance.

I have a question on using NetValidatePasswordPolicy API.

/// <summary>

/// NET_API_STATUS NetValidatePasswordPolicy(

/// LPCWSTR ServerName,

/// LPVOID Qualifier,

/// NET_VALIDATE_PASSWORD_TYPE ValidationType,

/// LPVOID InputArg,

/// LPVOID OutputArg

/// );

/// </summary>

[DllImport("netapi32.dll", EntryPoint = "NetValidatePasswordPolicy", SetLastError = true)]

public static extern PolicyValidationDataTypes.NET_API_STATUS NetValidatePasswordPolicy(

string ServerName

, IntPtr Qualifier

, PolicyValidationDataTypes.NET_VALIDATE_PASSWORD_TYPE validationType

, IntPtr InputArg

, out IntPtr OutputArg);

The InputArg is mysterious to me. Does anybody know how to constuct a InputArg, whose type is

NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG.

Thanks.

sincerely,

zhang



Visual C++11  
 
 
Sarath.





PostPosted: Visual C++ Language, How to use NetValidatePasswordPolicy API? Top

The type of parameter for the InputArg is depends on the "validationType" you specify.


It's clearly said in MSDN. Please check it.



 
 
stevenzhang123





PostPosted: Visual C++ Language, How to use NetValidatePasswordPolicy API? Top

I just need a sample inputArgs for "Change_Password" operation.

Can you help me out

thanks,

zhang


 
 
stevenzhang123





PostPosted: Visual C++ Language, How to use NetValidatePasswordPolicy API? Top

Got it work.

I changed the way.

Instead of using c# pinvoke approach, I call the api through Managed C++. Then call the managed c++ with C#.

The things looks much more cleaner and readable.


 
 
decdan





PostPosted: Visual C++ Language, How to use NetValidatePasswordPolicy API? Top

Any chance you could post your c++ code (I'm not a c++ person and would like to get the NetValidatePasswordPolicy

call working too)