Wednesday, May 11, 2005

Delphi 2005 running on 64-bit Windows...

Mark Russinovich, of SysInternals fame, posted this blog entry about the new Windows XP 64bit Edition.  Why do I mention it?  Well, for one thing, Mark mentions using Delphi 2005.  Unfortunately, his reference to Delphi isn't too flattering.

The Borland Delphi 2005 debugger has a more serious issue: when you launch a process under the debugger it believes that the process exits immediately when the process actually starts properly.  A workaround is to attach the debugger to the process after its launched.”

This blog post was brought to our attention, so I posted a comment asking for some clarification and some steps to reproduce this problem.  This was in addition to the internal flurry of emails and immediate investigation into the problem on one of the 64bit systems in the QA lab.  However, based on the above description, we tried to reproduce the problem and found that we could not.  Obviously, we're not trying to debug a 64bit application (Delphi isn't quite there, yet ;-).  Mark responded quickly with more information regarding what he was actually trying to do.  It turns out that he was trying to debug an MMC (Microsoft Management Console) snap-in written in Delphi.  After another internal flurry of emails and work in the QA lab by a member of the QA team, we looked and found out that mmc.exe is in fact a 64bit application.  OK... now the SysInternals guys are some smart cookies, and I could not for an instant think that Mark would make such a silly and obvious error.  It turns out that there are two versions of mmc.exe,  a 64bit version and a 32bit version.

So after I post a rather sheepish response (in which I inquire as to the “bitness” of mmc.exe... I was a little embarrased to even mention it) to Mark's explination of what he was doing, Mark responds with what is actually going on.  Yes, of course, he's launching the 32bit version of mmc.exe from the Delphi 2005 IDE.  But what happens is that the 32bit MMC then immediately turns around and launches the 64bit MMC and then exits.  Ok this makes sense.  But, he mentions that he's able to attach to the process after it is launched.  This is easily explained as well as Mark states in his response comment:

“I've investigated further and its a Windows problem, not Delphi's: when you launch the 32-bit mmc.exe it launches the 64-bit mmc.exe and exits. If you are loading a 32-bit snapin the 64-bit mmc.exe launches the 32-bit mmc.exe again and exits.”

So the mystery is solved.  And Delphi 2005 runs and debugs 32bit applications on the new Windows XP 64bit Edition.  So thanks, Mark, for bringing this to our attention and being so proactive in figuring out this odd behaviour.  And finally, it is really awesome to know that the folks at SysInternals use Delphi!

Follow up: It looks like Mark figured out the issue and how to launch the 32bit MMC.  He explained in his comment:

Ah, I figured it out: you can launch the 32-bit mmc.exe directly if you specify its path (windowssyswow64mmc.exe) and include the /64 command-line option.”



  1. To load the 32-bit MMC, you use a /64 CLI option and not a /32 option? Ok, I've heard stranger things.

  2. > 64bit application (Delphi isn't quite there, yet ;-).

    Hm, "yet" - that sounds promising! ;-P


  3. >> 64bit application (Delphi isn't quite there, yet ;-).

    >Hm, "yet" - that sounds promising! ;-P

    "quite" ! that sounds more more promising :--)

  4. I wonder if Mark wants a 64-bit Delphi native compiler...

  5. Cool! Happy to follow the entire story that ran across two different blogs.

    Delphi rocks!!!!

  6. > And finally, it is really awesome to know

    > that the folks at SysInternals use Delphi!

    Yup. And they use my MMC Snapin framework for Delphi, too :)


Please keep your comments related to the post on which you are commenting. No spam, personal attacks, or general nastiness. I will be watching and will delete comments I find irrelevant, offensive and unnecessary.