VirtualBox

Changeset 40768 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Apr 5, 2012 10:12:23 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77264
Message:

VBoxGINA: Use the Windows Notification Package to know when the screensaver stopped.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditions.nsi

    r40749 r40768  
    719719    !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
    720720    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
     721    ; Add Windows notification package callbacks for VBoxGINA
     722    WriteRegStr   HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "DLLName" "VBoxGINA.dll"
     723    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "Impersonate" 0
     724    WriteRegStr   HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "StopScreenSaver" "WnpScreenSaverStop"
    721725  ${EndIf}
    722726
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsW2KXP.nsh

    r40270 r40768  
    692692    DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
    693693  ${EndIf}
     694  DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
    694695
    695696  ; Delete VBoxTray
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp

    r40760 r40768  
    261261
    262262    /* Forward call */
    263     return GWlxInitialize(lpWinsta, hWlx, pvReserved, pWinlogonFunctions, pWlxContext);
     263    if (GWlxInitialize)
     264        return GWlxInitialize(lpWinsta, hWlx, pvReserved, pWinlogonFunctions, pWlxContext);
     265    return TRUE;
    264266}
    265267
     
    283285        VBoxGINACredentialsPollerCreate();
    284286        /* Forward call to MSGINA. */
    285         GWlxDisplaySASNotice(pWlxContext);
     287        if (GWlxDisplaySASNotice)
     288            GWlxDisplaySASNotice(pWlxContext);
    286289    }
    287290}
     
    299302        VBoxGINACredentialsPollerCreate();
    300303
    301     int iRet;
    302     iRet = GWlxLoggedOutSAS(pWlxContext, dwSasType, pAuthenticationId, pLogonSid,
    303                             pdwOptions, phToken, pMprNotifyInfo, pProfile);
    304 
    305     if (iRet == WLX_SAS_ACTION_LOGON)
    306     {
    307         //
    308         // Copy pMprNotifyInfo and pLogonSid for later use
    309         //
    310 
    311         // pMprNotifyInfo->pszUserName
    312         // pMprNotifyInfo->pszDomain
    313         // pMprNotifyInfo->pszPassword
    314         // pMprNotifyInfo->pszOldPassword
    315     }
    316 
    317     return iRet;
     304    if (GWlxLoggedOutSAS)
     305    {
     306        int iRet;
     307        iRet = GWlxLoggedOutSAS(pWlxContext, dwSasType, pAuthenticationId, pLogonSid,
     308                                pdwOptions, phToken, pMprNotifyInfo, pProfile);
     309
     310        if (iRet == WLX_SAS_ACTION_LOGON)
     311        {
     312            //
     313            // Copy pMprNotifyInfo and pLogonSid for later use
     314            //
     315
     316            // pMprNotifyInfo->pszUserName
     317            // pMprNotifyInfo->pszDomain
     318            // pMprNotifyInfo->pszPassword
     319            // pMprNotifyInfo->pszOldPassword
     320        }
     321
     322        return iRet;
     323    }
     324
     325    return WLX_SAS_ACTION_NONE;
    318326}
    319327
     
    334342
    335343    /* Forward call to MSGINA. */
    336     return GWlxActivateUserShell(pWlxContext, pszDesktopName, pszMprLogonScript, pEnvironment);
     344    if (GWlxActivateUserShell)
     345        return GWlxActivateUserShell(pWlxContext, pszDesktopName, pszMprLogonScript, pEnvironment);
     346    return TRUE; /* Activate the user shell. */
    337347}
    338348
     
    350360    /* Forward call to MSGINA. */
    351361    VBoxGINAVerbose(0, "VBoxGINA::WlxLoggedOnSAS: Forwarding call to MSGINA ...\n");
    352     return GWlxLoggedOnSAS(pWlxContext, dwSasType, pReserved);
     362    if (GWlxLoggedOnSAS)
     363        return GWlxLoggedOnSAS(pWlxContext, dwSasType, pReserved);
     364    return WLX_SAS_ACTION_NONE;
    353365}
    354366
     
    371383        VBoxGINACredentialsPollerCreate();
    372384        /* Forward call to MSGINA. */
    373         GWlxDisplayLockedNotice(pWlxContext);
     385        if (GWlxDisplayLockedNotice)
     386            GWlxDisplayLockedNotice(pWlxContext);
    374387    }
    375388}
     
    382395{
    383396    VBoxGINAVerbose(0, "VBoxGINA::WlxIsLockOk\n");
     397
    384398    /* Forward call to MSGINA. */
    385     return GWlxIsLockOk(pWlxContext);
     399    if (GWlxIsLockOk)
     400        return GWlxIsLockOk(pWlxContext);
     401    return TRUE; /* Locking is OK. */
    386402}
    387403
     
    397413
    398414    /* Forward call to MSGINA. */
    399     return GWlxWkstaLockedSAS(pWlxContext, dwSasType);
     415    if (GWlxWkstaLockedSAS)
     416        return GWlxWkstaLockedSAS(pWlxContext, dwSasType);
     417    return WLX_SAS_ACTION_NONE;
    400418}
    401419
     
    405423    VBoxGINAVerbose(0, "VBoxGINA::WlxIsLogoffOk\n");
    406424
    407     return GWlxIsLogoffOk(pWlxContext);
     425    if (GWlxIsLogoffOk)
     426        return GWlxIsLogoffOk(pWlxContext);
     427    return TRUE; /* Log off is OK. */
    408428}
    409429
     
    421441
    422442    /* Forward call to MSGINA. */
    423     GWlxLogoff(pWlxContext);
     443    if (GWlxLogoff)
     444        GWlxLogoff(pWlxContext);
    424445}
    425446
     
    442463
    443464    /* Forward call to MSGINA. */
    444     GWlxShutdown(pWlxContext, ShutdownType);
     465    if (GWlxShutdown)
     466        GWlxShutdown(pWlxContext, ShutdownType);
    445467}
    446468
     
    454476                    pSecure ? *pSecure : 0);
    455477
    456     /* Report / set back status to "active" since the screensaver
    457      * (Winlogon) does give VBoxGINA yet the chance to hook into dialogs
     478    /* Report the status to "init" since the screensaver
     479     * (Winlogon) does not give VBoxGINA yet the chance to hook into dialogs
    458480     * which only then in turn would set the status to "active" -- so
    459      * do this here explicitly. */
    460     VBoxGINAReportStatus(VBoxGuestFacilityStatus_Active);
     481     * at least set some status here. */
     482    VBoxGINAReportStatus(VBoxGuestFacilityStatus_Init);
    461483
    462484    /* Note: Disabling the screensaver's grace period is necessary to get
     
    571593    if (GWlxDisconnectNotify)
    572594        GWlxDisconnectNotify(pWlxContext);
     595}
     596
     597
     598/*
     599 * Windows Notification Package callbacks
     600 */
     601void WnpScreenSaverStop(PWLX_NOTIFICATION_INFO pInfo)
     602{
     603    VBoxGINAVerbose(0, "VBoxGINA::WnpScreenSaverStop\n");
     604
     605    /*
     606     * Because we set the status to "init" in WlxScreenSaverNotify when
     607     * the screensaver becomes active we also have to take into account
     608     * that in case the screensaver terminates (either within the grace
     609     * period or because the lock screen appears) we have to set the
     610     * status accordingly.
     611     */
     612    VBoxGINAReportStatus(VBoxGuestFacilityStatus_Terminated);
    573613}
    574614
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.def

    r40214 r40768  
    4444    ; Debug
    4545    VBoxGINADebug
     46    ; Windows Notification Package callbacks
     47    WnpScreenSaverStop
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