Delphi 2010 application starts in Windows XP. Not if recompiled with XE5 [Edit]

Hello,

we have developed a 32 bit application that must run under Windows XP (thousands of independent customers worldwide).

It works perfectly if compliled with Delphi 2010 Professional.
Recompiling it with Delphi XE5 (target platform Win 32) it starts but after some instants it shows a message like this:

The procedure entry point InitializeConditionVariable could not located in the dynamic library Kernel32.dll.

Of course this is due to such procedure only being available with Windows Vista and later.
Running a "dependency walk" software on the executable, we indeed see the dependency is there.

My question is: how do we find which application component depends on that call?

The application is not using packages, it's a lone executable.
We have full source code of all our components and searched for "ConditionVariable" (case insensitively) and found exactly zero matches at all.
Delphi's own Windows.pas and ShlObj.pas DO contain ConditionVariable code, but apparently it just detects whether it is implemented or not. In case it isn't, it looks like just implementing some "null code". So it should not cause issues.

We are using:
JVCL
ZeosLib, connecting to a MySQL server through recent libmysql.dll. The dll is part of an Oracle "connector" that installs the appropriate dll for the destination operating system (Windows XP in this case).
Midaslib (that is we are using the "embedded" version).

The official JVCL maintainer told us the library does not use condition variables at all. Searching for "ConditionVariable" through both JCL and JVCL code indeed yelded to no match found.

The program is structured to:

- Start
- Perform "assorted" SQL queries with no DataSnap / MIDAS usage.
- Open client datasets.

If I remove the libmysql dll, the program starts with no Kernel32 related message at all but of course it shows a missing Libmysql error and quits.
If I leave the libmysql.dll in, the program starts with no Kernel32 related message, then seems to perform something and only then I see the Kernel32 missing dependency message.

Anyone could please tell me if the embedded MIDAS creates those Kernel32 dependencies?

I'd be happy just knowing how to find out which code is triggering the dependencies at all.

Thanks in advance.

Edited by: Dario Fumagalli on Feb 19, 2014 7:19 AM

Edited by: Dario Fumagalli on Feb 19, 2014 7:22 AM
0
Dario
2/19/2014 3:23:46 PM
embarcadero.delphi.deployment 422 articles. 0 followers. Follow

4 Replies
1857 Views

Similar Articles

[PageSpeed] 5
Get it on Google Play
Get it on Apple App Store

Dario wrote:

> we have developed a 32 bit application that must run under Windows XP
> (thousands of independent customers worldwide).
> 
> It works perfectly if compliled with Delphi 2010 Professional.
> 
> Recompiling it with Delphi XE5 (target platform Win 32) it starts but
> after some instants it shows a message like this:
> 
> The procedure entry point InitializeConditionVariable could not
> located in the dynamic library Kernel32.dll.

This is not the the first time the VCL has linked to a newer API that as 
not available on older OS versions (TThread using GetThreadTimes() comes 
to mind).  And kernel32 cannot be delay-loaded, so functions like GetThreadTimes() 
and InitializeConditionalVariable() cannot be declared as 'delayed', they 
would have to be explicitly loaded using GetModuleHandle() and GetProcAddress() 
at runtime.

And technically speaking, XP is no longer a supported platform as a development 
OS, and maybe now as a deployment OS, either.

> My question is: how do we find which application component depends on
> that call?

You would have to grep the VCL's source code directly.

> The application is not using packages, it's a lone executable.

It is still using packages, they are simply statically compiled into the 
executable.

> Delphi's own Windows.pas and ShlObj.pas DO contain ConditionVariable
> code, but apparently it just detects whether it is implemented or not.
> In case it isn't, it looks like just implementing some "null code". So
> it should not cause issues.

So Embarcadero had the forsight to implement InitializeConditionVariable() 
dynamically, so the VCL is not at fault.  Something else outside of Embarcadero's 
code is using InitializeConditionVariable().

> If I remove the libmysql dll, the program starts with no Kernel32
> related message at all but of course it shows a missing Libmysql error
> and quits.

There you go then.  libmysql.dll must be using it.  If you statically link 
to a DLL, and it statically links to a missing API function, then your app 
will fail to load at all.

> If I leave the libmysql.dll in, the program starts with no Kernel32
> related message, then seems to perform something and only then I see
> the Kernel32 missing dependency message.

