PwdGetPasswordStatus
This function is used to retrieve information about a password provider's password. The request is passed to the network provider through the PPGetPasswordStatus SPI. DWORD PwdGetPasswordStatus(
    LPCTSTR lpProvider,
    DWORD dwIndex,
    LPDWORD lpStatus,
    );
 
lpProvider 
Specifies the network provider who owns the password. 
dwIndex 
Type of information to retrieve. Can be one of the following: PS_ONOFF  Returns whether password is active or "turned on". Upon return, the following bits can be set in lpStatus: PS_ONOFF_ON, PS_ONOFF_OFF.  
PS_HASOLDPWD  Returns whether it is necessary to supply the previous password in order to change the current password. Upon return, the following bits can be set in lpStatus: PS_HASOLDPWD_ON, PS_HAS_OLDPWD_OFF.  
PS_SYNCMASTERPWD  Returns whether the password should be kept in sync with the logon password. Upon return, the following bits can be set in lpStatus: PS_SYNCMASTERPWD_ON, PS_SYNCMASTERPWD_OFF.  
PS_STORAGETYPE  Returns whether the password is stored locally, or in a network location. Upon return, the following bits can be set in lpStatus: PS_STORAGETYPE_LOCAL, PS_STORAGETYPE_NETWORK.  
lpStatus 
A pointer to a bit field that is filled in upon return, based upon the value of the dwIndex field passed in. See the dwIndex field above for the possible values. 
WN_SUCCESS if the call is successful. 
PwdChangePassword
This function is used to change the user's Windows password or a password provider's password. The MPR displays a dialog box for this purpose. If the Windows password is changed, the MPR re-encrypts the user's password cache with the new password. Password providers are notified through the PPChangePassword SPI. DWORD PwdChangePassword(
    LPCTSTR lpProvider,
    HWND hwndOwner,
    DWORD dwFlags
    );
 
lpProvider 
Specifies the provider to change the password for. If lpProvider is NULL, the logon password is changed. Changing the logon password can also result in other password providers being notified to change their passwords, if the user has selected to synchronize a provider's password with the logon password. 
hwndOwner 
A handle to a window which should be the owner for the dialog box displayed by the MPR. 
dwFlags 
Can be 0, or a combination of the following: CHANGEPWD_OLDPWDONLY  Displays a dialog that prompts only for the previous password. The current logon password is given to the password provider as the new password to use. This flag is ignored if PwdChangePassword is called to change the logon password (lpProvider is NULL). This flag is intended primarily for use by the system, it is not recommended that applications set this flag.  
WN_SUCCESS if the call is successful. Otherwise, an error, which includes: 
WN_CANCEL  The user canceled the operation.  

解决方案 »

  1.   

    DWORD PPChangePassword(
    LPLOGONINFO lpAuthentInfo,
    LPLOGONINFO lpPreviousAuthentInfo
    DWORD dwAction
        );
     
    lpAuthentInfo 
    A structure specifying the logged-on user's name and new password. 
    lpPreviousAuthentInfo 
    A structure specifying the user's name and old password. 
    dwAction 
    One of the following values: PWDCHANGE_MASTERPWD_NOTIFY  The Windows password has changed. The provider may wish to take some action, such as giving the new password to a network redirector.  
    PWDCHANGE_PROVIDERPWD_PENDING  The user wants to change a password maintained by the provider. This message is a first-phase notification. The provider should not change the password at this time. The provider should do any pre-commit verification that is appropriate, such as pinging a server or checking that the old password is valid, if possible.  
    PWDCHANGE_PROVIDERPWD_COMMIT  Commit-phase notification, the provider should change the password in response to this message.  
    PWDCHANGE_PROVIDERPWD_CANCEL  A provider will receive this message if it has already received a first-phase notification (PWDCHANGE_PROVIDERPWD_ PENDING) and the password-change action has been canceled (for example, in response to another provider being unable to change its password).  
    WN_SUCCESS if the call is successful. 
    PPGetPasswordStatus
    This function is used to query a password provider about the status of its password. The attributes an network provider can report are if it is on/off (enabled/disabled), if it requires typing in the old password to change it, and if the storage type is local or remote. DWORD PPGetPasswordStatus(
    DWORD     nIndex
        );
     
    nIndex 
    Can be one of the following: PS_ONOFF  Requests on/off status of password.  
    PS_HASOLDPWD  Requests "old password" status of password.  
    PS_STORAGETYPE  Requests storage type of password.  
    Can be a combination of the following bits, for each nIndex: 
    nIndex:  Valid return bits:  
    PS_ONOFF  PS_ONOFF_ON, PS_ONOFF_OFF  
    PS_HASOLDPWD  PS_HASOLDPWD_ON, PS_HASOLDPWD_OFF  
    PS_STORAGETYPE  PS_STORAGETYPE_LOCAL, PS_STORAGETYPE_NETWORK