userprops.c (f07741e6) | userprops.c (8532f187) |
---|---|
1/* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS User Manager Control Panel 4 * FILE: dll/cpl/usrmgr/userprops.c 5 * PURPOSE: User property sheet 6 * 7 * PROGRAMMERS: Eric Kohl 8 */ --- 73 unchanged lines hidden (view full) --- 82} 83 84 85static BOOL 86SetUserProfileData(HWND hwndDlg, 87 PPROFILE_USER_DATA pUserData) 88{ 89 PUSER_INFO_3 pUserInfo = NULL; | 1/* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS User Manager Control Panel 4 * FILE: dll/cpl/usrmgr/userprops.c 5 * PURPOSE: User property sheet 6 * 7 * PROGRAMMERS: Eric Kohl 8 */ --- 73 unchanged lines hidden (view full) --- 82} 83 84 85static BOOL 86SetUserProfileData(HWND hwndDlg, 87 PPROFILE_USER_DATA pUserData) 88{ 89 PUSER_INFO_3 pUserInfo = NULL; |
90 LPTSTR pszProfilePath = NULL; 91 LPTSTR pszScriptPath = NULL; 92 LPTSTR pszHomeDir = NULL; 93 LPTSTR pszHomeDrive = NULL; | |
94 NET_API_STATUS status; 95 DWORD dwIndex; | 90 NET_API_STATUS status; 91 DWORD dwIndex; |
96 INT nLength; | |
97 INT nIndex; 98 99 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); 100 101 /* Get the profile path */ | 92 INT nIndex; 93 94 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); 95 96 /* Get the profile path */ |
102 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_PATH)); 103 if (nLength == 0) 104 { 105 pUserInfo->usri3_profile = NULL; 106 } 107 else 108 { 109 pszProfilePath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 110 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_PATH, pszProfilePath, nLength + 1); 111 pUserInfo->usri3_profile = pszProfilePath; 112 } | 97 pUserInfo->usri3_profile = GetDlgItemTextAlloc(hwndDlg, IDC_USER_PROFILE_PATH); |
113 114 /* Get the script path */ | 98 99 /* Get the script path */ |
115 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_SCRIPT)); 116 if (nLength == 0) 117 { 118 pUserInfo->usri3_script_path = NULL; 119 } 120 else 121 { 122 pszScriptPath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 123 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_SCRIPT, pszScriptPath, nLength + 1); 124 pUserInfo->usri3_script_path = pszScriptPath; 125 } | 100 pUserInfo->usri3_script_path = GetDlgItemTextAlloc(hwndDlg, IDC_USER_PROFILE_SCRIPT); |
126 127 if (IsDlgButtonChecked(hwndDlg, IDC_USER_PROFILE_LOCAL) == BST_CHECKED) 128 { 129 /* Local home directory */ | 101 102 if (IsDlgButtonChecked(hwndDlg, IDC_USER_PROFILE_LOCAL) == BST_CHECKED) 103 { 104 /* Local home directory */ |
130 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH)); 131 if (nLength == 0) 132 { 133 pUserInfo->usri3_home_dir = NULL; 134 } 135 else 136 { 137 pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 138 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH, pszHomeDir, nLength + 1); 139 pUserInfo->usri3_home_dir = pszHomeDir; 140 } | 105 pUserInfo->usri3_home_dir = GetDlgItemTextAlloc(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH); |
141 } 142 else 143 { 144 /* Remote home directory */ | 106 } 107 else 108 { 109 /* Remote home directory */ |
145 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH)); 146 if (nLength == 0) 147 { 148 pUserInfo->usri3_home_dir = NULL; 149 } 150 else 151 { 152 pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 153 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH, pszHomeDir, nLength + 1); 154 pUserInfo->usri3_home_dir = pszHomeDir; 155 } | 110 pUserInfo->usri3_home_dir = GetDlgItemTextAlloc(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH); |
156 157 nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETCURSEL, 0, 0); 158 if (nIndex != CB_ERR) 159 { | 111 112 nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETCURSEL, 0, 0); 113 if (nIndex != CB_ERR) 114 { |
160 nLength = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETLBTEXTLEN, nIndex, 0); 161 pszHomeDrive = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 162 SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETLBTEXT, nIndex, (LPARAM)pszHomeDrive); 163 pUserInfo->usri3_home_dir_drive = pszHomeDrive; | 115 pUserInfo->usri3_home_dir_drive = 116 GetComboBoxLBTextAlloc(hwndDlg, IDC_USER_PROFILE_DRIVE, nIndex); |
164 } | 117 } |
118 else 119 { 120 pUserInfo->usri3_home_dir_drive = 121 HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TCHAR)); 122 } |
|
165 } 166 167 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); 168 if (status != NERR_Success) 169 { 170 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex); 171 } 172 | 123 } 124 125 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); 126 if (status != NERR_Success) 127 { 128 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex); 129 } 130 |
173 if (pszProfilePath) 174 HeapFree(GetProcessHeap(), 0, pszProfilePath); | 131 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_profile); 132 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_script_path); 133 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_home_dir); 134 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_home_dir_drive); |
175 | 135 |
176 if (pszScriptPath) 177 HeapFree(GetProcessHeap(), 0, pszScriptPath); 178 179 if (pszHomeDir) 180 HeapFree(GetProcessHeap(), 0, pszHomeDir); 181 182 if (pszHomeDrive) 183 HeapFree(GetProcessHeap(), 0, pszHomeDrive); 184 | |
185 NetApiBufferFree(pUserInfo); 186 187 return (status == NERR_Success); 188} 189 190 191INT_PTR CALLBACK 192UserProfilePageProc(HWND hwndDlg, --- 545 unchanged lines hidden (view full) --- 738} 739 740 741static BOOL 742SetUserGeneralData(HWND hwndDlg, 743 PGENERAL_USER_DATA pUserData) 744{ 745 PUSER_INFO_3 pUserInfo = NULL; | 136 NetApiBufferFree(pUserInfo); 137 138 return (status == NERR_Success); 139} 140 141 142INT_PTR CALLBACK 143UserProfilePageProc(HWND hwndDlg, --- 545 unchanged lines hidden (view full) --- 689} 690 691 692static BOOL 693SetUserGeneralData(HWND hwndDlg, 694 PGENERAL_USER_DATA pUserData) 695{ 696 PUSER_INFO_3 pUserInfo = NULL; |
746 LPTSTR pszFullName = NULL; 747 LPTSTR pszComment = NULL; | |
748 NET_API_STATUS status; 749 DWORD dwIndex; | 697 NET_API_STATUS status; 698 DWORD dwIndex; |
750 INT nLength; | |
751 752 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); 753 754 pUserInfo->usri3_flags = 755 (pUserData->dwFlags & VALID_GENERAL_FLAGS) | 756 (pUserInfo->usri3_flags & ~VALID_GENERAL_FLAGS); 757 758 pUserInfo->usri3_password_expired = pUserData->dwPasswordExpired; 759 | 699 700 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo); 701 702 pUserInfo->usri3_flags = 703 (pUserData->dwFlags & VALID_GENERAL_FLAGS) | 704 (pUserInfo->usri3_flags & ~VALID_GENERAL_FLAGS); 705 706 pUserInfo->usri3_password_expired = pUserData->dwPasswordExpired; 707 |
760 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_GENERAL_FULL_NAME)); 761 if (nLength == 0) 762 { 763 pUserInfo->usri3_full_name = NULL; 764 } 765 else 766 { 767 pszFullName = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 768 GetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, pszFullName, nLength + 1); 769 pUserInfo->usri3_full_name = pszFullName; 770 } | 708 /* Get full name */ 709 pUserInfo->usri3_full_name = GetDlgItemTextAlloc(hwndDlg, IDC_USER_GENERAL_FULL_NAME); |
771 | 710 |
772 nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_GENERAL_DESCRIPTION)); 773 if (nLength == 0) 774 { 775 pUserInfo->usri3_full_name = NULL; 776 } 777 else 778 { 779 pszComment = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR)); 780 GetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, pszComment, nLength + 1); 781 pUserInfo->usri3_comment = pszComment; 782 } | 711 /* Get desciption */ 712 pUserInfo->usri3_comment = GetDlgItemTextAlloc(hwndDlg, IDC_USER_GENERAL_DESCRIPTION); |
783 784 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); 785 if (status != NERR_Success) 786 { 787 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex); 788 } 789 | 713 714 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex); 715 if (status != NERR_Success) 716 { 717 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex); 718 } 719 |
790 if (pszFullName) 791 HeapFree(GetProcessHeap(), 0, pszFullName); | 720 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_full_name); 721 HeapFree(GetProcessHeap(), 0, pUserInfo->usri3_comment); |
792 | 722 |
793 if (pszComment) 794 HeapFree(GetProcessHeap(), 0, pszComment); 795 | |
796 NetApiBufferFree(pUserInfo); 797 798 return (status == NERR_Success); 799} 800 801 802INT_PTR CALLBACK 803UserGeneralPageProc(HWND hwndDlg, --- 133 unchanged lines hidden --- | 723 NetApiBufferFree(pUserInfo); 724 725 return (status == NERR_Success); 726} 727 728 729INT_PTR CALLBACK 730UserGeneralPageProc(HWND hwndDlg, --- 133 unchanged lines hidden --- |