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
7db2149f
Commit
7db2149f
authored
Sep 01, 2004
by
Alexander Yaworsky
Committed by
Alexandre Julliard
Sep 01, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented QueryServiceConfigA.
parent
3fe1754a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
2 deletions
+125
-2
service.c
dlls/advapi32/service.c
+125
-2
No files found.
dlls/advapi32/service.c
View file @
7db2149f
...
...
@@ -1002,9 +1002,132 @@ QueryServiceConfigA( SC_HANDLE hService,
LPQUERY_SERVICE_CONFIGA
lpServiceConfig
,
DWORD
cbBufSize
,
LPDWORD
pcbBytesNeeded
)
{
FIXME
(
"%p %p %ld %p
\n
"
,
hService
,
lpServiceConfig
,
static
const
CHAR
szDisplayName
[]
=
"DisplayName"
;
static
const
CHAR
szType
[]
=
"Type"
;
static
const
CHAR
szStart
[]
=
"Start"
;
static
const
CHAR
szError
[]
=
"ErrorControl"
;
static
const
CHAR
szImagePath
[]
=
"ImagePath"
;
static
const
CHAR
szGroup
[]
=
"Group"
;
static
const
CHAR
szDependencies
[]
=
"Dependencies"
;
HKEY
hKey
=
((
struct
sc_handle
*
)
hService
)
->
u
.
service
.
hkey
;
CHAR
str_buffer
[
MAX_PATH
];
LONG
r
;
DWORD
type
,
val
,
sz
,
total
,
n
;
LPBYTE
p
;
TRACE
(
"%p %p %ld %p
\n
"
,
hService
,
lpServiceConfig
,
cbBufSize
,
pcbBytesNeeded
);
return
FALSE
;
/* calculate the size required first */
total
=
sizeof
(
QUERY_SERVICE_CONFIGA
);
sz
=
sizeof
(
str_buffer
);
r
=
RegQueryValueExA
(
hKey
,
szImagePath
,
0
,
&
type
,
str_buffer
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_SZ
||
type
==
REG_EXPAND_SZ
)
)
{
sz
=
ExpandEnvironmentStringsA
(
str_buffer
,
NULL
,
0
);
if
(
0
==
sz
)
return
FALSE
;
total
+=
sz
;
}
else
{
/* FIXME: set last error */
return
FALSE
;
}
sz
=
0
;
r
=
RegQueryValueExA
(
hKey
,
szGroup
,
0
,
&
type
,
NULL
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_SZ
)
)
total
+=
sz
;
sz
=
0
;
r
=
RegQueryValueExA
(
hKey
,
szDependencies
,
0
,
&
type
,
NULL
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_MULTI_SZ
)
)
total
+=
sz
;
sz
=
0
;
r
=
RegQueryValueExA
(
hKey
,
szStart
,
0
,
&
type
,
NULL
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_SZ
)
)
total
+=
sz
;
sz
=
0
;
r
=
RegQueryValueExA
(
hKey
,
szDisplayName
,
0
,
&
type
,
NULL
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_SZ
)
)
total
+=
sz
;
/* if there's not enough memory, return an error */
if
(
total
>
*
pcbBytesNeeded
)
{
*
pcbBytesNeeded
=
total
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
*
pcbBytesNeeded
=
total
;
ZeroMemory
(
lpServiceConfig
,
total
);
sz
=
sizeof
val
;
r
=
RegQueryValueExA
(
hKey
,
szType
,
0
,
&
type
,
(
LPBYTE
)
&
val
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
||
(
type
==
REG_DWORD
)
)
lpServiceConfig
->
dwServiceType
=
val
;
sz
=
sizeof
val
;
r
=
RegQueryValueExA
(
hKey
,
szStart
,
0
,
&
type
,
(
LPBYTE
)
&
val
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
||
(
type
==
REG_DWORD
)
)
lpServiceConfig
->
dwStartType
=
val
;
sz
=
sizeof
val
;
r
=
RegQueryValueExA
(
hKey
,
szError
,
0
,
&
type
,
(
LPBYTE
)
&
val
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
||
(
type
==
REG_DWORD
)
)
lpServiceConfig
->
dwErrorControl
=
val
;
/* now do the strings */
p
=
(
LPBYTE
)
&
lpServiceConfig
[
1
];
n
=
total
-
sizeof
(
QUERY_SERVICE_CONFIGA
);
sz
=
sizeof
(
str_buffer
);
r
=
RegQueryValueExA
(
hKey
,
szImagePath
,
0
,
&
type
,
str_buffer
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
(
type
==
REG_SZ
||
type
==
REG_EXPAND_SZ
)
)
{
sz
=
ExpandEnvironmentStringsA
(
str_buffer
,
p
,
n
);
if
(
0
==
sz
||
sz
>
n
)
return
FALSE
;
lpServiceConfig
->
lpBinaryPathName
=
(
LPSTR
)
p
;
p
+=
sz
;
n
-=
sz
;
}
else
{
/* FIXME: set last error */
return
FALSE
;
}
sz
=
n
;
r
=
RegQueryValueExA
(
hKey
,
szGroup
,
0
,
&
type
,
p
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
||
(
type
==
REG_SZ
)
)
{
lpServiceConfig
->
lpLoadOrderGroup
=
(
LPSTR
)
p
;
p
+=
sz
;
n
-=
sz
;
}
sz
=
n
;
r
=
RegQueryValueExA
(
hKey
,
szDependencies
,
0
,
&
type
,
p
,
&
sz
);
if
(
(
r
==
ERROR_SUCCESS
)
||
(
type
==
REG_SZ
)
)
{
lpServiceConfig
->
lpDependencies
=
(
LPSTR
)
p
;
p
+=
sz
;
n
-=
sz
;
}
if
(
n
<
0
)
ERR
(
"Buffer overflow!
\n
"
);
TRACE
(
"Image path = %s
\n
"
,
lpServiceConfig
->
lpBinaryPathName
);
TRACE
(
"Group = %s
\n
"
,
lpServiceConfig
->
lpLoadOrderGroup
);
return
TRUE
;
}
/******************************************************************************
...
...
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