mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
net.exe: Lists existing NetUse connections.
This commit is contained in:
parent
25a612b8f3
commit
26b182fd92
@ -37,4 +37,7 @@ STRINGTABLE
|
|||||||
STRING_STOP_SVC_SUCCESS, "The %s service was stopped successfully.\n"
|
STRING_STOP_SVC_SUCCESS, "The %s service was stopped successfully.\n"
|
||||||
STRING_STOP_SVC_FAIL, "The %s service failed to stop.\n"
|
STRING_STOP_SVC_FAIL, "The %s service failed to stop.\n"
|
||||||
STRING_HELP_USAGE, "The syntax of this command is:\n\nNET HELP command\n -or-\nNET command /HELP\n\n Commands available are:\n NET HELP NET START NET STOP\n"
|
STRING_HELP_USAGE, "The syntax of this command is:\n\nNET HELP command\n -or-\nNET command /HELP\n\n Commands available are:\n NET HELP NET START NET STOP\n"
|
||||||
|
STRING_NO_ENTRIES, "There are no entries in the list.\n"
|
||||||
|
STRING_USE_HEADER, "\nStatus Local Remote\n---------------------------------------------------------------\n"
|
||||||
|
STRING_USE_ENTRY, "%s %S %S Open resources: %lu\n"
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ SRCDIR = @srcdir@
|
|||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
MODULE = net.exe
|
MODULE = net.exe
|
||||||
APPMODE = -mconsole
|
APPMODE = -mconsole
|
||||||
IMPORTS = user32 advapi32 kernel32
|
IMPORTS = netapi32 user32 advapi32 kernel32
|
||||||
|
|
||||||
C_SRCS = net.c
|
C_SRCS = net.c
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <lm.h>
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
|
||||||
#define NET_START 0001
|
#define NET_START 0001
|
||||||
@ -36,6 +37,45 @@ int output_string(int msg, ...)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL net_use(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
USE_INFO_2 *buffer, *connection;
|
||||||
|
DWORD read, total, resume_handle, rc, i;
|
||||||
|
const char *status_description[] = { "OK", "Paused", "Disconnected", "An error occurred",
|
||||||
|
"A network error occurred", "Connection is being made",
|
||||||
|
"Reconnecting" };
|
||||||
|
resume_handle = 0;
|
||||||
|
buffer = NULL;
|
||||||
|
|
||||||
|
if(argc<3)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
rc = NetUseEnum(NULL, 2, (BYTE **) &buffer, 2048, &read, &total, &resume_handle);
|
||||||
|
if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(total == 0)
|
||||||
|
{
|
||||||
|
output_string(STRING_NO_ENTRIES);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
output_string(STRING_USE_HEADER);
|
||||||
|
for (i = 0, connection = buffer; i < read; ++i, ++connection)
|
||||||
|
output_string(STRING_USE_ENTRY, status_description[connection->ui2_status], connection->ui2_local,
|
||||||
|
connection->ui2_remote, connection->ui2_refcount);
|
||||||
|
|
||||||
|
if (buffer != NULL) NetApiBufferFree(buffer);
|
||||||
|
} while (rc == ERROR_MORE_DATA);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle)
|
static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle)
|
||||||
{
|
{
|
||||||
LPENUM_SERVICE_STATUS dependencies = NULL;
|
LPENUM_SERVICE_STATUS dependencies = NULL;
|
||||||
@ -159,5 +199,10 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!strcasecmp(argv[1], "use"))
|
||||||
|
{
|
||||||
|
if(!net_use(argc, argv)) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,3 +30,6 @@
|
|||||||
#define STRING_STOP_SVC_SUCCESS 112
|
#define STRING_STOP_SVC_SUCCESS 112
|
||||||
#define STRING_STOP_SVC_FAIL 113
|
#define STRING_STOP_SVC_FAIL 113
|
||||||
#define STRING_HELP_USAGE 114
|
#define STRING_HELP_USAGE 114
|
||||||
|
#define STRING_NO_ENTRIES 115
|
||||||
|
#define STRING_USE_HEADER 116
|
||||||
|
#define STRING_USE_ENTRY 117
|
||||||
|
Loading…
Reference in New Issue
Block a user