https://git.reactos.org/?p=reactos.git;a=commitdiff;h=073607c2371f509c9c57f…
commit 073607c2371f509c9c57fb45956d26f90f537b58
Author: Marat Nagayev <nagaevmt49(a)gmail.com>
AuthorDate: Thu Jan 13 15:10:55 2022 +0000
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Jan 13 18:10:55 2022 +0300
[NET] Improve displaying status message (#4096)
- Simplify conditions
- Add application error translation function
[NET][MC] Add missing Russian (ru-RU) translation
---
base/applications/network/net/cmdUser.c | 19 +++++++++----------
base/applications/network/net/main.c | 14 ++++++++++++++
base/applications/network/net/net.h | 4 ++++
sdk/include/reactos/mc/netmsgmsg.mc | 6 +++---
4 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/base/applications/network/net/cmdUser.c
b/base/applications/network/net/cmdUser.c
index 4530e28e2ed..9dbe206a01e 100644
--- a/base/applications/network/net/cmdUser.c
+++ b/base/applications/network/net/cmdUser.c
@@ -1218,13 +1218,13 @@ cmdUser(
if (lpUserName == NULL && lpPassword == NULL)
{
Status = EnumerateUsers();
- ConPrintf(StdOut, L"Status: %lu\n", Status);
+ PrintMessageString(TranslateAppMessage(Status));
return 0;
}
else if (lpUserName != NULL && lpPassword == NULL && argc == 3)
{
Status = DisplayUser(lpUserName);
- ConPrintf(StdOut, L"Status: %lu\n", Status);
+ PrintMessageString(TranslateAppMessage(Status));
return 0;
}
@@ -1250,12 +1250,12 @@ cmdUser(
(LPBYTE*)&pUserInfo);
if (Status != NERR_Success)
{
- ConPrintf(StdOut, L"Status: %lu\n", Status);
+ PrintMessageString(TranslateAppMessage(Status));
result = 1;
goto done;
}
}
- else if (bAdd && !bDelete)
+ else if (bAdd)
{
/* Add the user */
ZeroMemory(&UserInfo, sizeof(USER_INFO_4));
@@ -1410,7 +1410,7 @@ cmdUser(
}
else
{
- ConPrintf(StdOut, L"Status %lu\n\n", Status);
+ PrintMessageString(TranslateAppMessage(Status));
result = 1;
goto done;
}
@@ -1426,25 +1426,24 @@ cmdUser(
4,
(LPBYTE)pUserInfo,
NULL);
- ConPrintf(StdOut, L"Status: %lu\n", Status);
}
- else if (bAdd && !bDelete)
+ else if (bAdd)
{
/* Add the user */
Status = NetUserAdd(NULL,
4,
(LPBYTE)pUserInfo,
NULL);
- ConPrintf(StdOut, L"Status: %lu\n", Status);
}
- else if (!bAdd && bDelete)
+ else if (bDelete)
{
/* Delete the user */
Status = NetUserDel(NULL,
lpUserName);
- ConPrintf(StdOut, L"Status: %lu\n", Status);
}
+ PrintMessageString(TranslateAppMessage(Status));
+
if (Status == NERR_Success &&
lpPassword != NULL &&
bRandomPassword == TRUE)
diff --git a/base/applications/network/net/main.c b/base/applications/network/net/main.c
index 7b3011172d6..af56a0cbc2d 100644
--- a/base/applications/network/net/main.c
+++ b/base/applications/network/net/main.c
@@ -75,6 +75,20 @@ PrintPadding(
}
+DWORD
+TranslateAppMessage(
+ DWORD dwMessage)
+{
+ switch (dwMessage)
+ {
+ case NERR_Success:
+ return 3500; // APPERR_3500
+ case ERROR_MORE_DATA:
+ return 3513; // APPERR_3513
+ }
+ return dwMessage;
+}
+
VOID
PrintMessageStringV(
DWORD dwMessage,
diff --git a/base/applications/network/net/net.h b/base/applications/network/net/net.h
index 5e88ddf6823..7840027bd1a 100644
--- a/base/applications/network/net/net.h
+++ b/base/applications/network/net/net.h
@@ -38,6 +38,10 @@ PrintPadding(
WCHAR chr,
INT nPaddedLength);
+DWORD
+TranslateAppMessage(
+ DWORD dwMessage);
+
VOID
PrintMessageString(
DWORD dwMessage);
diff --git a/sdk/include/reactos/mc/netmsgmsg.mc b/sdk/include/reactos/mc/netmsgmsg.mc
index 5e47e51e632..2b5f226b87f 100644
--- a/sdk/include/reactos/mc/netmsgmsg.mc
+++ b/sdk/include/reactos/mc/netmsgmsg.mc
@@ -2409,7 +2409,7 @@ Language=Romanian
The user name could not be found.
.
Language=Russian
-The user name could not be found.
+Не найдено имя пользователя.
.
Language=Spanish
The user name could not be found.
@@ -2467,7 +2467,7 @@ Language=Romanian
The group already exists.
.
Language=Russian
-The group already exists.
+Указанная группа уже существует.
.
Language=Spanish
The group already exists.
@@ -2496,7 +2496,7 @@ Language=Romanian
The account already exists.
.
Language=Russian
-The account already exists.
+Учётная запись уже существует.
.
Language=Spanish
The account already exists.