Issue-#108 BlackBox Start up warnings

Post Reply
User avatar
Josef Templ
Posts: 2048
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

Doug, this is the expected behavior.

FYI: the interesting things start in the body of StdLoader
where module "Init" is loaded and initialized.
In the body of Init the BlackBox application is opened and started
with HostMenus.Run, which is the event processing loop
(called via Kernel.Start for defining the stackbase for GC).
This never returns and therefore a HALT() after it has no effect.

When Init is loaded, this recursively loads and initializes all
imported modules. An example is Converters.

It seems to me that you are not able to reproduce the error case except may be
with an old exe file that you are no longer able to reproduce.
Have you tried the example described by Robert?
clean master, put a HALT into Converts body, no error message.
What CPU are you using?

- 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 »

Josef Templ wrote:It seems to me that you are not able to reproduce the error case except may be
with an old exe file that you are no longer able to reproduce.
Have you tried the example described by Robert?
clean master, put a HALT into Converts body, no error message.
What CPU are you using?
I have Intel Celeron CPU on this machine with XP.

The bug is exist for sure and reproducing with clean 1.5, 1.6 and 1.7-a1 versions of BlackBox.

I found one more interesting thing. It depends of the name of the exe file.

Doug, please copy BlackBox.exe with name BlackBox2.exe and change the name in the desktop link also. There will be correct error window!
It is hard to explain... Maybe the HostMenus somehow setup the name of the application an this does not allow error message to be shown correct.
I tried to clean register. That did not solve the problem.
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

the Blackbox.exe.manifest file is the point.

Code: Select all

<assemblyIdentity
              type="win32"
              name="Microsoft.Windows.Common-Controls"
              version="6.0.0.0"
              processorArchitecture="x86"
              publicKeyToken="6595b64144ccf1df"
              language="*"
          />
the version 6.0's Common-Controls need WinApi.InitCommonControlsEx() before call WinApi.MessageBoxW();on XP SP3.
which no need on win7.
you can remove the manifest file simply,or rename it on XP.

you can test the follow examples on XP,
the first one;

Code: Select all

MODULE ObxTest;

	IMPORT WinApi;
	
	VAR res: INTEGER;
BEGIN
	res := WinApi.MessageBoxW(0, "hello", "Test", {});
END ObxTest.
Q^ DevLinker.Link
	ObxTest.exe := ObxTest$
create ObxTest.exe file,

Code: Select all

MODULE ObxTest2;

	IMPORT WinApi,WinCtl;
	
	VAR res: INTEGER;
	VAR icex: WinCtl.INITCOMMONCONTROLSEX;
BEGIN
	icex.dwSize := SIZE(WinCtl.INITCOMMONCONTROLSEX);
	icex.dwICC := WinCtl.ICC_TAB_CLASSES + WinCtl.ICC_BAR_CLASSES;
	res := WinCtl.InitCommonControlsEx(icex);
	res := WinApi.MessageBoxW(0, "hello", "Test", {});
END ObxTest2.

DevLinker.Link
	ObxTest2.exe := ObxTest2$
create ObxTest2.exe file,

and create a same name manifest file for each exe file(the content copy form Blackbox.exe.manifest) in the same directory;

run the two exe file: the first one can't open a dialog,and the second one can do.

luowy
User avatar
Josef Templ
Posts: 2048
Joined: Tue Sep 17, 2013 6:50 am

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

Interesting!
I have XP SP3 Professional.
The file version of Comctl32.dll is 5.82.xxxx.yyyy.
The product version of Comctl32.dll is 6.0.xxxx.yyyy.
No problems in any tests including luowy's new test.

> the version 6.0's Common-Controls need WinApi.InitCommonControlsEx() before call WinApi.MessageBoxW();on XP SP3.
sounds like a bug in Comctl32.dll version 6.0 for XP SP3.
In msdn I cannot find any docu that says that MessageBox needs
any initialization first.
Is this special need documented somewhere?
Is it possible that a Sleep before calling WinApi.MessageBoxW() will also change the behavior?

according to msdn: MessageBoxW
"If the function fails, the return value is zero. To get extended error information, call GetLastError."
Do we get any error information from MessageBoxW if it fails?

- 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 »

Ivan Denisov wrote: I found one more interesting thing. It depends of the name of the exe file.

Doug, please copy BlackBox.exe with name BlackBox2.exe and change the name in the desktop link also. There will be correct error window!
Ivan, YES!
I did as you suggested and now do get an error window.
-Doug
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:Interesting!
I have XP SP3 Professional.
The file version of Comctl32.dll is 5.82.xxxx.yyyy.
The product version of Comctl32.dll is 6.0.xxxx.yyyy.
No problems in any tests including luowy's new test.
I have XP SP3 Home edition
Version 5.1 (Build 2600.xpsp_sp3_qfe.130704-0421:Service Pack3)
Processor Name: Intel Core 2 Duo
The file version of Comctl32.dll is 5.82.2900.6028
The product version of Comctl32.dll is 6.00.2900.6028
I have not yet done luowy's test.
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 »

Luowy,
Thank you.
Your tests perform as you have specified.
-Doug
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: according to msdn: MessageBoxW
"If the function fails, the return value is zero. To get extended error information, call GetLastError."
Do we get any error information from MessageBoxW if it fails?

- Josef
My BBTest.exe does not seem to call MessageBoxW whether or not Converters has the wrong finger print,
and also whether or not BBTest has a manifest.
-Doug
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 »

So where are we?
The goal is for BlackBox to fail in the same way for all versions of the operating system.

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

Re: Issue-#108 BlackBox Start up warnings

Post by Josef Templ »

I have the same Comctl32.dll version as Doug has.
The file version of Comctl32.dll is 5.82.2900.6028
The product version of Comctl32.dll is 6.00.2900.6028

@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.

If MessageBoxW does not show anything it will most probably be called
correctly from BB but it does not work as expected.
Is there anything written to the Windows event log?
Is it returning from the call? If yes, what is the function result and GetLastError?
With luowy's nice test program and a little extension this should be possible to figure out.

Code: Select all

MODULE ObxTest3;

   IMPORT WinApi,WinCtl, SYSTEM;
   
   VAR res: INTEGER;
   VAR icex: WinCtl.INITCOMMONCONTROLSEX;
   VAR err: WinApi.PtrWSTR;
BEGIN
   res := WinApi.MessageBoxW(0, "hello", "Test", {});
   IF res = 0 THEN (* failed *)
     err := SYSTEM.VAL(WinApi.PtrWSTR, WinApi.GetLastError());
     icex.dwSize := SIZE(WinCtl.INITCOMMONCONTROLSEX);
     icex.dwICC := WinCtl.ICC_TAB_CLASSES + WinCtl.ICC_BAR_CLASSES;
     res := WinCtl.InitCommonControlsEx(icex);
     res := WinApi.MessageBoxW(0, err, "GetLastError", {});
   END
END ObxTest3.
FYI: In your tests with Init or Converters check if you have a global Code dir as well.
The global Code dir takes precedence over System/Code and is used when you
compile modules without a subsystem such as Init or Converters.
So there may be multiple versions of such modules and it is easy to
get confused in tests.

- Josef
Post Reply