That does not make sense.  The dependancy message only appears when an EXE 
is first loaded into memory before it starts running.  If your app loads 
fine, and then fails only when the DLL is accessed at a later time, then 
the DLL must be getting loaded dynamically instead of statically and the 
OS is displaying the message when the DLL is loaded into memory, but it should 
not be doing that.  Unless the DLL is being loaded by another process that 
your EXE is spawning (directly or indirectly).

If your EXE is able to load and run before the failure occurs, then try is 
calling SetErrorMode(SEM_FAILCRITICALERRORS) before the DLL is loaded.  That 
should hopefully disable the popup message, and just make the DLL fail to 
load with an error code that the calling code can then handle as needed. 
 Then find (or recompile) a version of libmysql.dll that does not use unsupported 
APIs on older OS versions.

--
Remy Lebeau (TeamB)
0
Remy
2/19/2014 6:38:19 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Dario wrote:
> 
> > we have developed a 32 bit application that must run under Windows XP
> > (thousands of independent customers worldwide).
> > 
> > It works perfectly if compliled with Delphi 2010 Professional.
> > 
> > Recompiling it with Delphi XE5 (target platform Win 32) it starts but
> > after some instants it shows a message like this:
> > 
> > The procedure entry point InitializeConditionVariable could not
> > located in the dynamic library Kernel32.dll.
> 
> This is not the the first time the VCL has linked to a newer API that as 
> not available on older OS versions (TThread using GetThreadTimes() comes 
> to mind).  And kernel32 cannot be delay-loaded, so functions like GetThreadTimes() 
> and InitializeConditionalVariable() cannot be declared as 'delayed', they 
> would have to be explicitly loaded using GetModuleHandle() and GetProcAddress() 
> at runtime.
> 
> And technically speaking, XP is no longer a supported platform as a development 
> OS, and maybe now as a deployment OS, either.
> 
> > My question is: how do we find which application component depends on
> > that call?
> 
> You would have to grep the VCL's source code directly.
> 
> > The application is not using packages, it's a lone executable.
> 
> It is still using packages, they are simply statically compiled into the 
> executable.
> 
> > Delphi's own Windows.pas and ShlObj.pas DO contain ConditionVariable
> > code, but apparently it just detects whether it is implemented or not.
> > In case it isn't, it looks like just implementing some "null code". So
> > it should not cause issues.
> 
> So Embarcadero had the forsight to implement InitializeConditionVariable() 
> dynamically, so the VCL is not at fault.  Something else outside of Embarcadero's 
> code is using InitializeConditionVariable().
> 
> > If I remove the libmysql dll, the program starts with no Kernel32
> > related message at all but of course it shows a missing Libmysql error
> > and quits.
> 
> There you go then.  libmysql.dll must be using it.  If you statically link 
> to a DLL, and it statically links to a missing API function, then your app 
> will fail to load at all.
> 
> > If I leave the libmysql.dll in, the program starts with no Kernel32
> > related message, then seems to perform something and only then I see
> > the Kernel32 missing dependency message.
> 
> That does not make sense.  The dependancy message only appears when an EXE 
> is first loaded into memory before it starts running.  If your app loads 
> fine, and then fails only when the DLL is accessed at a later time, then 
> the DLL must be getting loaded dynamically instead of statically and the 
> OS is displaying the message when the DLL is loaded into memory, but it should 
> not be doing that.  Unless the DLL is being loaded by another process that 
> your EXE is spawning (directly or indirectly).
> 
> If your EXE is able to load and run before the failure occurs, then try is 
> calling SetErrorMode(SEM_FAILCRITICALERRORS) before the DLL is loaded.  That 
> should hopefully disable the popup message, and just make the DLL fail to 
> load with an error code that the calling code can then handle as needed. 
>  Then find (or recompile) a version of libmysql.dll that does not use unsupported 
> APIs on older OS versions.
> 
> --
> Remy Lebeau (TeamB)

Hello,

first of all, thank you for taking your time and replying me!

By reading your reply, I think I have not described the situation well enough.

