コード例 #1
0
ファイル: users.c プロジェクト: HBelusca/NasuTek-Odyssey
INT_PTR CALLBACK
ChangePasswordDlgProc(HWND hwndDlg,
                      UINT uMsg,
                      WPARAM wParam,
                      LPARAM lParam)
{
    UNREFERENCED_PARAMETER(wParam);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDOK:
                    if (CheckPasswords(hwndDlg, IDC_EDIT_PASSWORD1, IDC_EDIT_PASSWORD2))
                        EndDialog(hwndDlg, 0);
                    break;

                case IDCANCEL:
                    EndDialog(hwndDlg, 0);
                    break;
            }
            break;

        default:
            return FALSE;
    }

    return TRUE;
}
コード例 #2
0
ファイル: users.c プロジェクト: GYGit/reactos
INT_PTR CALLBACK
ChangePasswordDlgProc(HWND hwndDlg,
                      UINT uMsg,
                      WPARAM wParam,
                      LPARAM lParam)
{
    PUSER_INFO_1003 userInfo;
    INT nLength;

    UNREFERENCED_PARAMETER(wParam);

    userInfo = (PUSER_INFO_1003)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            userInfo = (PUSER_INFO_1003)lParam;
            SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDOK:
                    if (CheckPasswords(hwndDlg, IDC_EDIT_PASSWORD1, IDC_EDIT_PASSWORD2))
                    {

                        /* Store the password */
                        nLength = SendDlgItemMessage(hwndDlg, IDC_EDIT_PASSWORD1, WM_GETTEXTLENGTH, 0, 0);
                        if (nLength > 0)
                        {
                            userInfo->usri1003_password = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
                            GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD1, userInfo->usri1003_password, nLength + 1);
                        }

                        EndDialog(hwndDlg, IDOK);
                    }
                    break;

                case IDCANCEL:
                    EndDialog(hwndDlg, IDCANCEL);
                    break;
            }
            break;

        default:
            return FALSE;
    }

    return TRUE;
}
コード例 #3
0
ファイル: users.c プロジェクト: HBelusca/NasuTek-Odyssey
INT_PTR CALLBACK
NewUserDlgProc(HWND hwndDlg,
               UINT uMsg,
               WPARAM wParam,
               LPARAM lParam)
{
    PUSER_INFO_3 userInfo;
    INT nLength;

    UNREFERENCED_PARAMETER(wParam);

    userInfo = (PUSER_INFO_3)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            userInfo = (PUSER_INFO_3)lParam;
            SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
            SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, EM_SETLIMITTEXT, 20, 0);
            UpdateUserOptions(hwndDlg, userInfo, TRUE);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_USER_NEW_NAME:
                    if (HIWORD(wParam) == EN_CHANGE)
                    {
                        nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);
                        EnableWindow(GetDlgItem(hwndDlg, IDOK), (nLength > 0));
                    }
                    break;

                case IDC_USER_NEW_FORCE_CHANGE:
                    userInfo->usri3_password_expired = !userInfo->usri3_password_expired;
                    UpdateUserOptions(hwndDlg, userInfo, FALSE);
                    break;

                case IDC_USER_NEW_CANNOT_CHANGE:
                    userInfo->usri3_flags ^= UF_PASSWD_CANT_CHANGE;
                    UpdateUserOptions(hwndDlg, userInfo, FALSE);
                    break;

                case IDC_USER_NEW_NEVER_EXPIRES:
                    userInfo->usri3_flags ^= UF_DONT_EXPIRE_PASSWD;
                    UpdateUserOptions(hwndDlg, userInfo, FALSE);
                    break;

                case IDC_USER_NEW_DISABLED:
                    userInfo->usri3_flags ^= UF_ACCOUNTDISABLE;
                    break;

                case IDOK:
                    if (!CheckAccountName(hwndDlg, IDC_USER_NEW_NAME, NULL))
                    {
                        SetFocus(GetDlgItem(hwndDlg, IDC_USER_NEW_NAME));
                        SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, EM_SETSEL, 0, -1);
                        break;
                    }

                    if (!CheckPasswords(hwndDlg, IDC_USER_NEW_PASSWORD1, IDC_USER_NEW_PASSWORD2))
                    {
                        SetDlgItemText(hwndDlg, IDC_USER_NEW_PASSWORD1, TEXT(""));
                        SetDlgItemText(hwndDlg, IDC_USER_NEW_PASSWORD2, TEXT(""));
                        break;
                    }

                    /* Store the user name */
                    nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);
                    if (nLength > 0)
                    {
                        userInfo->usri3_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
                        GetDlgItemText(hwndDlg, IDC_USER_NEW_NAME, userInfo->usri3_name, nLength + 1);
                    }

                    /* Store the full user name */
                    nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_FULL_NAME, WM_GETTEXTLENGTH, 0, 0);
                    if (nLength > 0)
                    {
                        userInfo->usri3_full_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
                        GetDlgItemText(hwndDlg, IDC_USER_NEW_FULL_NAME, userInfo->usri3_full_name, nLength + 1);
                    }

                    /* Store the description */
                    nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_DESCRIPTION, WM_GETTEXTLENGTH, 0, 0);
                    if (nLength > 0)
                    {
                        userInfo->usri3_comment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
                        GetDlgItemText(hwndDlg, IDC_USER_NEW_DESCRIPTION, userInfo->usri3_comment, nLength + 1);
                    }

                    /* Store the password */
                    nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_PASSWORD1, WM_GETTEXTLENGTH, 0, 0);
                    if (nLength > 0)
                    {
                        userInfo->usri3_password = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
                        GetDlgItemText(hwndDlg, IDC_USER_NEW_PASSWORD1, userInfo->usri3_password, nLength + 1);
                    }

                    EndDialog(hwndDlg, IDOK);
                    break;

                case IDCANCEL:
                    EndDialog(hwndDlg, IDCANCEL);
                    break;
            }
            break;

        default:
            return FALSE;
    }

    return TRUE;
}