Issue-#108 BlackBox Start up warnings

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

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

Josef Templ wrote:Maybe GetLastError gives us an answer to this question.

- Josef
print the GetLastError:

Code: Select all

MODULE ObxTest4;

	IMPORT WinApi;
       
	VAR res: INTEGER;
	
	VAR err: ARRAY 256 OF CHAR;
	
	
	PROCEDURE IntToString(x: INTEGER; VAR str: ARRAY OF CHAR);
		VAR buf: ARRAY 12 OF BYTE; i, j: INTEGER;
	BEGIN
		IF x = MIN(INTEGER) THEN str := "-2147483648"; RETURN END;
		IF x < 0 THEN x := -x; str[0] := '-'; i := 1; ELSE i := 0; END;
		j := 0;
		REPEAT buf[j] := SHORT(SHORT((x MOD 10))); INC(j); x := x DIV 10 UNTIL x = 0;
		DEC(j);
		WHILE (j >= 0) & (i < LEN(str) - 1) DO str[i] := CHR(ORD('0') + buf[j]); INC(i); DEC(j); END;
		str[i] := 0X;
	END IntToString;
	
	
BEGIN
	res := WinApi.MessageBoxW(0, "hello", "Test", {});
	IF res = 0 THEN (* failed *)
		res := WinApi.GetLastError();
		IntToString(res, err);
		res := WinApi.LoadLibraryA("COMCTL32.dll");
		res := WinApi.MessageBoxW(0, err, "GetLastError", {});
	END
END ObxTest4.

DevLinker.Link
	ObxTest4.exe := ObxTest4$
.
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 »

luowy, can you also show us the output (err) in case of failure?

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

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

make a manifest file for the exe,you can get err dialog
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: Issue-#108 BlackBox Start up warnings

Post by luowy »

@Josef
this problem is so simple,I cant understand what the trouble stop you.

the XP's User32.dll has a builtin commctl.dll <6.0,so the MB can be opened without loading commctl32.dll explicitly.
but if the manifest file required the commctl.dll verion >=6.0,the commctl32.dll file must loaded explicitly.
there are two way for loading dll: 1,exe file included dll's name;2,LoadLibraryA() in the code.
pay attention to the BB compiler will not incude the dll name in the exe file
if the source code not used it(no call the dll's procedure),even it imported in the source code import list ;

understand this,our ploblem:
the BB exe file not include the commctl32.dll,and the dll file has not loaded by LoadLibraryA() before FatalError() call,
so the MB cant opened and return a 0 result;(that occur only on XP);
the fixup call a LoadLibraryA() to load the commctl32.dll 6.0(manifest file),then call MB,the MB can be opened.

that's all.no magic,I think.
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 »

luowy wrote:make a manifest file for the exe,you can get err dialog
Luowy, this is exactly the problem.
On my XP SP3 I DO NOT get the error behavior.
Everything works fine with or without a manifest.
In other words, I cannot generate the error code myself.

Why is my XP behaving differently?
There must be some other difference in our installations.
Maybe a virus checker, another version of IE or Visual Studio or Office
or some setting in the control panel that causes the error.

The user32.dll does not have a built in comctl32 dll, as far as I see.
All the dlls are placed somewhere in the Windows directory, outside of user32.dll.
Also, there is no direct dependency between user32.dll and comctl32.dll
according to Dependency Walker.

ObxTest.exe references user32.dll because it calls MessageboxW.
This is shown correctly in Dependency Walker.

- 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, do you run Win XP on the Virtual Machine or it is installed directly?
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 just installed clean XP XP3 to VirtualBox and it is run very fast. The bug reproducing. So this is not timing problem.

This is the video for people who have no XP or VirtualBox. It has sound so you can here beeps.

[The extension mp4 has been deactivated and can no longer be displayed.]

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 »

luowy wrote:@Josef
this problem is so simple,I cant understand what the trouble stop you.

the XP's User32.dll has a builtin commctl.dll <6.0,so the MB can be opened without loading commctl32.dll explicitly.
but if the manifest file required the commctl.dll verion >=6.0,the commctl32.dll file must loaded explicitly.
there are two way for loading dll: 1,exe file included dll's name;2,LoadLibraryA() in the code.
pay attention to the BB compiler will not incude the dll name in the exe file
if the source code not used it(no call the dll's procedure),even it imported in the source code import list ;

understand this,our ploblem:
the BB exe file not include the commctl32.dll,and the dll file has not loaded by LoadLibraryA() before FatalError() call,
so the MB cant opened and return a 0 result;(that occur only on XP);
the fixup call a LoadLibraryA() to load the commctl32.dll 6.0(manifest file),then call MB,the MB can be opened.

that's all.no magic,I think.
I am quite satisfied with this detailed explanations. So I do not see reasons for continue study of bug reasons.
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, this is exactly the problem.
On my XP SP3 I DO NOT get the error behavior.
Everything works fine with or without a manifest.
In other words, I cannot generate the error code myself.
Josef,
When I create a BBTest.exe I also can not generate an error, with or without a manifest.
This is a little bit tricky. In order to first create the exe one needs to hide the Converters.ocf which
has the wrong finger print. Then after that exe has been form to then uncover the Converters.ocf
and run

Code: Select all

 DevPacker.PackThis BBTest.exe := 
Code/Kernel.ocf
Code/Converters.ocf
The BBTest.exe does not fail.
-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 »

It seems that nobody is able to reproduce the error.
Otherwise somebody should be able to post the error code returned by GetLasterror
as implemented by luowy's test program.

I run XP SP3 natively on a DELL Latitude D800 Laptop.
I am not able to play Ivan's movie.

- Josef
Post Reply