Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Run App as if there is no IDE installed!!


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: May 2, 2017 8:58 AM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Run App as if there is no IDE installed!!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 2, 2017 3:57 AM
Hi,

I am trying to fake running an app as if the IDE is not
installed. You know to make the program raise that error
about it can't find a certain BPL rtl or vcl.

Anyway I tried using this before Application Initialize

SetEnvironmentVariableW(L"PATH", L"C:\\mypath");
SetDllDirectory(L"C:\\mypath");


But the app still runs fine.

Any help will be appreciated.

--
The limits of my language mean the limits of my world
Jan Dijkstra

Posts: 206
Registered: 11/4/99
Re: Run App as if there is no IDE installed!!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 2, 2017 4:07 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed Sayed wrote:
Hi,

I am trying to fake running an app as if the IDE is not
installed. You know to make the program raise that error
about it can't find a certain BPL rtl or vcl.

Anyway I tried using this before Application Initialize

SetEnvironmentVariableW(L"PATH", L"C:\\mypath");
SetDllDirectory(L"C:\\mypath");


But the app still runs fine.

Any help will be appreciated.

--
The limits of my language mean the limits of my world

The Windows Session manager (the part that is responsible for starting an app, any app) always searches certain folders for DLL files. This includes the folder the app is located in, some system folders, and all folders in the PATH environment variable, of the process that is actually spawning your app. Setting environment variables from within your app won't change that, as that code is only evaluated AFTER the app is already running, and all DLL's have already been loaded.

The only DLL's that would be subject to your path/environment variable changes are delayed load DLL's, as they are only loaded when you actually call a function in them.

If you want to test starting your app, do so from a CMD console window. In that console windows, you can set the current directory to whatever you want, and can set the PATH environment variable to whatever you want. And then type the name of your app to see if it wants to start.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Run App as if there is no IDE installed!! [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 2, 2017 8:58 AM   in response to: Jan Dijkstra in response to: Jan Dijkstra
Jan wrote:

If you want to test starting your app, do so from a CMD console
window. In that console windows, you can set the current directory
to whatever you want, and can set the PATH environment variable
to whatever you want. And then type the name of your app to see
if it wants to start.

But like you said, there are certain folders that the OS Loader looks at
regardless of what the CWD and PATH are set to. So it could still find the
BPLs, depending on where they are located and how they are installed.

The best way to test this is to use another machine, or a VM, that does not
have the relevant BPLs installed to begin with.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02