Author: ekohl Date: Mon May 12 12:39:58 2008 New Revision: 33479
URL: http://svn.reactos.org/svn/reactos?rev=33479&view=rev Log: Do not touch the new user name if the user cancels the rename action.
Modified: trunk/reactos/dll/cpl/usrmgr/users.c
Modified: trunk/reactos/dll/cpl/usrmgr/users.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/users.c?rev=... ============================================================================== --- trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] Mon May 12 12:39:58 2008 @@ -203,18 +203,29 @@ USER_INFO_0 useri0; NET_API_STATUS status;
+ /* Leave, if there is no valid listview item */ if (pnmv->item.iItem == -1) return FALSE;
+ /* Get the new user name */ ListView_GetItemText(pnmv->hdr.hwndFrom, pnmv->item.iItem, 0, szOldUserName, UNLEN); + + /* Leave, if the user canceled the edit action */ + if (pnmv->item.pszText == NULL) + return FALSE; + + /* Get the new user name */ lstrcpy(szNewUserName, pnmv->item.pszText);
+ /* Leave, if the user name was not changed */ if (lstrcmp(szOldUserName, szNewUserName) == 0) return FALSE;
+ + /* Change the user name */ useri0.usri0_name = szNewUserName;
#if 0 @@ -225,11 +236,12 @@ if (status != NERR_Success) { TCHAR szText[256]; - wsprintf(szText, _T("Error: %u"), status); - MessageBox(NULL, szText, _T("NetUserSetInfo"), MB_ICONERROR | MB_OK); - return FALSE; - } - + wsprintf(szText, TEXT("Error: %u"), status); + MessageBox(NULL, szText, TEXT("NetUserSetInfo"), MB_ICONERROR | MB_OK); + return FALSE; + } + + /* Update the listview item */ ListView_SetItemText(pnmv->hdr.hwndFrom, pnmv->item.iItem, 0, szNewUserName);