GTWVT misbehavior ?

442 views
Skip to first unread message

elch

unread,
Sep 13, 2014, 8:56:10 AM9/13/14
to harbou...@googlegroups.com

Hi Przemek,


as Sergy reported, a GTWVT app seem to stop the Windows shutdown process.


I somehow strong believe that '0' represents 'FALSE' ;-)

and below is stated, that WM_QUERYENDSESSION should return TRUE,

else no WM_ENDSESSION will appear ( for which we then call DefWindowProc() ).


http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890%28v=vs.85%29.aspx


I tried a changed GTWVT, and that changes reported shutdown behavior.

Maybe it is very wilfull done, or i not the first time overlook something ?

Maybe it's worth an idea, to react different depending on pWVT->CloseMode ?


best regards

Rolf

Sergy

unread,
Sep 15, 2014, 5:51:27 AM9/15/14
to harbou...@googlegroups.com
Hello friends

As I can understand complicated discussions about Harbour engine - the main idea is to enable the Windows rebooting.

IMHO, there are two questions about shutdown/logoff/reboot:

1) why program quits with no one message (HB_K_CLOSE doesn't catch)

2) the program should to have the choice: quit + resume reboot OR still to work + stop reboot.


WBR,
Sergy

elch

unread,
Sep 15, 2014, 3:04:31 PM9/15/14
to harbou...@googlegroups.com
Hi Sergy,


As I can understand complicated discussions about Harbour engine - the main idea is to enable the Windows rebooting.

yes - but as we get no master answer there likely is something we overlook.

This behavior seem exist since very long.

Maybe some Windows behave different -- can comfirm this 'shutdown stop' for my XP 32 & 64bit.


So perhaps some other make additional tests:

choose any GTWVT app, start it, reboot Windows - and please confirm or neglect.

 

1) why program quits with no one message (HB_K_CLOSE doesn't catch)

I explicitely told you, that is my personal modification !.

I build Harbour from source and work with a bit to my *personal* needs adapted GTs.

This way is also open to you, i named the line in file ...


best regards

Rolf

José Quintas

unread,
Sep 15, 2014, 3:45:04 PM9/15/14
to harbou...@googlegroups.com
In GTWVG, close is converted to K_ESC, then need test ESC only.

I don't know about another GTs, but there are option in Harbour:

Set( _SET_EVENTMASK, INKEY_ALL - INKEY_MOVE + HB_INKEY_GTEVENT )

nKey := Inkey()
IF nKey == HB_K_CLOSE
    IF MsgYesNo( "Want Exit?" )
        QUIT
    ENDIF
ENDIF

Looking into inkey.ch:

#define HB_INKEY_GTEVENT        1024 /* Harbour extension */

#define HB_K_CLOSE              1102


José M. C. Quintas
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

elch

unread,
Sep 16, 2014, 3:05:26 AM9/16/14
to harbou...@googlegroups.com
José,


In GTWVG, close is converted to K_ESC, then need test ESC only.
 
----

2014-03-19 21:27 UTC-0800 Pritpal Bedi

...

* contrib\gtwvg\gtwgud.c

* contrib\gtwvg\gtwvgd.c

% Changed: WM_CLOSE firing K_ESC => HB_K_CLOSE in accordance rest of GTs.

----


How does your GTWVG behave -- any influence on the Windows shutdown process, if application is opened ?


regards

Rolf

Sergy

unread,
Sep 16, 2014, 5:53:40 AM9/16/14
to harbou...@googlegroups.com
Hello Rolf.

So perhaps some other make additional tests:
choose any GTWVT app, start it, reboot Windows - and please confirm or neglect.

 I can do it at evening. 

WBR, Sergy


José Quintas

unread,
Sep 16, 2014, 7:36:33 AM9/16/14
to harbou...@googlegroups.com
Application is closed, like another applications.
I have a question before exit "Yes or No", but it is not displayed.

I remember that in VB there was a test to know if exit is made by user, or by S.O.
Is your question about this?

José M. C. Quintas
--

Qatan

unread,
Sep 16, 2014, 7:59:23 AM9/16/14
to harbou...@googlegroups.com
Hello,
 
I tried to see if I could get such behavior with GTWVT program but couldn’t notice any problem to shutdown/reboot Windows 7 Pro 32 as Administrator.
I tried with only one WVT program and tested also with several and no problems at all...
 
Qatan
--

elch

unread,
Sep 16, 2014, 8:33:28 AM9/16/14
to harbou...@googlegroups.com
Thanks! Qatan,

funny ..

my XPs run in Virtualbox, and i 'somehow' could reproduce the behavior reported by Sergy.
I'll searching my sunglasses, much to bright here -- should help enourmous find the cause .. :-)

Sergy,
32 or 64 bit Win7 ? -- check also against XP ..

best regards
Rolf

Sergy

unread,
Sep 16, 2014, 5:05:37 PM9/16/14
to harbou...@googlegroups.com
Hi Rolf

Sergy,
32 or 64 bit Win7 ? -- check also against XP ..

I did some test.
1) Windows XP SP3. The App is fully ignored the first attempt to reboot/logoff. Second and all others attempts lead to close app with no message but stopped the Windows duties.
2) Windows 7 64bit Home Extended - Windows won all times. At first ~2 seconds pause with system message screen "There are programs still working..." after that - reboot/logoff.
3) Windows Server 2003 R2 - works like XP, but I have no rights to reboot. First attempt to logoff - fails (program works), 2nd and all others - the programm closes silently but windows logoff fails.

