@@ -197,22 +197,36 @@ private void OnTimerTick(object sender, EventArgs e)
197197
198198 private void DisableSoftlockUsingQU ( )
199199 {
200- m_UnlockForm = new UnlockForm ( ) ;
201- m_UnlockForm . Text = PluginTranslate . PluginName + " - Softlock" ;
202- if ( m_UnlockForm . ShowDialog ( Program . MainForm ) == DialogResult . OK )
200+ if ( m_UnlockForm != null ) m_UnlockForm . Dispose ( ) ;
201+
202+ KeePassLib . Delegates . GFunc < UnlockForm > fConstruct = delegate ( )
203203 {
204- ProtectedString CheckQuickUnlockKey = m_UnlockForm . QuickUnlockKey ;
205- ProtectedString QuickUnlockKey = _qu . GetQuickUnlockKey ( Program . MainForm . ActiveDatabase ) ;
206- var lac = LockAssistConfig . GetQuickUnlockOptions ( Program . MainForm . ActiveDatabase ) ;
207- if ( ( QuickUnlockKey == null ) || CheckQuickUnlockKey . Equals ( _qu . TrimQuickUnlockKey ( QuickUnlockKey , lac ) , false ) )
208- {
209- SetVisibility ( true ) ;
210- if ( LockAssistConfig . SL_IsActive ) m_SLTimer . Interval = LockAssistConfig . SL_Seconds * 1000 ;
211- }
212- else PluginDebug . AddError ( "Deactivate SoftLock" , "Deactivation failed" , "Invalid Quick Unlock key provided" ) ;
204+ m_UnlockForm = new UnlockForm ( ) ;
205+ m_UnlockForm . Text = PluginTranslate . PluginName + " - Softlock" ;
206+ return m_UnlockForm ;
207+ } ;
208+
209+ KeePassLib . Delegates . GFunc < UnlockForm , ProtectedString > fResultBuilder = delegate ( UnlockForm f )
210+ {
211+ ProtectedString r = f . QuickUnlockKey ;
212+ UIUtil . DestroyForm ( m_UnlockForm ) ;
213+ m_UnlockForm = null ;
214+ return r ;
215+ } ;
216+
217+ ProtectedString psCheckQuickUnlockKey = new ProtectedString ( ) ;
218+ DialogResult dr = Tools . ShowDialog ( Program . Config . Security . MasterKeyOnSecureDesktop , fConstruct , fResultBuilder , out psCheckQuickUnlockKey ) ;
219+
220+ if ( dr != DialogResult . OK ) return ;
221+
222+ ProtectedString psQuickUnlockKey = _qu . GetQuickUnlockKey ( Program . MainForm . ActiveDatabase ) ;
223+ var lacOptions = LockAssistConfig . GetQuickUnlockOptions ( Program . MainForm . ActiveDatabase ) ;
224+ if ( ( psQuickUnlockKey == null ) || psCheckQuickUnlockKey . Equals ( _qu . TrimQuickUnlockKey ( psQuickUnlockKey , lacOptions ) , false ) )
225+ {
226+ SetVisibility ( true ) ;
227+ if ( LockAssistConfig . SL_IsActive ) m_SLTimer . Interval = LockAssistConfig . SL_Seconds * 1000 ;
213228 }
214- if ( m_UnlockForm != null ) m_UnlockForm . Dispose ( ) ;
215- m_UnlockForm = null ;
229+ else PluginDebug . AddError ( "Deactivate SoftLock" , "Deactivation failed" , "Invalid Quick Unlock key provided" ) ;
216230 }
217231
218232 private void DisableSoftlockUsingFullPassword ( )
0 commit comments