Tuesday, 5 April 2011

Assertion failure ..\win32src\thread32.cpp at line 434

For the ones who are using Delphi 2009 under Windows 7 (64-bits), this error will show up during the debugging of your applications. This just happened to me today and I found a really interesting solution on Embarcadero's Forums. This just happened to me few days ago and I thought it was normal because of the OS, but then I realised that something was going wrong and every minute I got that annoying message leaving my applications non-functional and with the problem of restarting the Delphi IDE again.The solution provided is quite easy and I can guarantee you that it works!.
First of all, you need an hexadecimal editor. I used mh-nexus, an open source version that you can get from here. Then the steps for solving the issue are the following ones:

1. Close Delphi
2. Locate bordbk120N.dll (C:\Program Files (x86)\CodeGear\RAD Studio\6.0\bin)
3. Make a backup of the library (just in case).
4. Open bordbk120N.dll with mh-nexus and locate the hex values: “01 00 48 74 47 80 3D

5. Replace “74” with  “EB”and save the changes.

6. Restart Delphi and the error message should be gone.


Related links:

13 comments:

  1. Thanks, I still working with 32-bit, but this solution is a thing to have present, especially because the new computers going with W7.

    ReplyDelete
  2. How on earth did you figure that out? To go change one byte in a single DLL?

    ReplyDelete
  3. Hi,
    That was done by researching on the crashing exception. Then I found a post that more o less was talking about this and I´ve just added more information about it.

    I hope it helps.

    Regards,
    Jordi

    ReplyDelete
  4. Perfect, thanks. It worked great under Windows 7 x64. Boy, was this an annoying problem!

    ReplyDelete
  5. Hi

    the patch is not working for me, so please, if anyone knows the string I have to change in the file : bordbk105N.dll

    I appreciate a lot your help.

    Best regards

    Fernando

    ReplyDelete
  6. Hi Fernando,

    This patch only works for Delphi 2009, and the file that you need to edit is bordbk120N.dll. I think that the file you are referring bordbk150N.dll is from Delphi XE version.

    Regards,
    Jordi

    ReplyDelete
  7. Try to use the patcher from the following link and see if it works: Delphi_2007_2009_WOW64_Debugger_Fix.zip

    ReplyDelete
  8. Hello Jordi

    I have solved the problem. I had used the patch before but not as admin. Some minutes ago I tried this option and my file has been patched succesfuly. Now my delphi 2007 is working fine.

    Best regards!!

    Fernando

    ReplyDelete
  9. Was getting this same debugger error and stumbled across this thread. Using Delphi 2007 on Win 7 - 64 bit, worked like a charm. Thank you.
    Keith

    ReplyDelete
  10. What this replacement means? what was wrong and we try to correct it?

    ReplyDelete
    Replies
    1. Hi I don't really know the exact details but it seems that it was just a bug.

      Delete
  11. I disassembled the code in question. What this patch does is effectively remove a conditional branch.

    The code is not checking the return value of the Windows function SetThreadContext correctly. According to MSDN, SetThreadContext returns a zero or non-zero value, but the code checks to see if it equals 1. This may not be the source of the problem, though.

    // before patch
    if (SetThreadContext(hThread, &Context) == 1)
    {
    DWORD err = GetLastError();
    // ...
    }

    // after patch
    SetThreadContext(hThread, &Context);

    Documentation on SetThreadContext
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms680632(v=vs.85).aspx

    ReplyDelete
    Replies
    1. Hi Mike,

      Yes, it makes sense. Thanks for your input on this.

      Jordi

      Delete