There is the code:

#include "inkey.ch"
#include "hbgtinfo.ch"
REQUEST HB_GT_WVT_DEFAULT 

FUNC Main()
LOCAL sx:="test string for input"
 CLEAR SCREEN
 hb_GtInfo( HB_GTI_CLOSEMODE, 1 )
 SET(_SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT )
 SETKEY(HB_K_CLOSE,{||ExitDialog()})
 @ 10,10 SAY "test" GET sx
 READ
 ? "program is closing"
 WAIT
RETURN

FUNC ExitDialog()
 ALERT("Closing the app")
 QUIT
RETURN

WBR, Sergy

вторник, 16 сентября 2014 г., 16:33:28 UTC+4 пользователь elch написал:

elch

unread,
Sep 17, 2014, 7:43:23 AM9/17/14
to harbou...@googlegroups.com
Hi Sergy,

i can *not* replicate your other reported behaviors for my both XPs, as e.g.

the app keeps not running ..

*Only* that the app is regularly ending with first shutdown attempt, but this

also stops the shutdown process. So i have to 'double' initiate shutdown.


This behavior is very explainable to me.

I am not only able to 'correct' that in Harbour source, but use it for my logic.


---

Lets look 'under the hood:

# origin:

. case WM_QUERYENDSESSION: /* Windows send this event for shutdown */

. hb_vmRequestQuit(); /* this 'kills' all Harbour threads */

. return 0; /* this value (FALSE) Windows gets as answer */


where FALSE means don't progress ..


# elch personal version:

. case WM_QUERYENDSESSION: /* Closing down computer */

. if( pWVT->CloseMode == 0 || pWVT->CloseMode == 2 )

. {

. hb_vmRequestQuit();

. return 1; /* agree to shutdown request */

. }

. else

. {

. hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_CLOSE );

. return 0; /* shutdown request rejected */

. }



-----

GTWVG acts in the same manner, you can try for fun:


remove / outcomment that line (as not forcible needed)

* REQUEST HB_GT_WVT_DEFAULT


then compile your example:

hbmk2 bet.prg -gtwvg gtwvg.hbc


? same 'mystic' shutdown behavior, right ?

[ GTWVG still does not know this newer HB_GTI_CLOSEMODE, only the old

HB_GTI_CLOSABLE -- ! NOT the topic of this thread, leave the example as is ! ]


BTW, in opposite to XP 32bit [NT 5], XP64 is morely based on Win 2003 Server [ NT 5.2] -- my test environment ..


best regards

Rolf

elch

unread,
Sep 18, 2014, 5:36:02 AM9/18/14
to harbou...@googlegroups.com
Hello Sergy,


GTWVG acts in the same manner, you can try for fun:


additional remark:

it was not an advice to use GTWVG.

Because this GT is in multiple options different to GTWVT and all others -- and lacks of some unsolved problems ..


|------

| hej, pssssst: you easy can compile Harbour from source, described in README.md ..


Ok, to compile an executable is a 'mystic' process for a common user: how the hell this machine is working ..

It should be a butterbrot at breakfest for a 'developer' !

-- and i never again like to miss this advantage: source source source source ! down to the physical ground


What a transister is and do, another topic -- have a look for Zuse, who did it 'machanical':

http://en.wikipedia.org/wiki/File:Zuse_Z1-2.jpg

( from: http://en.wikipedia.org/wiki/Konrad_Zuse )


best regards

Rolf

elch

unread,
Sep 18, 2014, 5:47:07 AM9/18/14
to harbou...@googlegroups.com

excuse!, two typos after my tripled proofread ( better before commit to outer world .. )

'transistor' and 'mechanical'


Pritpal Bedi

unread,
Sep 18, 2014, 2:39:47 PM9/18/14
to harbou...@googlegroups.com
Hi Rolf


GTWVG acts in the same manner, you can try for fun:


additional remark:

it was not an advice to use GTWVG.

Because this GT is in multiple options different to GTWVT and all others -- and lacks of some unsolved problems ..



I am interested in what way GtWVG is different than GtWVT as long as pure console is concerned ?
It differers from other GTs when it comes to the task of GUI infusion inside the console or outside of it.
GtWVG offeres much more versatality and options over and above which GtWVT provides. 
The only downside, which I can think of, is it is Windows only solution, means if you have developed 
with GtWVG with GUI emulations then application is tied to Windows only.

In pure console emulations you can go with GtWVT or GtWVG equally well.

Also it will be good if you enumerate those "unsolved problems" so that I could fix them.


Pritpal Bedi
a student of software analysis and concepts

elch

unread,
Sep 18, 2014, 3:10:40 PM9/18/14
to harbou...@googlegroups.com
Hello Pritpal,

minimize window after maximize ( we longer ago talked about, you won't fix )
HB_GTI_CLOSEMODE missing
( BTW, there is an overlapping area of GTWVG HB_GTI_* settings against hb_gtinfo.ch )
hb_gfx* functions
...

+1
now with HB_K_CLOSE

best regards
Rolf

elch

unread,
Sep 18, 2014, 11:55:18 PM9/18/14
to harbou...@googlegroups.com
Excuse Pritpal,

was extreme sloppy explained.


minimize window after maximize ( we longer ago talked about, you won't fix )

*restore* the window size as before, after maximize.

It is possible, i hacked it me myself into -- and if i get it work, it should be a bagatelle for you.

 
HB_GTI_CLOSEMODE missing
That is really fine what Przemek newly invented and covers all wishes.
 
( BTW, there is an overlapping area of GTWVG HB_GTI_* settings against hb_gtinfo.ch )

if mean hbgtwvg.ch versus hbgtinfo.ch and #defines >= 71


hb_gfx* functions

long ago -- if i right remember we need to set: Wvt_SetGui( .T. )

but they only appear if using another window as cleaning rag.

Maybe an idea to set this automatic with first hb_gfx* call.

 
---
pure console mode:
You mean 'black and white' terminal text ?
-- and i compare GTWVG against the other graphic capable GTs, right !

best regards
Rolf

elch

unread,
Sep 19, 2014, 12:02:39 AM9/19/14
to harbou...@googlegroups.com
addendum:

HB_GTI_SETPOS_XY

i see there a hack in my soure: ? " "

to let the window appear before setting. Don't know if this still applies.

Sergy

unread,
Sep 19, 2014, 9:15:21 AM9/19/14
to harbou...@googlegroups.com
Hi Rolf

I compiled my example under GTWVG.

1) When I press on [x] - the Alert() appears. This indicates that GTWVG knows about HB_K_CLOSE key.
2) WinXP 32 SP3 - when I try to logoff - program crashes with system dialog "Address 0x0000 0x0000. Memory cannor be 'read'", logoff process stops.
3) Win7 64 Home Ext win: closes the app with no Alert() and no errors and does its job to reboot.

WBR,
Sergy

среда, 17 сентября 2014 г., 15:43:23 UTC+4 пользователь elch написал:

Sergy

unread,
Sep 19, 2014, 3:08:03 PM9/19/14
to harbou...@googlegroups.com
This is hb_out.log with crash info:

Application Internal Error - D:\HB_TEST\gtwvt_close_test.exe
Terminated at: 2014-09-19 17:03:15
Unrecoverable error 6005: Exception error:

    Exception Code:C0000005
    Exception Address:00000000
    EAX:00B27DE4  EBX:00B2A06C  ECX:0022F3A0  EDX:00B27DD8
    ESI:001D0142  EDI:00000007  EBP:008200F6
    CS:EIP:001B:00000000  SS:ESP:0023:0022F388
    DS:0023  ES:0023  FS:003B  GS:0000
    Flags:00010212
    CS:EIP:
    SS:ESP: 0040245A 00B27DE4 0022F3A0 0022F3A4 0022F3A8 00000028 00000000 00000000 004231F2 0057F21C 00408D41 0022FAF8 00B2A06C 001D0142 00000007 008200F6

    C stack:
    EIP:     EBP:       Frame: OldEBP, RetAddr, Params...

Modules:
0x00400000 0x001A6000 D:\HB_TEST\gtwvt_close_test.exe
0x7C900000 0x000B3000 C:\WINDOWS\system32\ntdll.dll
0x7C800000 0x000F8000 C:\WINDOWS\system32\kernel32.dll
0x5D5B0000 0x0009A000 C:\WINDOWS\system32\COMCTL32.DLL
0x77DC0000 0x000AC000 C:\WINDOWS\system32\ADVAPI32.dll
0x77E70000 0x00093000 C:\WINDOWS\system32\RPCRT4.dll
0x77FE0000 0x00011000 C:\WINDOWS\system32\Secur32.dll
0x77F10000 0x00049000 C:\WINDOWS\system32\GDI32.dll
0x7E360000 0x00091000 C:\WINDOWS\system32\USER32.dll
0x77C00000 0x00058000 C:\WINDOWS\system32\msvcrt.dll
0x774D0000 0x0013E000 C:\WINDOWS\system32\OLE32.dll
0x77110000 0x0008B000 C:\WINDOWS\system32\OLEAUT32.DLL
0x7C9C0000 0x0081C000 C:\WINDOWS\system32\SHELL32.DLL
0x77F60000 0x00076000 C:\WINDOWS\system32\SHLWAPI.dll
0x76360000 0x0001D000 C:\WINDOWS\system32\IMM32.DLL
0x773C0000 0x00103000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\comctl32.dll
0x76350000 0x00005000 C:\WINDOWS\system32\msimg32.dll
0x746E0000 0x0004C000 C:\WINDOWS\system32\MSCTF.dll
0x75310000 0x0002E000 C:\WINDOWS\system32\msctfime.ime


пятница, 19 сентября 2014 г., 17:15:21 UTC+4 пользователь Sergy написал:

elch

unread,
Sep 19, 2014, 5:23:18 PM9/19/14
to harbou...@googlegroups.com
Hi Sergy,


This is hb_out.log with crash info:
 
Application Internal Error - D:\HB_TEST\gtwvt_close_test.exe
Terminated at: 2014-09-19 17:03:15
Unrecoverable error 6005: Exception error:
 
    Exception Code:C0000005
    Exception Address:00000000

the 3 lines indicate, that Harbour was living,

before it very ugly stumbled headfirst into the 'holy hole of nothing':

Error 6005 -- exception sigsegv, adress 0


That is NOT an empty array where you try to get a non existing element.

What can cause such an error is very known, but IMHO not the topic.

Because the scary part is, HOW we get there.

During shutdown, the running application get informed about that:

my bespoken WM_ENDQUERYSESSION signal, which causes Harbour to stop execute.


If the taskmanager kills Harbour, it won't execute anything further -- you will NOT get these 3 lines.


Since nor me either others can replicate the behavior,

that the app keeps running during shutdown process,

it must be something special at your 'environment' in farest sense.


I would suggest to switch back to GTWVT

-- and pass to other for ideas, as i have at moment none ......


best regards

Rolf

elch

unread,
Sep 19, 2014, 5:56:22 PM9/19/14
to harbou...@googlegroups.com
Sergy,

compile example snippet for GTWVT, find and name a place to download.
Want to let my XP trample on it ...

Message has been deleted

Sergy

unread,
Sep 19, 2014, 6:24:32 PM9/19/14
to harbou...@googlegroups.com
Hi Rolf

I repeat for understanding: program crashes when I compiled it with GTWVG driver, as you told. 
The name gtwvt_close_test.exe remains from beginning.
I think, I need 2 upload another archive, with two versions for both terminals...


WBR,
Sergy

суббота, 20 сентября 2014 г., 1:56:22 UTC+4 пользователь elch написал:

elch

unread,
Sep 19, 2014, 7:11:09 PM9/19/14
to harbou...@googlegroups.com

result:


GTWVT work on all tested OS [ W2K, XP32, XP64 ] *AS PREDICTED*

