Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1645ab04
Commit
1645ab04
authored
Dec 27, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Dec 27, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use RtlCreateUnicodeStringFromAsciiz, it doesn't preserve NULL.
parent
3c949ef4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
30 deletions
+27
-30
service.c
dlls/advapi32/service.c
+27
-30
No files found.
dlls/advapi32/service.c
View file @
1645ab04
...
...
@@ -646,12 +646,12 @@ SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA
(
LPCSTR
lpServiceName
,
LPHANDLER_FUNCTION
lpfHandler
)
{
UNICODE_STRING
lpServiceNameW
;
LPWSTR
lpServiceNameW
;
SERVICE_STATUS_HANDLE
ret
;
RtlCreateUnicodeStringFromAsciiz
(
&
lpServiceNameW
,
lpServiceName
);
ret
=
RegisterServiceCtrlHandlerW
(
lpServiceNameW
.
Buffer
,
lpfHandler
);
RtlFreeUnicodeString
(
&
lpServiceNameW
);
lpServiceNameW
=
SERV_dup
(
lpServiceName
);
ret
=
RegisterServiceCtrlHandlerW
(
lpServiceNameW
,
lpfHandler
);
SERV_free
(
lpServiceNameW
);
return
ret
;
}
...
...
@@ -721,15 +721,14 @@ SetServiceStatus( SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus )
SC_HANDLE
WINAPI
OpenSCManagerA
(
LPCSTR
lpMachineName
,
LPCSTR
lpDatabaseName
,
DWORD
dwDesiredAccess
)
{
UNICODE_STRING
lpMachineNameW
;
UNICODE_STRING
lpDatabaseNameW
;
LPWSTR
lpMachineNameW
,
lpDatabaseNameW
;
SC_HANDLE
ret
;
RtlCreateUnicodeStringFromAsciiz
(
&
lpMachineNameW
,
lpMachineName
);
RtlCreateUnicodeStringFromAsciiz
(
&
lpDatabaseNameW
,
lpDatabaseName
);
ret
=
OpenSCManagerW
(
lpMachineNameW
.
Buffer
,
lpDatabaseNameW
.
Buffer
,
dwDesiredAccess
);
RtlFreeUnicodeString
(
&
lpDatabaseNameW
);
RtlFreeUnicodeString
(
&
lpMachineNameW
);
lpMachineNameW
=
SERV_dup
(
lpMachineName
);
lpDatabaseNameW
=
SERV_dup
(
lpDatabaseName
);
ret
=
OpenSCManagerW
(
lpMachineNameW
,
lpDatabaseNameW
,
dwDesiredAccess
);
SERV_free
(
lpDatabaseNameW
);
SERV_free
(
lpMachineNameW
);
return
ret
;
}
...
...
@@ -932,15 +931,14 @@ CloseServiceHandle( SC_HANDLE hSCObject )
SC_HANDLE
WINAPI
OpenServiceA
(
SC_HANDLE
hSCManager
,
LPCSTR
lpServiceName
,
DWORD
dwDesiredAccess
)
{
UNICODE_STRING
lpServiceNameW
;
LPWSTR
lpServiceNameW
;
SC_HANDLE
ret
;
RtlCreateUnicodeStringFromAsciiz
(
&
lpServiceNameW
,
lpServiceName
);
if
(
lpServiceName
)
TRACE
(
"Request for service %s
\n
"
,
lpServiceName
);
else
return
FALSE
;
ret
=
OpenServiceW
(
hSCManager
,
lpServiceNameW
.
Buffer
,
dwDesiredAccess
);
RtlFreeUnicodeString
(
&
lpServiceNameW
);
TRACE
(
"%p %s %ld
\n
"
,
hSCManager
,
debugstr_a
(
lpServiceName
),
dwDesiredAccess
);
lpServiceNameW
=
SERV_dup
(
lpServiceName
);
ret
=
OpenServiceW
(
hSCManager
,
lpServiceNameW
,
dwDesiredAccess
);
SERV_free
(
lpServiceNameW
);
return
ret
;
}
...
...
@@ -958,8 +956,13 @@ SC_HANDLE WINAPI OpenServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
HKEY
hKey
;
long
r
;
TRACE
(
"(%p,%p,%ld)
\n
"
,
hSCManager
,
lpServiceName
,
dwDesiredAccess
);
TRACE
(
"%p %s %ld
\n
"
,
hSCManager
,
debugstr_w
(
lpServiceName
),
dwDesiredAccess
);
if
(
!
lpServiceName
)
{
SetLastError
(
ERROR_INVALID_ADDRESS
);
return
NULL
;
}
retval
=
alloc_sc_handle
(
SC_HTYPE_SERVICE
);
if
(
NULL
==
retval
)
...
...
@@ -1208,29 +1211,23 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
LPCSTR
*
lpServiceArgVectors
)
{
LPWSTR
*
lpwstr
=
NULL
;
UNICODE_STRING
usBuffer
;
unsigned
int
i
;
TRACE
(
"(%p,%ld,%p)
\n
"
,
hService
,
dwNumServiceArgs
,
lpServiceArgVectors
);
if
(
dwNumServiceArgs
)
lpwstr
=
(
LPWSTR
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
lpwstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwNumServiceArgs
*
sizeof
(
LPWSTR
)
);
else
lpwstr
=
NULL
;
for
(
i
=
0
;
i
<
dwNumServiceArgs
;
i
++
)
{
RtlCreateUnicodeStringFromAsciiz
(
&
usBuffer
,
lpServiceArgVectors
[
i
]);
lpwstr
[
i
]
=
usBuffer
.
Buffer
;
}
lpwstr
[
i
]
=
SERV_dup
(
lpServiceArgVectors
[
i
]);
StartServiceW
(
hService
,
dwNumServiceArgs
,
(
LPCWSTR
*
)
lpwstr
);
if
(
dwNumServiceArgs
)
{
for
(
i
=
0
;
i
<
dwNumServiceArgs
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
lpwstr
[
i
]);
SERV_free
(
lpwstr
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
lpwstr
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment