How to get the Windows Directory (C:\\Windows)

Got a problem you cannot solve? Try here.
Post Reply
zims
Posts: 39
Joined: Mon Nov 24, 2008 11:41 am

How to get the Windows Directory (C:\\Windows)

Post by zims »

I have been using the function Get Folder Location and System->Windows Directory successfuly until I tried on a Windows 2008 x64.

On my Windows Vista (x64) Get Folder Location and System->Winows Directory returns C:\\Windows, but on my Windows 2008 (x64) it returns C:\\Users\\Administrator\\WINDOWS.

Is this a bug or am I supposed to get the WIndows folder location in some other way?.

I need the WIndows folder location to call RegAsm.exe with /CodeBase flag since that is not possible for the RegisterAssambly command.

PS. Please, add a property to make it possible to use /CodeBase from RegisterAssambly.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

You may want to set the x64 mode before calling Get Folder Location using the Set 64 Bit Mode command. Otherwise, you won't be able to access real 64 bit folders as they will be re-directed by Windows redirection.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
zims
Posts: 39
Joined: Mon Nov 24, 2008 11:41 am

Post by zims »

Setting it to 64-bit mode don't help. On Windows 2008 (x64) I get still C:\\Users\\AllMighty\\WINDOWS\\ as Windows directory.

I have not tried a 32-bit Windows 2008 (don't have one to test on). But on my Windows Vista (64-bit) it works so I don't think the problem has to do with 32/64-bit.

I found another way to get the Windows Directory, I used Get Enviroment and %WINDIR% and that works fine. But it is still strange that Get Local Folder don't work.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

This seems like a bug report. I'll try to reproduce in-house and escalate to R&D. Thanks for reporting.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Here is the script I tried:

Code: Select all

Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
Get Common Folder Location System->Windows Directory into WINDIRX86
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Get Common Folder Location System->Windows Directory into WINDIRX64
MessageBox: WINDIR, $WINDIRX86$$NEWLINE$$WINDIRX64$
Here was the output:
---------------------------
WINDIR
---------------------------
C:\\Windows
C:\\Windows
---------------------------
OK
---------------------------
OS: Windows Server 2008 x64 (Service Pack 1)
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
zims
Posts: 39
Joined: Mon Nov 24, 2008 11:41 am

Post by zims »

I made a test project just like yours

Code: Select all

~InstallAware Clipboard Data~
~MessageBox~
~{5D3551B2-4E16-4E70-9803-AE4B5FAD943E}~
~WINDIR~
~$WINDIRX86$$NEWLINE$$WINDIRX64$~
~0~
~1~
~~
~Get Folder Location~
~{6F1A48C3-D978-4D1B-803C-1CCE2FE02C5D}~
~WINDIRX64~
~25~
~TRUE~
~Set 64 Bit Mode~
~{EE45AEA6-9C44-4E52-B9F8-A22F2CA45F4D}~
~FALSE~
~FALSE~
~TRUE~
~Get Folder Location~
~{94DA5BB6-F815-43AB-939A-CB7833B98759}~
~WINDIRX86~
~25~
~TRUE~
~Set 64 Bit Mode~
~{501E707B-279E-4582-8CBB-64D86EF3B6CA}~
~TRUE~
~FALSE~
~FALSE~
and I got the following result on my Vista (x64)

Code: Select all

C:\\Windows\C:\\Windows\\
but on my Windows 2008 (x64) i got the following

Code: Select all

C:\\Windows\\Administrator\\WINDOWS\C:\\Windows\\Administrator\\WINDOWS\\
I am using Virtual Server for my Virtual Machines,so I can't have 64-bit Virtual Machine. This Server 2008 is on one of our "real" server so I can't give your more information. Sorry I can't give you more information. Anyway this is not a big problem for me right now since I will use the Enviromet Variable.

Thanks for you quick response.

Zims
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

That's very strange, I wonder if somewhere in the registry is corrupt causing the API that we are calling to return an errant folder?

At any rate I am glad you have found a viable workaround.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply