Search code examples
c++windowspasswordslocal-security-policy

password history requirements - windows


In windows local group policy, we have the minimum password length, password history requirements etc. So i would like to retrieve the minimum password length and password history requirement programatically using c++


Solution

  • Found the solution

    We can use window's NET_API_STATUS NetUserModalsGet(
      _In_opt_  LPCWSTR servername,
      _In_      DWORD level,
      _Out_     LPBYTE *bufptr
    );    API and access the structure _USER_MODALS_INFO_0 to retrieve the minimum length and password history requirement 
    ie minlenght =bufptr->usrmod0_min_passwd_len; 
       minhistReq=bufptr->usrmod0_min_passwd_age;