MAV on Ctrl+Alt+Del

Archives Forums/Blitz3D Bug Reports/MAV on Ctrl+Alt+Del

@rtur(Posted 2007) [#1]
Here is bug report from publisher:

1. Launch game.
2. Press alt + ctrl + del.
3. Bring game back into focus.
Result:
Depending on whether game is in full screen or windows mode, game either crashes or undergoes severe graphical corruption (screenshots couldn't be captured).
Expected:
Game shouldn't crash or undergo graphical corruption.
Note:
(dxdiag1_son and dxdiag2_son): Game crashed with a memory access violation in windows mode and in full screen.
(DxDiagbob): Game hardlocked in windows mode. Game underwent graphical corruption in full screen.
(SEA-QA-CKLEPAC_dxdiag): Game hardlocked in windows mode and full screen.


It appears on any programm, for example:
Graphics3D 800,600, 16 ,1
camera=CreateCamera()
cube=CreateCube()
PositionEntity cube ,0,0,10


While Not KeyDown(1)
 TurnEntity cube,1,1,1
RenderWorld
Flip
Wend
End


"Welcome screen" must be disabled(Start -> Control panel -> User account -> Change the way users log on or log off
-> (disable) Use the welcome screen)


MixailV(Posted 2007) [#2]
Hi to all, I've got problem with Blitz3D.
It gives MAV when user press Ctrl+Alt+Del with disabled Welcome screen(in fullscreen mode).
In window mode it lose render device so all graphics are corrupted and does not redraws.
p.s. BlitzMax aplications works fine, btw.


Anthony Sherratt(Posted 2007) [#3]
Yep, same problem here too. As soon as you press the combination of keys bringing up the 'Logon Information' window the Blitz3D app will crash with a MAV.


DGuy(Posted 2007) [#4]
Suggestion: When B3D app is full screen and loses focus (alt-tab, window-key, ctrl-alt-del, alt-enter, etc.) or is windowed and display is changed, unload all graphics, close down graphics mode (i.e. EndGraphics), then re-open graphics mode, and reload graphics. This has solved all graphics corruption/ MAV I experienced with B3D.

Granted, this requires use of an external DLL that hooks the B3D WndProc callback and checks for certain messages, and also requires keeping track of which resources are is use at any particular time so they can be re-loaded, but as I said above it seems the most sure fire way to avoid problems.

I figure, this re-setting will happen rarely and coupled with not having megs & megs of graphics to reload, should make the delay involved bearable.

Also, I put a short delay (1-2 seconds) after setting the graphics mode as I found this prevented graphic corruption on faster machines.

HTH


@rtur(Posted 2007) [#5]
I've already fixed(partialy) bugs with Alt+Tab and other focus loosing.

But press, for exaple, Win+L. Or disable welcome screen(Start -> Control panel -> User account -> Change the way users log on or log off -> (disable) Use the welcome screen) and press Ctrl+Alt+Del to lock work station. Then come back to game.

Have you fixed this bugs? How do you checking for Ctr+Alt+Del or Win+L?
I've tried checking windows messages(7 and 8), GetActiveWindow, TestCooperativeLevel on Blitz3D's DirectDraw object. This hels to figure out usual Alt+Tab and Ctrl+Shift+Esc or Win+D or Ctrl+Alt+Del with enabled welcome screen(so its the same as Ctrl+Shift+Esc-task manager launching instead of locking computer). But nothing let me figure out when user blocks his computer(TestCooperativeLevel seems to work correctly with windowed mode, but not in fullscreen).


@rtur(Posted 2007) [#6]
Hmm Win+L does not gives MAV just screen need to be refreshed(with RestoreAllSurfaces on resume game), some textures does not draws.

But Ctlr+Alt+Del still does not work correctly.


DGuy(Posted 2007) [#7]
Ok, I also get a MAV when pressing Win+L when in windowed mode (in full screen mode Win+L is received as WM_KEYDOWN (VK_LWIN), WM_KEYUP('L'), WM_KEYUP(VK_LWIN)).

NOTE: This happens with welcome screen enabled or disabled.

Looking at the message stream the windowed app receives when Win+L is pressed, the app thinks it is simply losing focus: there are no messages indicating, explicitly, that windows is being logged off.

It seems, as a result of logging off, B3D is losing the surface/texture memory it manages which leads to the MAV when focus is received.

I'll have to do a little research into how/if Windows lets programs know/query about the Log-Off event.

I'll let you know what I find ;)


DGuy(Posted 2007) [#8]
Ok, I seem to have gotten a B3D app able to handle Win+L, Ctrl+Alt+Enter, etc. I had to do two things:

First, each time through the main loop test if the primary direct draw surface has been lost: This requires passing SystemProperty( "DirectDraw7" ) to my helper DLL after the video mode has been set, enumerating all DD Surfaces until the primary one is found, then checking (using IsLost() via an exported DLL function) each time though the main loop if it has been lost. If the primary surface has been lost, close and re-open B3D graphics mode.

Second, I added a check for whenever a full screen app has lost focus, for what ever reason, to close/re-open B3D graphic mode.

For the curious, the pertinent part of my main loop looks like this (NOTE: this is placed at the very top of the main loop):

If app_DDWasLost() Then
 app_lout( "(--- DirectDraw Lost ---)" );
 m_content_unloadCurrent()
 If Not m_display_uninit() Then Exit
 If Not m_display_init() Then Exit
 If Not m_content_loadCurrent() Then Exit

Else If (g\use_fullscreen = False) And app_displayChanged() Then
 app_lout( "(--- Display Changed ---)" );
 m_content_unloadCurrent()
 If Not m_display_uninit() Then Exit
 If Not m_display_init() Then Exit
 If Not m_content_loadCurrent() Then Exit
 app_clearDisplayChanged()

Else If (g\use_fullscreen = True) And app_hasLostFocus() Then
 app_lout( "(--- Full Screen App Lost Focus ---)" )
 m_content_unloadCurrent()
 If Not m_display_uninit() Then Exit
 If Not m_display_init() Then Exit
 If Not m_content_loadCurrent() Then Exit
 prev_time = MilliSecs()
 app_clearHasLostFocus()			
End If					

HTH


DGuy(Posted 2007) [#9]
Update to this issue posted here:

http://www.blitzbasic.com/Community/posts.php?topic=67837