AGB  ·  Datenschutz  ·  Impressum  







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

Packages in anderem Verzeichnis

Ein Thema von hschmid67 · begonnen am 22. Sep 2024 · letzter Beitrag vom 24. Sep 2024
 
Kas Ob.
Online

Registriert seit: 3. Sep 2023
435 Beiträge
 
#2

AW: Packages in anderem Verzeichnis

  Alt 22. Sep 2024, 09:26
Hi, very interesting problem !

I spent almost two hours testing different approaches and ...

Delphi-Quellcode:
 begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TformMain, formMain);
  Application.Run;
end.
hier irgendwo?
Alas, this is not possible !
One approach i tested is to add a DLL that will change set the PATH variable with SetEnvironmentVariable, the DLL worked fine right after loading by the OS, but ... it seems the OS loads few DLLs in bulk then after that start to call them, if it hit missed one it will stop and unload the loaded ones, so that DLL was loaded but no called, i mean DllMain not called.
Also patched the binary to make sure it is the first to be in the Import Table, and yes the OS tried and loaded it first but didn't call DllMain, even it loaded few more DLL, non being executed, so this was not a solution.

Zitat:
Oder in das initialization einer eigenen unit, die ich dann als erstes einbinde?
Same as above, this will not help at all, as Runtime packages imported by the Import Table as declared in the PE header, meaning, nothing will execute from the EXE Project, before all the imported libraries loaded (attached) and then all the thunk table resolved.

There is few ways to do this, but all are ugly !!
1) Use batch file to execute your EXE, with :
Zitat:
set PATH=YOUR_PACKAGE_PATH;%PATH%
//like
set PATH=D:\Program Files (x86)\Embarcadero\Studio\16.0\bin;%PATH%
2) Add another small, minimum (bare exe) to load your application but before calling CreateProcess do the same with PATH variable in the environment, in this case use SetEnvironmentVariable
https://learn.microsoft.com/en-us/wi...onmentvariable
Also here i am not sure if the the same PATH value will work, i mean passing this "YOUR_PACKAGE_PATH;%PATH%" to SetEnvironmentVariable, so to be on the safe side i would read PATH value first with GetEnvironmentVariable, then append the path then call SetEnvironmentVariable, this before CreateProcess (or any other executing calls that works)
3) Move your EXE to the same package directory, and leave a shortcut !!

Hope that helps, or may be someone else might have ideas to entertain.
Kas
  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 08:50 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