|
-
May 14th, 2013, 06:17 AM
#1
Thread Starter
Frenzied Member
Environment Variable X86 x X64
Hi
My application it's targeting x86, the machine it's a x64. I need the common program files path for the current machine.
But after expanding the commonprogramfiles var or commonprogramfiles(x86), or by using the special folder enum, in both situations it returns the x86 path...
Code:
?Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles)
"C:\Program Files (x86)\Common Files"
?Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86)
"C:\Program Files (x86)\Common Files"
?Environment.ExpandEnvironmentVariables("%commonprogramfiles%")
"C:\Program Files (x86)\Common Files"
?Environment.ExpandEnvironmentVariables("%commonprogramfiles(x86)%")
"C:\Program Files (x86)\Common Files"
Why i cant get the "C:\Program Files\Common Files" ?!?!
It's because of the target CPU?!
Thanks
Rate People That Helped You
Mark Thread Resolved When Resolved
-
May 14th, 2013, 11:34 AM
#2
Re: Environment Variable X86 x X64
It's because of the target CPU?!
Well yes. Obviously. Your application is compiled to run entirely in the x86 environment so its special folders sites will all be x86 also. Why would you need to access 64-bit files from a 32 bit application anyway?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 15th, 2013, 03:33 AM
#3
Thread Starter
Frenzied Member
Re: Environment Variable X86 x X64
This application it's targeting the x86 to solve some issues with some componentes in x64 machines.
But now i need to use the TabTip, and in the 64bits machines it's in the Common Program Files...
How should i get the x64 common program files directory?
Rate People That Helped You
Mark Thread Resolved When Resolved
-
May 15th, 2013, 12:23 PM
#4
Re: Environment Variable X86 x X64
If TabTip is x64 then...referencing with 32 bit would cause a crash! I'm not sure what on earth you're trying to do, but .NET is probably trying to prevent you from shooting yourself in the foot!
-
May 15th, 2013, 07:35 PM
#5
Thread Starter
Frenzied Member
Re: Environment Variable X86 x X64
The TabTip has two versions, 32 bit version located at common program files x86, and the 64 bits version located at common program files. I don't know if it's the same file, i just know that they are in separeted dirs.
Now i need to call the tabTip keyboard, that in a windows 7 x64 it's localted in common program files, but trying to get this directory with the ambient variable, it's impossible because it returns me the common program files (x86).
Rate People That Helped You
Mark Thread Resolved When Resolved
-
May 15th, 2013, 07:57 PM
#6
Re: Environment Variable X86 x X64
Why do you need to look for it at all? TabTip is an auto start service so it should be in running processes. Not that I know how you'd interact with it but you certainly shouldn't need to be starting it from the .exe which is what I presume you're attempting?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 16th, 2013, 02:14 AM
#7
Re: Environment Variable X86 x X64
This is not really a .Net issue, this is how Windows works. A 32-bit application can not reach the 64-bit environment (not even within the file system). If you try to access Windows\System32 you will actually look into the folder Windows\SysWow64 and even if you hard coded the path to the Program Files folder you would still end up in the Program Files (x86) folder. This is how the Windows On Windows sub system works. So you can't reach the folder simply because from the perspective of the running process it just doesn't exist.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|