AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

GetModuleName wirft Exception

Ein Thema von Jelen · begonnen am 12. Jul 2012 · letzter Beitrag vom 12. Jul 2012
 
Jelen

Registriert seit: 5. Nov 2003
45 Beiträge
 
#1

GetModuleName wirft Exception

  Alt 12. Jul 2012, 15:22
Hallo,
hat jemand schon mal versucht, GetModuleName mit einem Handle für die 'TMSSmoothControlsPackPkgD2009.bpl' aufzurufen?
Folgender Code läuft bei mir auf eine Exception, die ich mir nicht erklären kann:
Delphi-Quellcode:
procedure BplInfo (ts: TStrings);
 {+++++++ BplInfo ++++++++++++++++++++++++++++++}
 function BplPath (const BplName: String): AnsiString;
  var MHnd: Cardinal;
      j,k: integer;
      ModuleBuffer: array [0..63] of AnsiChar;
      PathBuffer: array [0..255] of Char;
  begin
   StrPCopy(@ModuleBuffer,BplName);
   MHnd := GetModuleHandle(@ModuleBuffer);
   if MHnd = 0
   then Result := 'nicht geladen'
   else begin
         Result := GetModuleName(MHnd);
        end;
   Result := BplName+': "'+Result+'"';
  end;
 {+++++++ BplInfo ++++++++++++++++++++++++++++++}
 begin
  try
   ts.Append(BplPath('bdertl120.bpl'));
   ts.Append(BplPath('dbrtl120.bpl'));
   ts.Append(BplPath('designide120.bpl'));
   ts.Append(BplPath('rtl120.bpl'));
   ts.Append(BplPath('tee8120.bpl'));
   ts.Append(BplPath('TMSSmoothControlsPackPkgD2009.bpl'));
   ts.Append(BplPath('vcl120.bpl'));
   ts.Append(BplPath('vclactnband120.bpl'));
   ts.Append(BplPath('vcldb120.bpl'));
   ts.Append(BplPath('vclimg120.bpl'));
   ts.Append(BplPath('vclsmp120.bpl'));
   ts.Append(BplPath('vclx120.bpl'));
   ts.Append(BplPath('VirtualTreesD12.bpl'));
   ts.Append(BplPath('xmlrtl120.bpl'));
  except on e: Exception
  do ts.Append('BplInfo: "'+e.Message+'"');
  end;
 end;
Das Ergebnis sieht dann so aus:
bdertl120.bpl: "C:\Windows\system32\bdertl120.bpl"
dbrtl120.bpl: "C:\Windows\system32\dbrtl120.bpl"
designide120.bpl: "C:\Program Files (x86)\CodeGear\RAD Studio\6.0\bin\designide120.bpl"
rtl120.bpl: "C:\Windows\system32\rtl120.bpl"
tee8120.bpl: "C:\Windows\system32\Tee8120.bpl"
BplInfo: "Zugriffsverletzung bei Adresse 003C4761 in Modul 'test.bpl'. Lesen von Adresse 00000038"
Die ersten 5 Aufrufe gehen also sauber durch, und dann kommt die TMS...bpl dran und es kracht.
Mit GetModuleFileName hab' ich es auch probiert, dasselbe Problem.

Hat jemand 'ne Idee?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz