Issue-#108 BlackBox Start up warnings

Post Reply
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Issue-#108 BlackBox Start up warnings

Post by DGDanforth »

Josef Templ wrote: @Doug, luowy, Robert, Ivan: what is your user32.dll version?
Mine is: file version = product verion = 5.1.2600.5512
Note that MessageBoxW comes from user32.dll.
- Josef
My user32.dll is the same as yours 5.1.2600.5512

Your ObxTest3 produces an error box with "Hello" when there is no manifest for it and
it does nothing when there is a manifest.

-Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

If you insert a WinApi.Sleep(100) as the very first line,
does it then work with the manifest?

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Issue-#108 BlackBox Start up warnings

Post by DGDanforth »

Josef Templ wrote:If you insert a WinApi.Sleep(100) as the very first line,
does it then work with the manifest?

- Josef
Josef,
I am getting inconsistent results.
Without changing anything from yesterday when I ran ObxTest3.exe today I got the message box WITH the manifest.
I then added the sleep function and got the message box with the manifest.
I then removed the sleep function and got the message box with the manifest.
-Doug
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

DGDanforth wrote:
Josef Templ wrote:If you insert a WinApi.Sleep(100) as the very first line,
does it then work with the manifest?

- Josef
Josef,
I am getting inconsistent results.
Without changing anything from yesterday when I ran ObxTest3.exe today I got the message box WITH the manifest.
I then added the sleep function and got the message box with the manifest.
I then removed the sleep function and got the message box with the manifest.
-Doug
Josef's test file has a side effect: the COMCTL32.dll had loaded already before test.exe run.
this test file can work expectedly.

Code: Select all

MODULE ObxTest3;

	IMPORT WinApi, WinCtl, SYSTEM;
       VAR res: INTEGER;
	
BEGIN
	
	res := WinApi.MessageBoxW(0, "hello", "Test", {});
		
	IF res =0 THEN 
		(*WinCtl.InitCommonControls();*)
		res:=WinApi.WinExec("cmd",5);
	END;
	
END ObxTest3.

DevLinker.Link
	ObxTest3.exe := ObxTest3$
you will cant see the dialog box if the test.exe file has a manifest.

so,the bug fixup for xp is simple:

Code: Select all

	PROCEDURE FatalError* (id: INTEGER; str: ARRAY OF CHAR);
		VAR res: INTEGER; title: ARRAY 16 OF CHAR;
	BEGIN
		title := "Error xy";
		title[6] := CHR(id DIV 10 + ORD("0"));
		title[7] := CHR(id MOD 10 + ORD("0"));
		WinCtl.InitCommonControls(); (* <<<< add this line ,import WinCtl*)
		res := WinApi.MessageBoxW(0, str, title, {});
		WinOle.OleUninitialize();
		IF ~inDll THEN RemoveExcp(excpPtr^) END;
		WinApi.ExitProcess(1)
		(* never returns *)
	END FatalError;
luowy
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

DGDanforth wrote: I am getting inconsistent results.
Without changing anything from yesterday when I ran ObxTest3.exe today I got the message box WITH the manifest.
I then added the sleep function and got the message box with the manifest.
I then removed the sleep function and got the message box with the manifest.
-Doug
Did you (1) compile and (2) link and (3) name the manifest according to the exe file?
Did the link step show success? It is for example not possible to build a new exe file
as long as the same exe file is running.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

1. luowy, your fix in FatalError is different from the one you showed us before.
Actually it is simplified a lot. Did you find it by try and error?

2. If MessageBoxW is crashing a process under XP depending on using comctl 5 or 6
there must be postings found on the internet or in msdn. I don't find such postings.
Where did you get your information from?

3. I cannot find any docu that requests one to call InitCommonControls before
using MessageBoxW. While I don't doubt that it helps, I still doubt that we understand
the root cause of this bug.

4. luowy, could you run a test with a WinApi.Sleep(100) before calling MessageBoxW?
This might help us to see if it is related to a timing issue (a race condition caused by
loading dlls via parallel threads).

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Issue-#108 BlackBox Start up warnings

Post by Ivan Denisov »

I committed LuoWe fix to make trial BackBox version.
http://blackboxframework.org/unstable/i ... a1.473.zip

I tested this version on my XP machine. Now there is not problems with error message.

Changes are:
http://redmine.blackboxframework.org/pr ... ecccaea26c
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

Ivan Denisov wrote:I committed LuoWe fix to make trial BackBox version.
http://blackboxframework.org/unstable/i ... a1.473.zip

I tested this version on my XP machine. Now there is not problems with error message.

Changes are:
http://redmine.blackboxframework.org/pr ... ecccaea26c
Does this also cover DefaultTrapViewer, i.e. a TRAP that occurs early in the startup?
As far as I see it only covers FatalError, i.e. messages from the loader.

In addition I would like to suggest adding an explicit comment to the InitCommonControls call
because this line is very special and not possible to understand otherwise.

- Josef
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

Josef Templ wrote:1. luowy, your fix in FatalError is different from the one you showed us before.
Actually it is simplified a lot. Did you find it by try and error?

2. If MessageBoxW is crashing a process under XP depending on using comctl 5 or 6
there must be postings found on the internet or in msdn. I don't find such postings.
Where did you get your information from?

3. I cannot find any docu that requests one to call InitCommonControls before
using MessageBoxW. While I don't doubt that it helps, I still doubt that we understand
the root cause of this bug.

4. luowy, could you run a test with a WinApi.Sleep(100) before calling MessageBoxW?
This might help us to see if it is related to a timing issue (a race condition caused by
loading dlls via parallel threads).

- Josef
another fixup: no need import WinCtl

Code: Select all

	PROCEDURE FatalError* (id: INTEGER; str: ARRAY OF CHAR);
		VAR res: INTEGER; title: ARRAY 16 OF CHAR;
	BEGIN
		title := "Error xy";
		title[6] := CHR(id DIV 10 + ORD("0"));
		title[7] := CHR(id MOD 10 + ORD("0"));
		res := WinApi.MessageBoxW(0, str, title, {});
		IF res = 0 THEN (* win2000/XP *)
			res := WinApi.LoadLibraryA("COMCTL32.dll");
			res := WinApi.MessageBoxW(0, str, title, {});
		END;
		WinOle.OleUninitialize();
		IF ~inDll THEN RemoveExcp(excpPtr^) END;
		WinApi.ExitProcess(1)
		(* never returns *)
	END FatalError;
luowy
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Issue-#108 BlackBox Start up warnings

Post by Ivan Denisov »

Post Reply