Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6b2b6cde
Commit
6b2b6cde
authored
May 23, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Fix error handling in SetupInstallServicesFromInfSection().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
56aab6aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
19 deletions
+35
-19
install.c
dlls/setupapi/install.c
+21
-19
install.c
dlls/setupapi/tests/install.c
+14
-0
No files found.
dlls/setupapi/install.c
View file @
6b2b6cde
...
...
@@ -1458,36 +1458,38 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
SC_HANDLE
scm
;
INFCONTEXT
context
;
INT
section_flags
;
BOOL
ok
,
ret
=
TRUE
;
BOOL
ret
=
TRUE
;
if
(
!
(
ok
=
SetupFindFirstLineW
(
hinf
,
section
,
NULL
,
&
context
)
))
if
(
!
SetupFindFirstLineW
(
hinf
,
section
,
NULL
,
&
context
))
{
SetLastError
(
ERROR_SECTION_NOT_FOUND
);
return
FALSE
;
}
if
(
!
(
scm
=
OpenSCManagerW
(
NULL
,
NULL
,
SC_MANAGER_ALL_ACCESS
)))
return
FALSE
;
ok
=
SetupFindFirstLineW
(
hinf
,
section
,
AddService
,
&
context
);
while
(
ok
)
if
(
SetupFindFirstLineW
(
hinf
,
section
,
AddService
,
&
context
))
{
if
(
!
SetupGetStringFieldW
(
&
context
,
1
,
service_name
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
SetupGetIntField
(
&
context
,
2
,
&
section_flags
))
section_flags
=
0
;
if
(
!
SetupGetStringFieldW
(
&
context
,
3
,
service_section
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
(
ret
=
add_service
(
scm
,
hinf
,
service_name
,
service_section
,
section_flags
|
flags
)))
goto
done
;
ok
=
SetupFindNextMatchLineW
(
&
context
,
AddService
,
&
context
);
do
{
if
(
!
SetupGetStringFieldW
(
&
context
,
1
,
service_name
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
SetupGetIntField
(
&
context
,
2
,
&
section_flags
))
section_flags
=
0
;
if
(
!
SetupGetStringFieldW
(
&
context
,
3
,
service_section
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
(
ret
=
add_service
(
scm
,
hinf
,
service_name
,
service_section
,
section_flags
|
flags
)))
goto
done
;
}
while
(
SetupFindNextMatchLineW
(
&
context
,
AddService
,
&
context
));
}
ok
=
SetupFindFirstLineW
(
hinf
,
section
,
DelService
,
&
context
);
while
(
ok
)
if
(
SetupFindFirstLineW
(
hinf
,
section
,
DelService
,
&
context
))
{
if
(
!
SetupGetStringFieldW
(
&
context
,
1
,
service_name
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
SetupGetIntField
(
&
context
,
2
,
&
section_flags
))
section_flags
=
0
;
if
(
!
(
ret
=
del_service
(
scm
,
hinf
,
service_name
,
section_flags
|
flags
)))
goto
done
;
ok
=
SetupFindNextMatchLineW
(
&
context
,
AddService
,
&
context
);
do
{
if
(
!
SetupGetStringFieldW
(
&
context
,
1
,
service_name
,
MAX_INF_STRING_LENGTH
,
NULL
))
continue
;
if
(
!
SetupGetIntField
(
&
context
,
2
,
&
section_flags
))
section_flags
=
0
;
if
(
!
(
ret
=
del_service
(
scm
,
hinf
,
service_name
,
section_flags
|
flags
)))
goto
done
;
}
while
(
SetupFindNextMatchLineW
(
&
context
,
AddService
,
&
context
));
}
if
(
ret
)
SetLastError
(
ERROR_SUCCESS
);
done:
...
...
dlls/setupapi/tests/install.c
View file @
6b2b6cde
...
...
@@ -574,6 +574,20 @@ static void test_install_svc_from(void)
SetupCloseInfFile
(
infhandle
);
DeleteFileA
(
inffile
);
strcpy
(
inf
,
"[Version]
\n
Signature=
\"
$Chicago$
\"\n
"
);
strcat
(
inf
,
"[Winetest.Services]
\n
"
);
strcat
(
inf
,
"AddService=,2
\n
"
);
create_inf_file
(
inffile
,
inf
);
sprintf
(
path
,
"%s
\\
%s"
,
CURR_DIR
,
inffile
);
infhandle
=
SetupOpenInfFileA
(
path
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
SetupInstallServicesFromInfSectionA
(
infhandle
,
"Winetest.Services"
,
0
);
ok
(
ret
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %08x
\n
"
,
GetLastError
());
SetupCloseInfFile
(
infhandle
);
DeleteFileA
(
inffile
);
/* TODO: Test the Flags */
}
...
...
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