mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[NET] Add the NET CONFIG (SERVER) command
This commit is contained in:
parent
a0b5b47352
commit
ca9413ce30
12 changed files with 244 additions and 1 deletions
|
@ -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
|
||||
|
|
168
base/applications/network/net/cmdConfig.c
Normal file
168
base/applications/network/net/cmdConfig.c
Normal file
|
@ -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@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;
|
||||
}
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 "Комментарий"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 "注释"
|
||||
|
|
|
@ -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 "評論"
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue