Commit 305fcef6 authored by Alexandre Julliard's avatar Alexandre Julliard

net: Use the explicit name for all A/W function.

parent 79b00726
...@@ -5,6 +5,7 @@ VPATH = @srcdir@ ...@@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE = net.exe MODULE = net.exe
APPMODE = -mconsole APPMODE = -mconsole
IMPORTS = netapi32 user32 advapi32 kernel32 IMPORTS = netapi32 user32 advapi32 kernel32
EXTRADEFS = -DWINE_NO_UNICODE_MACROS
C_SRCS = net.c C_SRCS = net.c
......
...@@ -30,7 +30,7 @@ static int output_string(int msg, ...) ...@@ -30,7 +30,7 @@ static int output_string(int msg, ...)
char msg_buffer[8192]; char msg_buffer[8192];
va_list arguments; va_list arguments;
LoadString(GetModuleHandle(NULL), msg, msg_buffer, sizeof(msg_buffer)); LoadStringA(GetModuleHandleW(NULL), msg, msg_buffer, sizeof(msg_buffer));
va_start(arguments, msg); va_start(arguments, msg);
vprintf(msg_buffer, arguments); vprintf(msg_buffer, arguments);
va_end(arguments); va_end(arguments);
...@@ -92,24 +92,24 @@ static BOOL net_use(int argc, char *argv[]) ...@@ -92,24 +92,24 @@ static BOOL net_use(int argc, char *argv[])
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_STATUSW dependencies = NULL;
DWORD buffer_size = 0; DWORD buffer_size = 0;
DWORD count = 0, counter; DWORD count = 0, counter;
BOOL result; BOOL result;
SC_HANDLE dependent_serviceHandle; SC_HANDLE dependent_serviceHandle;
SERVICE_STATUS_PROCESS ssp; SERVICE_STATUS_PROCESS ssp;
result = EnumDependentServices(serviceHandle, SERVICE_ACTIVE, dependencies, buffer_size, &buffer_size, &count); result = EnumDependentServicesW(serviceHandle, SERVICE_ACTIVE, dependencies, buffer_size, &buffer_size, &count);
if(!result && (GetLastError() == ERROR_MORE_DATA)) if(!result && (GetLastError() == ERROR_MORE_DATA))
{ {
dependencies = HeapAlloc(GetProcessHeap(), 0, buffer_size); dependencies = HeapAlloc(GetProcessHeap(), 0, buffer_size);
if(EnumDependentServices(serviceHandle, SERVICE_ACTIVE, dependencies, buffer_size, &buffer_size, &count)) if(EnumDependentServicesW(serviceHandle, SERVICE_ACTIVE, dependencies, buffer_size, &buffer_size, &count))
{ {
for(counter = 0; counter < count; counter++) for(counter = 0; counter < count; counter++)
{ {
output_string(STRING_STOP_DEP, dependencies[counter].lpDisplayName); output_string(STRING_STOP_DEP, dependencies[counter].lpDisplayName);
dependent_serviceHandle = OpenService(SCManager, dependencies[counter].lpServiceName, SC_MANAGER_ALL_ACCESS); dependent_serviceHandle = OpenServiceW(SCManager, dependencies[counter].lpServiceName, SC_MANAGER_ALL_ACCESS);
if(dependent_serviceHandle) result = StopService(SCManager, dependent_serviceHandle); if(dependent_serviceHandle) result = StopService(SCManager, dependent_serviceHandle);
CloseServiceHandle(dependent_serviceHandle); CloseServiceHandle(dependent_serviceHandle);
if(!result) output_string(STRING_CANT_STOP, dependencies[counter].lpDisplayName); if(!result) output_string(STRING_CANT_STOP, dependencies[counter].lpDisplayName);
...@@ -129,13 +129,13 @@ static BOOL net_service(int operation, char *service_name) ...@@ -129,13 +129,13 @@ static BOOL net_service(int operation, char *service_name)
char service_display_name[4096]; char service_display_name[4096];
DWORD buffer_size = sizeof(service_display_name); DWORD buffer_size = sizeof(service_display_name);
SCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SCManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(!SCManager) if(!SCManager)
{ {
output_string(STRING_NO_SCM); output_string(STRING_NO_SCM);
return FALSE; return FALSE;
} }
serviceHandle = OpenService(SCManager, service_name, SC_MANAGER_ALL_ACCESS); serviceHandle = OpenServiceA(SCManager, service_name, SC_MANAGER_ALL_ACCESS);
if(!serviceHandle) if(!serviceHandle)
{ {
output_string(STRING_NO_SVCHANDLE); output_string(STRING_NO_SVCHANDLE);
...@@ -144,14 +144,14 @@ static BOOL net_service(int operation, char *service_name) ...@@ -144,14 +144,14 @@ static BOOL net_service(int operation, char *service_name)
} }
GetServiceDisplayName(SCManager, service_name, service_display_name, &buffer_size); GetServiceDisplayNameA(SCManager, service_name, service_display_name, &buffer_size);
if (!service_display_name[0]) strcpy(service_display_name, service_name); if (!service_display_name[0]) strcpy(service_display_name, service_name);
switch(operation) switch(operation)
{ {
case NET_START: case NET_START:
output_string(STRING_START_SVC, service_display_name); output_string(STRING_START_SVC, service_display_name);
result = StartService(serviceHandle, 0, NULL); result = StartServiceW(serviceHandle, 0, NULL);
if(result) output_string(STRING_START_SVC_SUCCESS, service_display_name); if(result) output_string(STRING_START_SVC_SUCCESS, service_display_name);
else else
......
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