https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ca9413ce30cb4fee42a54…
commit ca9413ce30cb4fee42a543973f40cd402f6cb2ce
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Apr 1 19:00:32 2018 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Apr 1 19:00:32 2018 +0200
[NET] Add the NET CONFIG (SERVER) command
---
base/applications/network/net/CMakeLists.txt | 1 +
base/applications/network/net/cmdConfig.c | 168 +++++++++++++++++++++++++++
base/applications/network/net/lang/en-US.rc | 9 ++
base/applications/network/net/lang/es-ES.rc | 9 ++
base/applications/network/net/lang/ro-RO.rc | 9 ++
base/applications/network/net/lang/ru-RU.rc | 9 ++
base/applications/network/net/lang/tr-TR.rc | 9 ++
base/applications/network/net/lang/zh-CN.rc | 9 ++
base/applications/network/net/lang/zh-TW.rc | 9 ++
base/applications/network/net/main.c | 2 +-
base/applications/network/net/net.h | 1 +
base/applications/network/net/resource.h | 10 ++
12 files changed, 244 insertions(+), 1 deletion(-)
diff --git a/base/applications/network/net/CMakeLists.txt
b/base/applications/network/net/CMakeLists.txt
index 94c0c17f4e..d6ce980d1c 100644
--- a/base/applications/network/net/CMakeLists.txt
+++ b/base/applications/network/net/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
list(APPEND SOURCE
main.c
cmdAccounts.c
+ cmdConfig.c
cmdContinue.c
cmdHelpMsg.c
cmdLocalGroup.c
diff --git a/base/applications/network/net/cmdConfig.c
b/base/applications/network/net/cmdConfig.c
new file mode 100644
index 0000000000..e01b2d19c7
--- /dev/null
+++ b/base/applications/network/net/cmdConfig.c
@@ -0,0 +1,168 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS net command
+ * FILE: base/applications/network/net/cmdConfig.c
+ * PROGRAMMERS: Eric Kohl <eric.kohl(a)reactos.org>
+ */
+
+#include "net.h"
+
+static
+INT
+DisplayServerConfig(VOID)
+{
+ PSERVER_INFO_102 ServerInfo = NULL;
+ PSERVER_TRANSPORT_INFO_0 TransportInfo = NULL;
+ DWORD dwRead, dwTotal, i;
+ INT nPaddedLength = 38;
+ NET_API_STATUS Status;
+
+ Status = NetServerGetInfo(NULL, 102, (PBYTE*)&ServerInfo);
+ if (Status != NERR_Success)
+ goto done;
+
+ Status = NetServerTransportEnum(NULL, 0, (PBYTE*)&TransportInfo,
+ MAX_PREFERRED_LENGTH,
+ &dwRead,
+ &dwTotal,
+ NULL);
+ if (Status != NERR_Success)
+ goto done;
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_NAME, nPaddedLength);
+ ConPrintf(StdOut, L"\\\\%s\n", ServerInfo->sv102_name);
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_COMMENT, nPaddedLength);
+ ConPrintf(StdOut, L"%s\n\n", ServerInfo->sv102_comment);
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_VERSION, nPaddedLength);
+ ConPuts(StdOut, L"...\n");
+
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_ACTIVE);
+ for (i = 0; i < dwTotal; i++)
+ {
+ ConPrintf(StdOut, L" %s (%s)\n",
+ &TransportInfo[i].svti0_transportname[8],
+ TransportInfo[i].svti0_networkaddress);
+ }
+ ConPuts(StdOut, L"\n");
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_HIDDEN, nPaddedLength);
+ ConResPuts(StdOut, (ServerInfo->sv102_hidden == SV_HIDDEN) ? IDS_GENERIC_YES :
IDS_GENERIC_NO);
+ ConPuts(StdOut, L"\n");
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_USERS, nPaddedLength);
+ ConPrintf(StdOut, L"%lu\n", ServerInfo->sv102_users);
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_FILES, nPaddedLength);
+ ConPuts(StdOut, L"...\n\n");
+
+ PrintPaddedResourceString(IDS_CONFIG_SERVER_IDLE, nPaddedLength);
+ if (ServerInfo->sv102_disc == SV_NODISC)
+ ConResPuts(StdOut, IDS_GENERIC_UNLIMITED);
+ else
+ ConPrintf(StdOut, L"%lu\n", ServerInfo->sv102_disc);
+
+done:
+ if (TransportInfo != NULL)
+ NetApiBufferFree(TransportInfo);
+
+ if (ServerInfo != NULL)
+ NetApiBufferFree(ServerInfo);
+
+ if (Status == NERR_Success)
+ ConResPuts(StdOut, IDS_ERROR_NO_ERROR);
+
+ return 0;
+}
+
+
+static
+INT
+DisplayWorkstationConfig(VOID)
+{
+ return 0;
+}
+
+
+INT
+cmdConfig(
+ INT argc,
+ WCHAR **argv)
+{
+ INT i, result = 0;
+ BOOL bServer = FALSE;
+ BOOL bWorkstation = FALSE;
+
+ for (i = 2; i < argc; i++)
+ {
+ if (_wcsicmp(argv[i], L"server") == 0)
+ {
+ if (bWorkstation == FALSE)
+ bServer = TRUE;
+ continue;
+ }
+
+ if (_wcsicmp(argv[i], L"workstation") == 0)
+ {
+ if (bServer == FALSE)
+ bWorkstation = TRUE;
+ continue;
+ }
+
+ if (_wcsicmp(argv[i], L"help") == 0)
+ {
+ /* Print short syntax help */
+ if (bServer == TRUE)
+ {
+ ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_SYNTAX);
+ }
+ else
+ {
+ ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_SYNTAX);
+ }
+ return 0;
+ }
+
+ if (_wcsicmp(argv[i], L"/help") == 0)
+ {
+ /* Print full help text*/
+ if (bServer == TRUE)
+ {
+ ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_HELP_1);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_HELP_2);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_HELP_3);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_HELP_4);
+ ConResPuts(StdOut, IDS_CONFIG_SERVER_HELP_5);
+ ConResPuts(StdOut, IDS_GENERIC_PAGE);
+ }
+ else
+ {
+ ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_SYNTAX);
+ ConResPuts(StdOut, IDS_CONFIG_HELP_1);
+ ConResPuts(StdOut, IDS_CONFIG_HELP_2);
+ }
+ return 0;
+ }
+ }
+
+ if (bServer)
+ {
+ result = DisplayServerConfig();
+ }
+ else if (bWorkstation)
+ {
+ result = DisplayWorkstationConfig();
+ }
+ else
+ {
+
+ }
+
+ return result;
+}
\ No newline at end of file
diff --git a/base/applications/network/net/lang/en-US.rc
b/base/applications/network/net/lang/en-US.rc
index 36ed77f2c9..7b09a2e222 100644
--- a/base/applications/network/net/lang/en-US.rc
+++ b/base/applications/network/net/lang/en-US.rc
@@ -156,6 +156,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "Standalone server"
IDS_ACCOUNTS_WORKSTATION "Workstation"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "Aliases for \\\\%s"
IDS_LOCALGROUP_ALIAS_NAME "Alias name"
IDS_LOCALGROUP_COMMENT "Comment"
diff --git a/base/applications/network/net/lang/es-ES.rc
b/base/applications/network/net/lang/es-ES.rc
index 05365d29fc..983d6c75a0 100644
--- a/base/applications/network/net/lang/es-ES.rc
+++ b/base/applications/network/net/lang/es-ES.rc
@@ -157,6 +157,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "Servidor independiente"
IDS_ACCOUNTS_WORKSTATION "Estación de trabajo"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "Alias de \\\\%s"
IDS_LOCALGROUP_ALIAS_NAME "Nombre del alias"
IDS_LOCALGROUP_COMMENT "Comentario"
diff --git a/base/applications/network/net/lang/ro-RO.rc
b/base/applications/network/net/lang/ro-RO.rc
index 129e2c7de4..2756723a29 100644
--- a/base/applications/network/net/lang/ro-RO.rc
+++ b/base/applications/network/net/lang/ro-RO.rc
@@ -160,6 +160,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "Server de sine stătător"
IDS_ACCOUNTS_WORKSTATION "Stație de lucru"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "Alias pentru \\\\%s"
IDS_LOCALGROUP_ALIAS_NAME "Nume alias"
IDS_LOCALGROUP_COMMENT "Comentariu"
diff --git a/base/applications/network/net/lang/ru-RU.rc
b/base/applications/network/net/lang/ru-RU.rc
index c76a6b9e93..4c9a969481 100644
--- a/base/applications/network/net/lang/ru-RU.rc
+++ b/base/applications/network/net/lang/ru-RU.rc
@@ -156,6 +156,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "Автономный сервер"
IDS_ACCOUNTS_WORKSTATION "Рабочая станция"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "Псевдонимы для \\\\%s"
IDS_LOCALGROUP_ALIAS_NAME "Имя псевдонима"
IDS_LOCALGROUP_COMMENT "Комментарий"
diff --git a/base/applications/network/net/lang/tr-TR.rc
b/base/applications/network/net/lang/tr-TR.rc
index aa38090751..3600d809d4 100644
--- a/base/applications/network/net/lang/tr-TR.rc
+++ b/base/applications/network/net/lang/tr-TR.rc
@@ -156,6 +156,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "Bağımsız sunucu"
IDS_ACCOUNTS_WORKSTATION "İş istasyonu"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "\\\\%s için başka adlar"
IDS_LOCALGROUP_ALIAS_NAME "Başka ad"
IDS_LOCALGROUP_COMMENT "Açıklama"
diff --git a/base/applications/network/net/lang/zh-CN.rc
b/base/applications/network/net/lang/zh-CN.rc
index 2adbfd68e0..783254ba9a 100644
--- a/base/applications/network/net/lang/zh-CN.rc
+++ b/base/applications/network/net/lang/zh-CN.rc
@@ -156,6 +156,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "独立服务器"
IDS_ACCOUNTS_WORKSTATION "工作站"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "\\\\%s 的别名"
IDS_LOCALGROUP_ALIAS_NAME "别名名称"
IDS_LOCALGROUP_COMMENT "注释"
diff --git a/base/applications/network/net/lang/zh-TW.rc
b/base/applications/network/net/lang/zh-TW.rc
index 1d53ee6636..e6848264ce 100644
--- a/base/applications/network/net/lang/zh-TW.rc
+++ b/base/applications/network/net/lang/zh-TW.rc
@@ -156,6 +156,15 @@ message and suggested actions you can take to solve the
problem.\n\n"
IDS_ACCOUNTS_STANDALONE_SERVER "獨立伺服器"
IDS_ACCOUNTS_WORKSTATION "工作站"
+ IDS_CONFIG_SERVER_NAME "Server Name"
+ IDS_CONFIG_SERVER_COMMENT "Server Comment"
+ IDS_CONFIG_SERVER_VERSION "Software version"
+ IDS_CONFIG_SERVER_ACTIVE "Server is active on\n"
+ IDS_CONFIG_SERVER_HIDDEN "Server hidden"
+ IDS_CONFIG_SERVER_USERS "Maximum Logged On Users"
+ IDS_CONFIG_SERVER_FILES "Maximum open files per session"
+ IDS_CONFIG_SERVER_IDLE "Idle session time (min)"
+
IDS_LOCALGROUP_ALIASES "別名 \\\\%s"
IDS_LOCALGROUP_ALIAS_NAME "別名名稱"
IDS_LOCALGROUP_COMMENT "評論"
diff --git a/base/applications/network/net/main.c b/base/applications/network/net/main.c
index 007679bf15..2b572b48d4 100644
--- a/base/applications/network/net/main.c
+++ b/base/applications/network/net/main.c
@@ -22,7 +22,7 @@ COMMAND cmds[] =
{
{L"accounts", cmdAccounts},
{L"computer", unimplemented},
- {L"config", unimplemented},
+ {L"config", cmdConfig},
{L"continue", cmdContinue},
{L"file", unimplemented},
{L"group", unimplemented},
diff --git a/base/applications/network/net/net.h b/base/applications/network/net/net.h
index eaa20b8d61..711528fb1e 100644
--- a/base/applications/network/net/net.h
+++ b/base/applications/network/net/net.h
@@ -46,6 +46,7 @@ VOID help(VOID);
INT unimplemented(INT argc, WCHAR **argv);
INT cmdAccounts(INT argc, WCHAR **argv);
+INT cmdConfig(INT argc, WCHAR **argv);
INT cmdContinue(INT argc, WCHAR **argv);
INT cmdHelp(INT argc, WCHAR **argv);
INT cmdHelpMsg(INT argc, WCHAR **argv);
diff --git a/base/applications/network/net/resource.h
b/base/applications/network/net/resource.h
index 5b37dac376..187ae2b76d 100644
--- a/base/applications/network/net/resource.h
+++ b/base/applications/network/net/resource.h
@@ -82,6 +82,16 @@
#define IDS_ACCOUNTS_STANDALONE_SERVER 212
#define IDS_ACCOUNTS_WORKSTATION 213
+#define IDS_CONFIG_SERVER_NAME 230
+#define IDS_CONFIG_SERVER_COMMENT 231
+#define IDS_CONFIG_SERVER_VERSION 232
+#define IDS_CONFIG_SERVER_ACTIVE 233
+#define IDS_CONFIG_SERVER_HIDDEN 234
+#define IDS_CONFIG_SERVER_USERS 235
+#define IDS_CONFIG_SERVER_FILES 236
+#define IDS_CONFIG_SERVER_IDLE 237
+
+
#define IDS_LOCALGROUP_ALIASES 300
#define IDS_LOCALGROUP_ALIAS_NAME 301
#define IDS_LOCALGROUP_COMMENT 302