Delphi-PRAXiS
Seite 2 von 3     12 3      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Windows 2022 Server, mit Delphi erstelltes exe hat Fehler (https://www.delphipraxis.net/215778-windows-2022-server-mit-delphi-erstelltes-exe-hat-fehler.html)

AndreasAutopoll 6. Sep 2024 10:18

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von Delphi.Narium (Beitrag 1540635)
nach der Fehleradresse suchen

Ich kenne die Programmzeile / stelle in der es scheppert.

Aber warum es auf dem einen PC scheppert und auf dem anderen nicht, das erschließt sich mir leider gar nicht.

freimatz 6. Sep 2024 10:18

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von AndreasAutopoll (Beitrag 1540608)
Das Ergebnis, als die exe-Datei ist auf dem Windows 2022 - Server auf dem Delphi installiert ist, lauf und Debug fähig.
Das Ergebnis in meine Programmumgebung unter Windows 10 gegben, also Tausch des Exes in einem Install geht.
Das Ergebnis in meine Programmumgebunt unter Windows 2022 gegeben, geht nicht.

Sorry, aber ich verstehe diese Sätze nicht.

Kas Ob. 6. Sep 2024 10:22

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
I think can't find component is misleading error message and simply hide the real error.

I suggest to build a new and an empty project and start to add these component (you listed in DFM) one by one, BUT do the following:
1) try add them at design time, might be caught the culprit.
2) Create them at runtime and get the real exception, the one that TReader had eat.

In case that fail too, or may be as different approach, use DDetours https://github.com/MahdiSafsafi/DDetours on that offending TReader.FindComponentClass and capture the missing/failed class to register at runtime, because this is what is happening, some class/component should have registered itself at runtime in initialize clause (in a unit) but failed and didn't register, this left the DFM reader/builder/creator in the dark.

Kas Ob. 6. Sep 2024 10:28

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
After thinking, may be the shortest way to to hook RegisterClass and log into a file, by comparing the result between 2 OSs you will find the failed one.

AndreasAutopoll 6. Sep 2024 10:34

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von Kas Ob. (Beitrag 1540639)
After thinking, may be the shortest way to to hook RegisterClass and log into a file, by comparing the result between 2 OSs you will find the failed one.

Goot idea, thanks. We will see.....

AndreasAutopoll 6. Sep 2024 10:35

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von freimatz (Beitrag 1540637)
Sorry, aber ich verstehe diese Sätze nicht.

Ein unf dasselebe exe File läuft auf zwei Rechnern, aber nicht auf einem dritten und alle sind ähnlich und für mich aucsreichend gleich installiert. Aber irgendein Detail geht schief.

jaenicke 6. Sep 2024 11:52

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Du könntest versuchen, die Komponenten auf dem Datenmodul manuell zu erstellen. Dann solltest du besser sehen, welche Komponente das Problem verursacht.

Kas Ob. 6. Sep 2024 12:17

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von jaenicke (Beitrag 1540644)
Du könntest versuchen, die Komponenten auf dem Datenmodul manuell zu erstellen. Dann solltest du besser sehen, welche Komponente das Problem verursacht.

Will not work always, or better to say, might not catch the reason, on the contrary will work fine without a problem, as you don't always need to RegisterClass to use it or create it at runtime.

What i think of is : RegisterClass being called conditionally and these condition weren't met on that OS, hence that skipped register caused the absence of the TComponent or TClass ... exception.

This could be buggy code, outdated, a fix was applied only in one place... etc.
Catching it red-handed will be clearer and simpler, or may be just search for conditionally called RegisterClass in these DB units might do.

Kas Ob. 6. Sep 2024 12:29

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
On my XE8, an empty VCL project does in fact call RegisterClass only once for TMenuItem, so OutputDebugString might be enough as the list might be short.

Here is a full hooking unit
Delphi-Quellcode:
unit lcHookRegisterClass;

interface

uses
  Classes, Windows, DDetours;

//procedure InstallHook;

type
  TRegisterClassProc = procedure(AClass: TPersistentClass);

var
  TrampolineRegisterClass: TRegisterClassProc;

implementation

procedure InterceptRegisterClass(AClass: TPersistentClass);
begin
  TrampolineRegisterClass(AClass); // call the original to register, we don't break the application

  // AClass.ClassName to log , file or OutputDebugString ...
  OutputDebugString(PChar(AClass.ClassName));       // OutputDebugString need Windows in uses clause
end;

procedure InstallHook;
begin
  // Classes.RegisterClass , we use full name and path to the proc if possible to prevent confusion as there is Windows API as RegisterClass
  if not Assigned(TrampolineRegisterClass) then
    TrampolineRegisterClass := InterceptCreate(@Classes.RegisterClass, @InterceptRegisterClass);
end;

initialization
  InstallHook;


finalization
  if Assigned(TrampolineRegisterClass) then
    InterceptRemove(@TrampolineRegisterClass);

end.
lcHookRegisterClass should be the first in in the uses clauses in the dpr file, or the second if there is Memory Manger unit is used, something like this
Delphi-Quellcode:
program Project10;

uses
  lcHookRegisterClass in 'lcHookRegisterClass.pas',
  Vcl.Forms,
  uMain in 'uMain.pas' {Form10};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm10, Form10);
  Application.Run;
end.

jaenicke 6. Sep 2024 19:44

AW: Windows 2022 Server, mit Delphi erstelltes exe hat Fehler
 
Zitat:

Zitat von Kas Ob. (Beitrag 1540645)
Will not work always, or better to say, might not catch the reason, on the contrary will work fine without a problem, as you don't always need to RegisterClass to use it or create it at runtime.

This might well be the case. But in this case the solution is very simple:
You only have to switch the components one by one or in groups from designtime to runtime. This way you can easily find the component, which is causing the error.


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:29 Uhr.
Seite 2 von 3     12 3      

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