I have searched the  [official Embarcadero Delphi XE5 FAQ|http://www.embarcadero.com/es/products/delphi/frequently-asked-questions] and it states Windows XP is supported as deployment platform. It's very important it does, because otherwise we'd have wasted a lot of money on upgrading to RAD Studio XE5 Ultimate - we'd have to return back to Delphi 2010 if it was not compatible. But the FAQ says it does. Hopefully somebody at Embarcadero has checked the FAQ statement is saying the truth.


Another point: the application uses ZeosLib for database connectivity (I know Delphi XE5 comes with all sorts of nice solutions but the application is not trivial to refactor to use them. So we have to deal with that library.
Zeos has a drivers driven architecture so it loads any of its supported data sources (including MySQL through libmysql.dll) "just in time", that is well past the application has started.
This is why it's possible to see the application starting and only then, getting the unresolved dependencies.

Midas gets loaded even later.

My biggest doubt is whether it's the libmysql.dll or MIDAS.

Libmysql.dll:

- seems to load before the application shows the message.
- has been installed with an Oracle installer that determines which operating system it's going to install stuff for. It'd seem odd it'd install an incompatible version. Had it been some freeware stuff, ok. But for Oracle to fail installing their connectivity software on a most common platform... that sounds very odd.

- Midas instead, the Delphi 2010 DLL works like a charm, the XE5 one has given me many an headache. Crashes, access violations etc. etc. until I "merged" it in the application by adding the Midaslib in the Uses clause. Could it be the determining factor that makes the application not compatible?

I thank you for the "SetErrorMode(SEM_FAILCRITICALERRORS)" tip, I'll see what I can do with it the next time I recompile the software.

But I ask you, do you know any way to understand what piece of the application triggers the error? I mean, I'd like to find out the offending calling function and I think all I'll get by using the debugger is some unuseful assembly code address.
0
Dario
2/19/2014 9:00:38 PM
Dario wrote:

> My biggest doubt is whether it's the libmysql.dll or MIDAS.

Seems pretty easy to test.  Load libmysql.dll.  Does it load on XP?  Load 
MIDAS on XP.  Does it load?

> Libmysql.dll:
> 
> - seems to load before the application shows the message.

OK then.  Most likely not the culprit.

> - Midas instead, the Delphi 2010 DLL works like a charm, the XE5 one
> has given me many an headache. Crashes, access violations etc. etc.
> until I "merged" it in the application by adding the Midaslib in the
> Uses clause. Could it be the determining factor that makes the
> application not compatible?

I cannot answer that.  I do not know anything about MIDAS.  But I would expect 
that if it has a static dependancy on InitializeConditionVariable, and then 
you compile MIDAS statically into your app, then your app would fail to load 
at all on XP.

> But I ask you, do you know any way to understand what piece of
> the application triggers the error? I mean, I'd like to find out the
> offending calling function and I think all I'll get by using the
> debugger is some unuseful assembly code address.

You would have to use Dependancy Walker, or similar tool, on every EXE/DLL 
your app uses, whether loaded statically or dynamically, and find out which 
one is linking to InitializeConditionVariable().  Or maybe use SysInternals 
File Monitor to watch file accesses in real time and see which DLL was last 
accessed when the error occurs.  But either way, that is not going to tell 
you which function of which DLL is calling InitializeConditionVariable(), 
though.  In fact, it is possible that the offending module may be linking 
to InitializeConditionVariable() without actually calling it at all.  Just 
the mere presence of the function in the module's IMPORTS table is enough 
to trigger the error.

--
Remy Lebeau (TeamB)
0
Remy
2/19/2014 10:48:44 PM
> {quote:title=Dario Fumagalli wrote:}{quote}
> Hello,
> 
> we have developed a 32 bit application that must run under Windows XP (thousands of independent customers worldwide).
> 
> It works perfectly if compliled with Delphi 2010 Professional.
> Recompiling it with Delphi XE5 (target platform Win 32) it starts but after some instants it shows a message like this:
> 
> The procedure entry point InitializeConditionVariable could not located in the dynamic library Kernel32.dll.
> 
> Of course this is due to such procedure only being available with Windows Vista and later.
> Running a "dependency walk" software on the executable, we indeed see the dependency is there.
> 
> My question is: how do we find which application component depends on that call?
> 


I have found a solution to this issue.
It's not exactly a reply to my question: "how do we find which application component depends on that call?" but it solved the originating problem.

The culprit was the libmysql.dll indeed.

As also documented by me on the [official MySQL forums|http://forums.mysql.com/read.php?168,607366,607366#msg-607366], I have laboriously found an old DLL version (5.5) and found out that the application works perfectly well with it, even on Windows XP.

Lesson learned: even Oracle makes mistakes, apparently they did not check that *multithreaded* database applications would still work on Windows XP so their own installer puts such potentially incompatible DLL in Windows XP anyway.
0
Dario
2/20/2014 10:24:06 AM
Reply:

Similar Artilces:

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi XE5 application, missing icons in XP and Windows 2003
Hi, Does anyone know why a XE5 build application is missing its application icon in Windows XP and Windows 2003 (it's missing in explorer/windows desktop) ? The icon displays fine in Windows 7,8,8.1 and 2008 Best regards Roy Roy wrote: > Does anyone know why a XE5 build application is missing its application > icon in Windows XP and Windows 2003 (it's missing in explorer/windows > desktop) ? > > The icon displays fine in Windows 7,8,8.1 and 2008 Either the icon resource is missing or misnamed, or it does not provide icon sizes that those older OS...

Delphi 2010 + Windows XP + show unicode characters... fail :) [Edit]
Hi, I first had a fully patched Windows XP all optional updates downloaded as well. It was able to show Hebrew, French etc. but not e.g. Chinese characters using MS Shell Dlg 2 (Tahoma I believe) I then tried to install Windows Live Essentials which includes Segoe UI font. I then set my application forms to use that. It now can also show Arabic (perhaps it also could before, I am not sure) but still not e.g. Chinese characters. Using Windows 7, everything shows correctly. But how do I get it working in Windows XP. I had expected that a Windows XP with all updates installed would ...

Delphi XE6 - Deployment of a FMX application for Windows
Hello, can somebody please tell me the exact specifications/requirements for deploying a FMX application for Windows 7/8.1? I noticed that some of my prototype applications are behaving very odd when I execute them on a different machine other than my development computer. Mainly the main problem seems to be that the onpaint event for my components aren't triggered correctly. On my development computer (windows 8.1) everything is fine on all five others (windows 8.1) I tried not. Is there a specific open gl library or other runtime I have to deploy? Thanks See attachments her...

Delphi 2010 + Windows XP + show unicode characters... fail :) [Edit] #2
Hi, I first had a fully patched Windows XP all optional updates downloaded as well. It was able to show Hebrew, French etc. but not e.g. Chinese characters using MS Shell Dlg 2 (Tahoma I believe) I then tried to install Windows Live Essentials which includes Segoe UI font. I then set my application forms to use that. It now can also show Arabic (perhaps it also could before, I am not sure) but still not e.g. Chinese characters. Using Windows 7, everything shows correctly. But how do I get it working in Windows XP. I had expected that a Windows XP with all updates installed would ...

Install Delphi 2010 Ent in Windows XP or Windows 7
What operating system would you recommend installing and using Delphi 2010 Enterprise in? Windows XP or Windows 7 32 bit or 64 bit. And why? Thanks Greg Saunders wrote: > What operating system would you recommend installing and using Delphi > 2010 Enterprise in? > > Windows XP or Windows 7 Windows 7. > > 32 bit or 64 bit. 32 bit. > > And why? Windows 7 is a lot supperior and more stable than windows XP, also it recognizes more than 3 GB of RAM. Delphi 2010 supports Windows 7 Libraries, you can take advantage of this in yo...

start with delphi 2010 [Edit]
hi sorry for this simple question in new project , which one i should choose for a windows application like accounting system or other programs ? i can see some application in the new project : console control panel dynamic link library mdi package resource dll wizard sdi service vcl forms i think i must select vcl forms . please help . thanks Edited by: arash moh on Jul 7, 2011 4:03 PM > vcl forms and you might select the ... .language.delphi.general newsgroup for asking quesitons like this. Ed Dressel "arash moh" wrote in message news:375891...

Delphi 2010 and Delphi XE5 shuts down when opening projects
Over the last week I have found it increasingly difficult to open projects. Even really simple projects, some more complex. For example if start Delphi 2010 Enterprise Edition. I see the list of recently opened projects. I then click on a simple existing project, I get a hour glass for about a second and then Delphi IDE has gone. In the windows task manager, there are now no applications running. I have not changed the installation, being using Delphi 2010 enterprise on the same computer for a few years. I'm not a full time developer, but do internal development of our compa...

Delphi 2010 and Delphi XE5 shuts down when opening projects
Over the last week I have found it increasingly difficult to open projects. Even really simple projects, some more complex. For example if start Delphi 2010 Enterprise Edition. I see the list of recently opened projects. I then click on a simple existing project, I get a hour glass for about a second and then Delphi IDE has gone. In the windows task manager, there are now no applications running. I have not changed the installation, being using Delphi 2010 enterprise on the same computer for a few years. I'm not a full time developer, but do internal development of our compa...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Update Delphi 2005 to Delphi 2010, which do i need? [Edit]
Hello, we have one Delphi 2005 Professional here and want to upgrade to Delphi 2010, but we are a bit confused. Our distributor in Germany, ingram-micro offers several upgrade products: UPG DELPHI 2010 PRO - NAMED USER UPG DELPHI 2010 PRO - NAMED USER ELS UPG DELPHI 2010 PRO - NAMED USER FLEX RAD STUDIO 2010 PRO - UPG UPG RAD STUDIO 2010 PRO - NAMED ELC UPG RAD STUDIO 2010 PRO - NAMED FLEX UPG DELPHI 2010 PRO - CONCURRENT ELS UPG DELPHI 2010 PRO - CONCURRENT FLEX What do they mean exactly and which one do i need? At the moment delphi is installed on two PCs and we want to use ...

Delphi 7 won't start up anymore on Windows 7 (except in Windows safe mode) [Edit]
I'm using Delphi 7 PE under Windows 7 Home Edition. Since four days Delphi will not start anymore. When I start, I see an entry "delph32.exe" in the Windows Task Manager (process tab, not application tab) but this will disappear sillently after some seconds. No error or warning message is given. I tried several things already, after searching the internet for a solution: - start delphi in comptability mode - start delphi as administrator - give full right on the installation directory of delphi - disable UAC - restore windows to the previous restore point None of ...

Delphi 2010 produces much larger binaries than Delphi 2009 [Edit]
When I compile my project with Delphi 2010 the resulting executable is about 30% larger than the one compiled with Delphi 2009. Both binaries are compiled with the same source code and project options. The size of individual DCU files increases by 5-20%. Has anybody experienced similar results? Has anybody an idea what could cause this? It surprises me, as the changes in syntax and VCL have not been that big. Best regards, Joachim Edited by: Joachim Marder on Sep 25, 2009 6:07 AM "Joachim Marder" wrote in message news:166152@forums.codegear.com... > When I compi...

The ASP.net 2.0 web application made by Chinese Windows XP + English Microsoft Visual Web Developer 2005 Express Edition can't run under English edition windows XP ?
ASP.net 2.0 web application made by Chinese Windows XP + English Microsoft Visual Web Developer 2005 Express Edition can't run under English edition windows XP ? I made a ASP.net 2.0 web application under Chinese edition Windows XP + English edition Microsoft Visual Web Developer 2005 Express Edition You can download it at http://www.hothelpdesk.com/Online/Download/HotHelpDeskV1.00Build7.zip A guest me that he met the following error Attempt to access the method failed An unhandled exception was generated during the execution of the current web request. Information regarding the ori...

Web resources about - Delphi 2010 application starts in Windows XP. Not if recompiled with XE5 [Edit] - embarcadero.delphi.deployment

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Second visa application 'likely' to be approved
The family of a terminally ill Pakistani student can 'hopefully come to Australia sooner rather than later' says Immigration Minister Peter Dutton. ...

Tashfeen Malik's visa application under scrutiny - Business Insider Deutschland
The US government has released the visa application for Tashfeen Malik, who along with her husband killed 14 people in an attack in San Bernardino, ...

Panasonic Develops a Stretchable Resin Film and Its Application Materials for Stretchable Electronics ...
A stretchable film is developed. This film stretches to 2.5 times the original length and then returns to the original form. A conductive paste ...

MBA: Mortgage Applications Decreased Over Two Week Period in Latest MBA Weekly Survey, Purchase Applications ...
From the MBA: Mortgage Applications Decreased Over Two Week Period in Latest MBA Weekly Survey Mortgage applications decreased 27 percent from ...

Lawmaker: Immigration Officials Didn’t Fully Vet Tashfeen Malik’s Visa Application
"It’s unacceptable that U.S. Citizenship and Immigration Services did not fully vet Malik’s application and instead sloppily approved her visa," ...

German-Based Spirea Promotes Decentralized PV Applications In Uruguay
... Its technical operations specialist, Laurie Lawrence, pointed out that Uruguay [&hellip German-Based Spirea Promotes Decentralized PV Applications ...

Mortgage applications sink after rush
A Fed rate hike pulled mortgage demand forward, and made for a steep drop-off in the past two weeks.

Visa application of San Bernardino shooter released
CNN Visa application of San Bernardino shooter released CNN (CNN) The visa application of one of the San Bernardino shooters was released ...

In Application To Move To Los Angeles, Rams Shit All Over City Of St. Louis
... to relocate to the greater Los Angeles metropolitan area. The relocation would be effective for the 2016 NFL League Year.” The Rams’ full application ...

Resources last updated: 1/6/2016 9:14:27 PM