: regularly errorless lightning fast closing app --- shutdown stopped !


GTWVG:

work with most tries like gtwvt ONLY on XP32, but sometimes? also here:

CRASHES with shutdown (every) attempt on W2K & XP64

( this M$ E.T. want to send report home :-) )

* shutdown stopped *


---

in ANY case the second initiated shutdown will work,

as nothing more running ...


---

no virus found in executables


elch

elch

unread,
Sep 19, 2014, 11:30:01 PM9/19/14
to harbou...@googlegroups.com
Hi Sergy,

the cause for the GTWVG crashes is found, reported it on devel's list.
BTW already mentioned here by me two days ago ;-), without recognizing the full impact.

So remains the by me watched and predicted behavior of stopping Windows shutdown.
A link to Microsoft documentation describing it can be found in my first post of this thread.
'Funny' that (only?) Win 7 seem to ignore its own specification, but on the other hand not
really surprising to me: MS and standards ...

best regards
Rolf

José Quintas

unread,
Sep 20, 2014, 8:25:23 AM9/20/14
to harbou...@googlegroups.com
I am using gtwvg as default GT for a long time.
But I use only the pushbutton control.
Application runs on user machine, any Windows version. (I think XP64 is the only version I do not have users).

I change these defaults in Harbour, but no special reason:

hb_gtInfo( HB_GTI_MAXIMIZED, .F. )
hb_gtInfo( HB_GTI_COMPATBUFFER, .F. )
SET( _SET_EVENTMASK, INKEY_ALL - INKEY_MOVE )

my hbp:

*.prg
*.c
jpa.rc
-oJPA
hbct.hbc
hbtip.hbc
hbhpdf.hbc
hbziparc.hbc
gtwvg.hbc
hbmisc.hbc
#rddado.hbc

-m
-n
-es2
-w3
-compr
-winuni
-workdir=d:\temp
-inc
-strip
-mt
-quiet
#-jobs=3


Note:
I am not sure, but gtwvg uses multithread only when available.
Try to add -mt

Note2:
I remember now: When using default errorsys in tests, application expects ENTER before show error message.
I do not know if this could affect shutdown.

José M. C. Quintas

Qatan

unread,
Sep 20, 2014, 3:01:34 PM9/20/14
to harbou...@googlegroups.com
Hello Sergy,
 
I recommend you to use GTWVT for now (I use it and have no problems at all) and to report this problem to Pritpal because he is the main maintainer of GTWVG.
The main difference of WVT and WVG is that the second uses a lot of Windows API (or Windows driven functions) and I believe the crash you are getting is because of that...
 
Hope it helps you.
 
Qatan
--

elch

unread,
Sep 20, 2014, 4:05:11 PM9/20/14
to harbou...@googlegroups.com
Hi Qatan,

if you have read the thread from bottom up ... :-)

 
I recommend you to use GTWVT for now (I use it and have no problems at all) and to report this problem to Pritpal because he is the main maintainer of GTWVG.
The main difference of WVT and WVG is that the second uses a lot of Windows API (or Windows driven functions) and I believe the crash you are getting is because of that...

... you would have been hinted, that i put my diagnose on devels list :-)

best regards
Rolf

Qatan

unread,
Sep 20, 2014, 4:35:00 PM9/20/14
to harbou...@googlegroups.com
Hello Rolf,
Oh yes.
Sorry, I had a lot of emails from the list to read...
Thanks for your care and help.
 
Qatan

elch

unread,
Sep 20, 2014, 4:56:54 PM9/20/14
to harbou...@googlegroups.com
Nothing ! to excuse, i should do:

was not ment to offend you, but only a hint to save double effort.
As this long thread and the special case took me quite a time ..
.. and some beer :-) :-)

best regards
Rolf

Sergy

unread,
Sep 21, 2014, 4:13:54 AM9/21/14
to harbou...@googlegroups.com
Hello Qatan

For my needs is more than enough - GTWIN, but as I understand, it doesnt respond to HB_K_CLOSE event.
Some graphical possibilities for my purposes - the viewer (like as Irfan View or Fastone) does.

And the guess - which one (GTWVG or GTWVT) can first responds to close/logoff/reboot query... It is "high machinery" for me at this moment.

WBR,
Sergy

суббота, 20 сентября 2014 г., 23:01:34 UTC+4 пользователь Qatan написал:
Reply all
Reply to author
Forward
0 new messages