Archive: Where does $WINDIR come from?


Where does $WINDIR come from?
I have an installer that works perfectly well everywhere...but craps out on a W2K Server...$WINDIR seems to be pointing somewhere to C:\Documents And Settings\... instead of C:\WINDOWS.

Anyone know how NSIS finds out the $WINDIR location? is it from the registry?


Hi!

Your servers seems to be a Windows Terminal-Server in application-mode.

Try to execute the following command:

change user /install

and then start your installer again. You'll see, that $WINDIR contains the correct path.

After the installation:
change user /execute


This behaviour is normal. Probably you find more information here:
http://www.microsoft.com/resources/d...hangeuser.mspx

-Bruno.

Yes, correct...we were installing while connected to a server via Remote Desktop...I can't really see how this could be deemed normal behavior...$WINDIR pointing to what is definitely the wrong directory. Isn't this something NSIS could handle transparently? Thanks


There's nothing to handle, that's how it's supposed to work according to Microsoft. If you want to get the system Windows directory, you can call GetSystemWindowsDirectory using the System plug-in.


This behaviour is by design (or grown by history...). Let's try to explain:

Windows was a single user system.
Every program had it's INI-files in the windows-directory.
One day, there was the need to build a multi-user system.

Now there was a problem: Because multiple users are working on the same system, every user would mess up other users INI-files. The solution: Programs, that write to INI-Files are redirected to another user specific folder.

To install new applications you have to execute "change user /install" to set Windows in install mode.

That's the secret explained in a few simple words.


you can call GetSystemWindowsDirectory using the System plug-in.
Can you tell me the correct line?

System::Call "Kernel32.dll:GetSystemWindowsDirectory..." ???

System::Call "kernel32::GetSystemWindowsDirectory(t .r0, i ${NSIS_MAX_STRLEN})"
This API is only available on Windows 2000 and later, so make sure it returns a valid value.