Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
355 Beiträge
 
#24

AW: Nach Update auf Delphi12 startet compiliertes Prog nicht mehr. Fehler bei LoadRes

  Alt 21. Jun 2024, 08:37
This line is cause :
https://github.com/zijianhuang/Commo...text.pas#L2454
Code:
  // replace Borlands LoadResString with gettext enabled version:
  HookLoadResString:=THook.Create (@system.LoadResString, @LoadResStringA);

The implementation of both LoadResStringA and LoadResStringW are not compatible system.LoadResString.
https://github.com/zijianhuang/Commo...s#L63C1-L67C66
Code:
// Unicode-enabled way to get resourcestrings, automatically translated
// Use like this: ws:=LoadResStringW(@NameOfResourceString);
function LoadResString(ResStringRec: PResStringRec): widestring;
function LoadResStringA(ResStringRec: PResStringRec): ansistring;
function LoadResStringW(ResStringRec: PResStringRec): widestring;
This override casting by hooking between string and widestring cause Delphi memory manager to corrupt memory at arbitrary places and luckily for you it happens at the stack at this stage !

Though this behavior might be easier to be found by using resource leak finder like Nexus Quality Suite Code Watch https://www.nexusdb.com/support/index.php?q=node/27156
Or may be even any memory corruption tracker could find it earlier, like FastMM in full debug, MadShi, EurekaLog, or Code Watch.

Why Code Watch ? because it is sensitive for hooking as it does use them, so confliction or hidden hooks could be found easier.
Kas
  Mit Zitat antworten Zitat