VirtualBox

Changeset 45938 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
May 7, 2013 3:52:46 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85578
Message:

Windows Guest Additions installer: New try for installing the services section of supplied filter drivers in silent mode.

Location:
trunk/src/VBox/Additions/WINNT
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp

    r44528 r45938  
    354354}
    355355
     356static UINT WINAPI vboxDrvInstExecuteInfFileCallback(PVOID Context,
     357                                                     UINT Notification,
     358                                                     UINT_PTR Param1,
     359                                                     UINT_PTR Param2)
     360{
     361#ifdef DEBUG
     362    _tprintf (_T( "Got installation notification %u\n"), Notification);
     363#endif
     364
     365    switch (Notification)
     366    {
     367        case SPFILENOTIFY_NEEDMEDIA:
     368            _tprintf (_T( "Requesting installation media ...\n"));
     369            break;
     370
     371        case SPFILENOTIFY_STARTCOPY:
     372            _tprintf (_T( "Copying driver files to destination ...\n"));
     373            break;
     374
     375        case SPFILENOTIFY_TARGETNEWER:
     376        case SPFILENOTIFY_TARGETEXISTS:
     377            return TRUE;
     378    }
     379
     380    return SetupDefaultQueueCallback(Context, Notification, Param1, Param2);
     381}
     382
    356383/**
    357384 * Executes a sepcified .INF section to install/uninstall drivers and/or services.
     
    364391int ExecuteInfFile(const _TCHAR *pszSection, int iMode, const _TCHAR *pszInf)
    365392{
    366     _tprintf(_T("Executing INF-File: %ws (Section: %ws) ...\n"), pszInf, pszSection);
    367 
    368     /* Executed by the installer that already has proper privileges. */
    369     _TCHAR szCommandLine[_MAX_PATH + 1] = { 0 };
    370     swprintf(szCommandLine, sizeof(szCommandLine), TEXT( "%ws %d %ws" ), pszSection, iMode, pszInf);
    371 
    372 #ifdef DEBUG
    373     _tprintf (_T( "Commandline: %ws\n"), szCommandLine);
    374 #endif
    375 
    376     InstallHinfSection(NULL, NULL, szCommandLine, SW_SHOW);
    377     /* No return value given! */
     393    _tprintf(_T("Installing from INF-File: %ws (Section: %ws) ...\n"),
     394             pszInf, pszSection);
     395
     396    UINT uErrorLine = 0;
     397    HINF hINF = SetupOpenInfFile(pszInf, NULL, INF_STYLE_WIN4, &uErrorLine);
     398    if (hINF != INVALID_HANDLE_VALUE)
     399    {
     400        PVOID pvQueue = SetupInitDefaultQueueCallback(NULL);
     401
     402        BOOL fSuccess = SetupInstallFromInfSection(NULL,
     403                                                    hINF,
     404                                                    pszSection,
     405                                                    SPINST_ALL,
     406                                                    HKEY_LOCAL_MACHINE,
     407                                                    NULL,
     408                                                    SP_COPY_NEWER_OR_SAME | SP_COPY_NOSKIP,
     409                                                    vboxDrvInstExecuteInfFileCallback,
     410                                                    pvQueue,
     411                                                    NULL,
     412                                                    NULL
     413                                                    );
     414        if (fSuccess)
     415        {
     416            _tprintf (_T( "File installation stage successful\n"));
     417
     418            fSuccess = SetupInstallServicesFromInfSection(hINF,
     419                                                          L"DefaultInstall.Services",
     420                                                          0 /* Flags */);
     421            if (fSuccess)
     422            {
     423                _tprintf (_T( "Service installation stage successful. Installation completed\n"));
     424            }
     425            else
     426            {
     427                DWORD dwErr = GetLastError();
     428                switch (dwErr)
     429                {
     430                    case ERROR_SUCCESS_REBOOT_REQUIRED:
     431                        _tprintf (_T( "A reboot is required to complete the installation\n"));
     432                        break;
     433
     434                    case ERROR_SECTION_NOT_FOUND:
     435                        break;
     436
     437                    default:
     438                        _tprintf (_T( "Error %ld while installing service\n"), dwErr);
     439                        break;
     440                }
     441            }
     442        }
     443        else
     444            _tprintf (_T( "Error %ld while installing files\n"), GetLastError());
     445
     446        if (pvQueue)
     447            SetupTermDefaultQueueCallback(pvQueue);
     448
     449        SetupCloseInfFile(hINF);
     450    }
     451    else
     452        _tprintf (_T( "Unable to open %ws: %ld (error line %u)\n"),
     453                  pszInf, GetLastError(), uErrorLine);
    378454
    379455    return EXIT_OK;
  • trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMouse.inf

    r44529 r45938  
    3535;amd64 %ORACLE%=VBoxMouse, NTamd64
    3636
     37[VBoxMouse_Install]
     38CopyFiles = @VBoxMouse.sys
     39
     40[VBoxMouse_Install.Services]
     41AddService = VBoxMouse,,VBoxMouse.Service
     42
    3743[DefaultInstall]
    38 ;
    39 ; DefaultInstall section is used to install the class filter driver.
    40 ;
    4144CopyFiles = @VBoxMouse.sys
    42 AddReg = VBoxMouse_AddReg
    4345
    44 [VBoxMouse_AddReg]
     46[DefaultInstall.Services]
     47AddService = VBoxMouse,,VBoxMouse.Service
     48
     49[VBoxMouse.AddRegistry]
    4550HKLM, System\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}, UpperFilters, 0x00010000, "VBoxMouse", "mouclass"
    4651
    47 [DefaultInstall.Services]
    48 AddService = VBoxMouse, , VBoxMouse_Service_Inst
    49 
    50 
    51 [VBoxMouse_Service_Inst]
     52[VBoxMouse.Service]
    5253DisplayName    = %VBoxMouse.SvcDesc%
    5354ServiceType    = %SERVICE_KERNEL_DRIVER%
     
    5556ErrorControl   = %SERVICE_ERROR_IGNORE%
    5657ServiceBinary  = %12%\VBoxMouse.sys
    57 
     58AddReg         = VBoxMouse.AddRegistry
    5859
    5960[Strings]
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette