Hans Leidekker : setupapi: SetupInstallServicesFromInfSection doesn' t fail if there are no AddService or DelService directives in the section.

Alexandre Julliard julliard at winehq.org
Mon Jul 9 14:56:38 CDT 2012


Module: wine
Branch: master
Commit: da922769c5536932185d7bfce604ee1b7885b75d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=da922769c5536932185d7bfce604ee1b7885b75d

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Jul  9 11:07:37 2012 +0200

setupapi: SetupInstallServicesFromInfSection doesn't fail if there are no AddService or DelService directives in the section.

---

 dlls/setupapi/install.c       |   13 ++++++++-----
 dlls/setupapi/tests/install.c |   14 ++++++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index 874b4a9..1c8236a 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -1447,12 +1447,16 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
     SC_HANDLE scm;
     INFCONTEXT context;
     INT section_flags;
-    BOOL ok, ret = FALSE;
+    BOOL ok, ret = TRUE;
 
+    if (!(ok = SetupFindFirstLineW( hinf, section, NULL, &context )))
+    {
+        SetLastError( ERROR_SECTION_NOT_FOUND );
+        return FALSE;
+    }
     if (!(scm = OpenSCManagerW( NULL, NULL, SC_MANAGER_ALL_ACCESS ))) return FALSE;
 
-    if (!(ok = SetupFindFirstLineW( hinf, section, AddService, &context )))
-        SetLastError( ERROR_SECTION_NOT_FOUND );
+    ok = SetupFindFirstLineW( hinf, section, AddService, &context );
     while (ok)
     {
         if (!SetupGetStringFieldW( &context, 1, service_name, MAX_INF_STRING_LENGTH, NULL ))
@@ -1465,8 +1469,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
         ok = SetupFindNextMatchLineW( &context, AddService, &context );
     }
 
-    if (!(ok = SetupFindFirstLineW( hinf, section, DelService, &context )))
-        SetLastError( ERROR_SECTION_NOT_FOUND );
+    ok = SetupFindFirstLineW( hinf, section, DelService, &context );
     while (ok)
     {
         if (!SetupGetStringFieldW( &context, 1, service_name, MAX_INF_STRING_LENGTH, NULL ))
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 1c204b5..a2fa00b 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -322,6 +322,20 @@ static void test_install_svc_from(void)
     CloseServiceHandle(svc_handle);
     CloseServiceHandle(scm_handle);
 
+    strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n");
+    strcat(inf, "[XSP.InstallPerVer]\n");
+    strcat(inf, "AddReg=AspEventlogMsg.Reg,Perf.Reg,AspVersions.Reg,FreeADO.Reg,IndexServer.Reg\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, "XSP.InstallPerVer", 0);
+    ok(ret, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+    SetupCloseInfFile(infhandle);
+    DeleteFile(inffile);
+
     /* TODO: Test the Flags */
 }
 




More information about the wine-cvs mailing list