Commit d8624c04 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

net: Convert to Unicode.

parent 9432b8e7
...@@ -8317,7 +8317,7 @@ msgid "" ...@@ -8317,7 +8317,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8487,7 +8487,7 @@ msgid "" ...@@ -8487,7 +8487,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8233,7 +8233,7 @@ msgid "" ...@@ -8233,7 +8233,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8857,7 +8857,7 @@ msgid "" ...@@ -8857,7 +8857,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8920,8 +8920,8 @@ msgstr "" ...@@ -8920,8 +8920,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Åbne resourser: %lu\n" msgstr "%s %s %s Åbne resourser: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8906,8 +8906,8 @@ msgstr "" ...@@ -8906,8 +8906,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Offene Ressourcen: %lu\n" msgstr "%s %s %s Offene Ressourcen: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8366,7 +8366,7 @@ msgid "" ...@@ -8366,7 +8366,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8546,8 +8546,8 @@ msgstr "" ...@@ -8546,8 +8546,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Open resources: %lu\n" msgstr "%s %s %s Open resources: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8654,8 +8654,8 @@ msgstr "" ...@@ -8654,8 +8654,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Open resources: %lu\n" msgstr "%s %s %s Open resources: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8491,7 +8491,7 @@ msgid "" ...@@ -8491,7 +8491,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -9085,7 +9085,7 @@ msgid "" ...@@ -9085,7 +9085,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8319,7 +8319,7 @@ msgid "" ...@@ -8319,7 +8319,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8572,7 +8572,7 @@ msgid "" ...@@ -8572,7 +8572,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8745,8 +8745,8 @@ msgstr "" ...@@ -8745,8 +8745,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Ressources ouvertes : %lu\n" msgstr "%s %s %s Ressources ouvertes : %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8755,8 +8755,8 @@ msgstr "" ...@@ -8755,8 +8755,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Open resources: %lu\n" msgstr "%s %s %s Open resources: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8228,7 +8228,7 @@ msgid "" ...@@ -8228,7 +8228,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8767,7 +8767,7 @@ msgid "" ...@@ -8767,7 +8767,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -9006,8 +9006,8 @@ msgstr "" ...@@ -9006,8 +9006,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Risorse aperte: %lu\n" msgstr "%s %s %s Risorse aperte: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8641,8 +8641,8 @@ msgstr "" ...@@ -8641,8 +8641,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S リソース数: %lu\n" msgstr "%s %s %s リソース数: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8617,8 +8617,8 @@ msgstr "" ...@@ -8617,8 +8617,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S 열린 리소스: %lu\n" msgstr "%s %s %s 열린 리소스: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8668,8 +8668,8 @@ msgstr "" ...@@ -8668,8 +8668,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Atverti ištekliai: %lu\n" msgstr "%s %s %s Atverti ištekliai: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8228,7 +8228,7 @@ msgid "" ...@@ -8228,7 +8228,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8922,8 +8922,8 @@ msgstr "" ...@@ -8922,8 +8922,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Åpne ressurser: %lu\n" msgstr "%s %s %s Åpne ressurser: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8808,8 +8808,8 @@ msgstr "" ...@@ -8808,8 +8808,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Open resources: %lu\n" msgstr "%s %s %s Open resources: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8228,7 +8228,7 @@ msgid "" ...@@ -8228,7 +8228,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8228,7 +8228,7 @@ msgid "" ...@@ -8228,7 +8228,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8672,8 +8672,8 @@ msgstr "" ...@@ -8672,8 +8672,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Otwarte zasoby: %lu\n" msgstr "%s %s %s Otwarte zasoby: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8950,8 +8950,8 @@ msgstr "" ...@@ -8950,8 +8950,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Recursos disponíveis: %lu\n" msgstr "%s %s %s Recursos disponíveis: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -9003,8 +9003,8 @@ msgstr "" ...@@ -9003,8 +9003,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Recursos disponíveis: %lu\n" msgstr "%s %s %s Recursos disponíveis: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8281,7 +8281,7 @@ msgid "" ...@@ -8281,7 +8281,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -9239,8 +9239,8 @@ msgstr "" ...@@ -9239,8 +9239,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Resurse deschise: %lu\n" msgstr "%s %s %s Resurse deschise: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8662,8 +8662,8 @@ msgstr "" ...@@ -8662,8 +8662,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Открытых ресурсов: %lu\n" msgstr "%s %s %s Открытых ресурсов: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8525,7 +8525,7 @@ msgid "" ...@@ -8525,7 +8525,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8693,8 +8693,8 @@ msgstr "" ...@@ -8693,8 +8693,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Odprta sredstva: %lu\n" msgstr "%s %s %s Odprta sredstva: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8635,7 +8635,7 @@ msgid "" ...@@ -8635,7 +8635,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8689,7 +8689,7 @@ msgid "" ...@@ -8689,7 +8689,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8672,8 +8672,8 @@ msgstr "" ...@@ -8672,8 +8672,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Öppna resurser: %lu\n" msgstr "%s %s %s Öppna resurser: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8228,7 +8228,7 @@ msgid "" ...@@ -8228,7 +8228,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8375,7 +8375,7 @@ msgid "" ...@@ -8375,7 +8375,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -9027,7 +9027,7 @@ msgid "" ...@@ -9027,7 +9027,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8650,8 +8650,8 @@ msgstr "" ...@@ -8650,8 +8650,8 @@ msgstr ""
"---------------------------------------------------------------\n" "---------------------------------------------------------------\n"
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "%s %S %S Відкритих ресурсів: %lu\n" msgstr "%s %s %s Відкритих ресурсів: %lu\n"
#: net.rc:45 #: net.rc:45
msgid "OK" msgid "OK"
......
...@@ -8341,7 +8341,7 @@ msgid "" ...@@ -8341,7 +8341,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8204,7 +8204,7 @@ msgid "" ...@@ -8204,7 +8204,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8620,7 +8620,7 @@ msgid "" ...@@ -8620,7 +8620,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
...@@ -8678,7 +8678,7 @@ msgid "" ...@@ -8678,7 +8678,7 @@ msgid ""
msgstr "" msgstr ""
#: net.rc:44 #: net.rc:44
msgid "%s %S %S Open resources: %lu\n" msgid "%s %s %s Open resources: %lu\n"
msgstr "" msgstr ""
#: net.rc:45 #: net.rc:45
......
MODULE = net.exe MODULE = net.exe
APPMODE = -mconsole APPMODE = -mconsole -municode
IMPORTS = netapi32 user32 advapi32 IMPORTS = netapi32 user32 advapi32
EXTRADEFS = -DWINE_NO_UNICODE_MACROS EXTRADEFS = -DWINE_NO_UNICODE_MACROS
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <stdio.h>
#include <string.h>
#include <windows.h> #include <windows.h>
#include <lm.h> #include <lm.h>
#include <wine/unicode.h>
#include "resources.h" #include "resources.h"
#define NET_START 0001 #define NET_START 0001
...@@ -27,35 +27,41 @@ ...@@ -27,35 +27,41 @@
static int output_string(int msg, ...) static int output_string(int msg, ...)
{ {
char msg_buffer[8192]; WCHAR fmt[8192];
WCHAR str[8192];
int len;
DWORD count;
va_list arguments; va_list arguments;
LoadStringA(GetModuleHandleW(NULL), msg, msg_buffer, sizeof(msg_buffer)); LoadStringW(GetModuleHandleW(NULL), msg, fmt, sizeof(fmt));
va_start(arguments, msg); va_start(arguments, msg);
vprintf(msg_buffer, arguments); len = vsprintfW(str, fmt, arguments);
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &count, NULL);
va_end(arguments); va_end(arguments);
return 0; return 0;
} }
static BOOL output_error_string(DWORD error) static BOOL output_error_string(DWORD error)
{ {
LPSTR pBuffer; LPWSTR pBuffer;
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL, error, 0, (LPSTR)&pBuffer, 0, NULL)) NULL, error, 0, (LPWSTR)&pBuffer, 0, NULL))
{ {
fputs(pBuffer, stdout); DWORD count;
int len = lstrlenW(pBuffer);
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), pBuffer, len, &count, NULL);
LocalFree(pBuffer); LocalFree(pBuffer);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static BOOL net_use(int argc, char *argv[]) static BOOL net_use(int argc, const WCHAR* argv[])
{ {
USE_INFO_2 *buffer, *connection; USE_INFO_2 *buffer, *connection;
DWORD read, total, resume_handle, rc, i; DWORD read, total, resume_handle, rc, i;
char *status[STRING_RECONN-STRING_OK+1]; WCHAR* status[STRING_RECONN-STRING_OK+1];
resume_handle = 0; resume_handle = 0;
buffer = NULL; buffer = NULL;
...@@ -66,8 +72,8 @@ static BOOL net_use(int argc, char *argv[]) ...@@ -66,8 +72,8 @@ static BOOL net_use(int argc, char *argv[])
/* Load the status strings */ /* Load the status strings */
for (i = 0; i < sizeof(status)/sizeof(*status); i++) for (i = 0; i < sizeof(status)/sizeof(*status); i++)
{ {
status[i] = HeapAlloc(GetProcessHeap(), 0, 1024); status[i] = HeapAlloc(GetProcessHeap(), 0, 1024 * sizeof(**status));
LoadStringA(hmod, STRING_OK+i, status[i], 1024); LoadStringW(hmod, STRING_OK+i, status[i], 1024);
} }
do { do {
...@@ -133,12 +139,12 @@ static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle) ...@@ -133,12 +139,12 @@ static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle)
return result; return result;
} }
static BOOL net_service(int operation, char *service_name) static BOOL net_service(int operation, const WCHAR* service_name)
{ {
SC_HANDLE SCManager, serviceHandle; SC_HANDLE SCManager, serviceHandle;
BOOL result = 0; BOOL result = 0;
char service_display_name[4096]; WCHAR service_display_name[4096];
DWORD buffer_size = sizeof(service_display_name); DWORD buffer_size;
SCManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS); SCManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(!SCManager) if(!SCManager)
...@@ -146,7 +152,7 @@ static BOOL net_service(int operation, char *service_name) ...@@ -146,7 +152,7 @@ static BOOL net_service(int operation, char *service_name)
output_string(STRING_NO_SCM); output_string(STRING_NO_SCM);
return FALSE; return FALSE;
} }
serviceHandle = OpenServiceA(SCManager, service_name, SC_MANAGER_ALL_ACCESS); serviceHandle = OpenServiceW(SCManager, service_name, SC_MANAGER_ALL_ACCESS);
if(!serviceHandle) if(!serviceHandle)
{ {
output_string(STRING_NO_SVCHANDLE); output_string(STRING_NO_SVCHANDLE);
...@@ -154,9 +160,9 @@ static BOOL net_service(int operation, char *service_name) ...@@ -154,9 +160,9 @@ static BOOL net_service(int operation, char *service_name)
return FALSE; return FALSE;
} }
buffer_size = sizeof(service_display_name)/sizeof(*service_display_name);
GetServiceDisplayNameA(SCManager, service_name, service_display_name, &buffer_size); GetServiceDisplayNameW(SCManager, service_name, service_display_name, &buffer_size);
if (!service_display_name[0]) strcpy(service_display_name, service_name); if (!service_display_name[0]) lstrcpyW(service_display_name, service_name);
switch(operation) switch(operation)
{ {
...@@ -189,20 +195,29 @@ static BOOL net_service(int operation, char *service_name) ...@@ -189,20 +195,29 @@ static BOOL net_service(int operation, char *service_name)
return result; return result;
} }
int main(int argc, char *argv[]) static int arg_is(const WCHAR* str1, const WCHAR* str2)
{
return CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, str1, -1, str2, -1) == CSTR_EQUAL;
}
int wmain(int argc, const WCHAR* argv[])
{ {
static const WCHAR helpW[]={'h','e','l','p',0};
static const WCHAR startW[]={'s','t','a','r','t',0};
static const WCHAR stopW[]={'s','t','o','p',0};
static const WCHAR useW[]={'u','s','e',0};
if (argc < 2) if (argc < 2)
{ {
output_string(STRING_USAGE); output_string(STRING_USAGE);
return 1; return 1;
} }
if(!strcasecmp(argv[1], "help")) if(arg_is(argv[1], helpW))
{ {
output_string(STRING_HELP_USAGE); output_string(STRING_HELP_USAGE);
} }
if(!strcasecmp(argv[1], "start")) if(arg_is(argv[1], startW))
{ {
if(argc < 3) if(argc < 3)
{ {
...@@ -217,7 +232,7 @@ int main(int argc, char *argv[]) ...@@ -217,7 +232,7 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if(!strcasecmp(argv[1], "stop")) if(arg_is(argv[1], stopW))
{ {
if(argc < 3) if(argc < 3)
{ {
...@@ -232,7 +247,7 @@ int main(int argc, char *argv[]) ...@@ -232,7 +247,7 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if(!strcasecmp(argv[1], "use")) if(arg_is(argv[1], useW))
{ {
if(!net_use(argc, argv)) return 1; if(!net_use(argc, argv)) return 1;
} }
......
...@@ -41,7 +41,7 @@ STRINGTABLE ...@@ -41,7 +41,7 @@ STRINGTABLE
" Commands available are:\n NET HELP NET START NET STOP NET USE\n" " Commands available are:\n NET HELP NET START NET STOP NET USE\n"
STRING_NO_ENTRIES, "There are no entries in the list.\n" STRING_NO_ENTRIES, "There are no entries in the list.\n"
STRING_USE_HEADER, "\nStatus Local Remote\n---------------------------------------------------------------\n" STRING_USE_HEADER, "\nStatus Local Remote\n---------------------------------------------------------------\n"
STRING_USE_ENTRY, "%s %S %S Open resources: %lu\n" STRING_USE_ENTRY, "%s %s %s Open resources: %lu\n"
STRING_OK, "OK" STRING_OK, "OK"
STRING_PAUSED, "Paused" STRING_PAUSED, "Paused"
STRING_SESSLOST, "Disconnected" STRING_SESSLOST, "Disconnected"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment