2012-11-14 3 views
1

로컬 및/또는 전역 암호 정책 (읽기/쓰기 정책 설정)을 사용하기위한 API가 있습니까?암호 정책 Windows API

순 계정

무엇 API는 설정을 읽는 데 사용할 않습니다

:

나는 윈도우 명령이 발견? 관리자 권한으로 프로그래밍 방식으로 설정을 변경할 수 있습니까?

답변

-1
+0

글로벌/로컬 암호 정책 관련되지 않은 첫 번째 글에서 예를 참조하십시오. 사용자 플래그를 설정합니다. 특정 워크 스테이션에 대해 최소한 로컬 암호 정책을 설정하는 API를 찾고 있습니다. 두 번째 기사에서 나는 f.e를 바꾸기 위해 사용해야하는 API를 이해하지 못한다. 최소 암호 사용 기간 또는 암호 복잡성 사용 불가능. – ohavryl

2

사용이 netapi32.lib에 NetUserModalsGet() 함수를 사용할 수 있습니다.

https://msdn.microsoft.com/en-us/library/aa370656(VS.85).aspx

NetUserModalsGet

struct USER_MODALS_INFO_0 
{ 
    DWORD usrmod0_min_passwd_len; 
    DWORD usrmod0_max_passwd_age; 
    DWORD usrmod0_min_passwd_age 
    DWORD usrmod0_force_logoff; 
    DWORD usrmod0_password_hist_len; 
} 
PUSER_MODALS_INFO_0 = ^USER_MODALS_INFO_0;  

PUSER_MODALS_INFO_0 info0; 

NET_API_STATUS res = NetUserModalsGet(nil, 0, out info0); 

if (res <> NERR_Success) 
    RaiseWin32Error(res); 
try 
    //Specifies the minimum allowable password length. 
    //Valid values for this element are zero through PWLEN. 
    Log(info0.usrmod0_min_passwd_len); 

    //Specifies, in seconds, the maximum allowable password age. 
    //A value of TIMEQ_FOREVER indicates that the password never expires. 
    //The minimum valid value for this element is ONE_DAY. 
    //The value specified must be greater than or equal to the value for the usrmod0_min_passwd_age member. 
    Log(info0.usrmod0_max_passwd_age); 

    //Specifies the minimum number of seconds that can elapse between the time 
    //a password changes and when it can be changed again. 
    //A value of zero indicates that no delay is required between password updates. 
    //The value specified must be less than or equal to the value for the usrmod0_max_passwd_age member. 
    Log(info0.usrmod0_min_passwd_age); 

    //Specifies, in seconds, the amount of time between the end of the valid 
    // logon time and the time when the user is forced to log off the network. 
    //A value of TIMEQ_FOREVER indicates that the user is never forced to log off. 
    //A value of zero indicates that the user will be forced to log off immediately when the valid logon time expires. 
    Log(info0.usrmod0_force_logoff); 

    //Specifies the length of password hi'+'story maintained. 
    //A new password cannot match any of the previous usrmod0_password_hist_len passwords. 
    //Valid values for this element are zero through DEF_MAX_PWHIST 
    Log(info0.usrmod0_password_hist_len); 
finally 
    NetApiBufferFree(info0); 
end;