0

I am convert component from delphi 5 to delphi xe5`. I build it completely but still while installation following error come

The procedure entry point SymGetSymFromAddrW could not be located in the dynamic link library IMAGEHLP.DLL

Ken White
  • 123,280
  • 14
  • 225
  • 444
Abhishek Mestri
  • 93
  • 1
  • 1
  • 7

1 Answers1

1

SymGetSymFromAddrW has been superceded by SymGetSymFromAddr64 on modern Windows versions. You need to use it instead. It has a very similar definition as SymGetSymFromAddr - just redefine it yourself, and use your version instead:

function SymGetSymFromAddr64(hProcess: THandle; dwAddr: DWord64;
  pdwDisplacement: PDWord64; var Symbol: TImagehlpSymbol): Bool; stdcall;

function SymGetSymFromAddr64;    external ImagehlpLib name 'SymGetSymFromAddr64W';

See the documentation for SymGetSymFromAddr64 for more info.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • in this case i have to change in winapi.imagehlp pas file, which is part of Delphi IDE. or customerize it and use it. lets see – Abhishek Mestri Jul 16 '14 at 14:17
  • No you don't. Just put it in your own code unit where you're using it, and access it instead of the current call to `SymGetSymFromAddr`. – Ken White Jul 16 '14 at 14:19
  • Hi, I used one logic but not nice practice. instead of reference imagehlp from delphi xe5 as winapi.imagehlp i used old one from delphi 5 imageehlp and that component get installed. but still its question why we have to do this Delphi xe5 defined imagehlp file. it should done automatically. incase of communication with window dll. any suggestion welcome. abhishek mestri – Abhishek Mestri Jul 16 '14 at 14:26
  • Windows (Microsoft) changed ImageHlp, as the documentation I linked explains. Talk to Microsoft. :-) The Windows API is far too large to expect Delphi to have wrappers for everything, or to be able to keep up with every single change. If you need the function, and it's not declared correctly, re-declare it and move on. It's also a bad idea to use the version from Delphi 5; use the proper one and change your code. You're not using Windows 2000 or 95 any longer. – Ken White Jul 16 '14 at 14:38
  • I will use imagehlp.pas from latest delphixe5 and made change in it. – Abhishek Mestri Jul 16 '14 at 15:07
  • 1
    No, that's the wrong solution. See my first comment (about putting it in your own unit). You should *never* change the source that ships with Delphi; doing so means that updates won't apply correctly, because the files won't match. If you insist on changing it, make a copy, put it in your own project's folder, and change that copy. – Ken White Jul 16 '14 at 15:10
  • What is odd is that the function cannot be found. Sounds like the machine has changed as well as the delphi version. – David Heffernan Jul 16 '14 at 21:37
  • @David: I actually tested first (XE6, Win 7 64-bit) and got the same error, which is what led me to the documentation I linked. It's a Windows issue, not a Delphi issue. (The function indeed does not exist in Imagehlp.dll under the `SymGetSymFromAddrA` or `SymGetSymFromAddrW` names.) – Ken White Jul 16 '14 at 22:03
  • Imagehlp is weird though. I think there are lots of different versions. If the Delphi 5 program can find the symbol, then it must be present on the system that program runs. The docs you link to are clear enough. I just think there's more to the problem, which the asker has not clearly stated. – David Heffernan Jul 16 '14 at 22:24
  • @David: That was my first thought too, until I actually tested the code on XE6; I don't have a copy of D5 installed anywhere to test. MS says they renamed the function in the docs, though, and if the poster is moving code to XE5 it really doesn't matter; the solution is easy, and if compatibility in code needs to be maintained a simple `$IFDEF` will handle it. (The difference is a minor change in the function name and the modification of the two variable types from DWord/PDWord to DWord64 and PDWord64, both of which are present in Windows.pas under XE5. No other changes seem to be needed.) – Ken White Jul 16 '14 at 22:30
  • It's a lot more complex than you say. The docs you link to say not to use the function. Use SymFromAddr instead. Version of dbghelp is critical. – David Heffernan Jul 20 '14 at 04:27
  • And when I said imagehelp before I should have said dbghelp of course. – David Heffernan Jul 20 '14 at 06:56