Jump to content

WPI 64bit


Recommended Posts

I have Vista64 installed now and have started to do some checks for 32 or 64 bit systems. My results are confusing me:

Architecture=x86

ARCHITEW6432=AMD64

Bits=32

ArchName=AuthenticAMD

ArchNameString=AMD Athlon 64 Processor 3200+

ArchNameIdentifier=AMD64 Family 15 Model 4 Stepping 8

ComSpec=C:\Windows\system32\cmd.exe

What I am trying to figure out is why it tells me I have an x86, not an x64, system running only 32bits, when it should be 64bits. ARCHITEW6432 tells me correctly that I have a 64bit system, so should I be going by that alone? If it not a 64bit system then this flag is UNDEFINED.

What I also need to know is:

cmd.exe for 32 bit = ?????

cmd.exe for 64 bit = ?????

regedit.exe for 32 bit = ?????

regedit.exe for 64 bit = ????

What are the paths and filenames for the appropriate programs?

I will be doing a check in the installer like:

if (sysArch6432=="AMD64")
{
use 64 bit commands
}
else
{
use 32 bit commands
}

All input is welcome.

Link to comment
Share on other sites


This is what I have come up with for paths:

windir = "C:\Windows" (normally)

	var cmd64bit=windir+"\\system32\\cmd.exe";
var cmd32bit=windir+"\\syswow64\\cmd.exe";
var regedit64bit=windir+"\\system32\\regedt32.exe";
var regedit32bit=windir+"\\syswow64\\regedit.exe";

This look right? Of course it will be updated more, just getting the basics down.

Link to comment
Share on other sites

mritter,

I am far from an knowledgeable person on this stuff, but I have a couple of comments.

Concerning your first post: I think the important thing is what kind of OS is running (64 or 32 bit). Most current CPUs are 64 bit, capable of running with a 32 bit OS. I don't know what the architecture will show , but it might show AMD64 even when a a 32 bit OS is running.

The second post: I think the 32 Registry editor is also regedit.exe. This is to allow old programs to run unaltered. See this KB.

Enjoy, John.

Link to comment
Share on other sites

From what I have researched so far, the ARCHITEW6432 seems to be the defining variable for 64/32bit. I don't think there is a registry entry that says "this is 64bit windows", as far as I know. Something I will look in to.

I just found out that the 64bit mshta.exe has to be associated with .hta files, then it might reflect AMD64 and 64bits. Else it says it's a 32bit system. I assume that because .hta files aren't programs, they are "web pages".

=====

When I browse to Windows\Systems32 I only have regedt32.exe for 64bit.

In Windows\SysWOW64 I have the regular regedit.exe AND regedt32.exe.

I would think they would be the same, too, but don't seem to be. Unless it is an "alias" that Windows recognizes natively.

Keep the info coming!

Link to comment
Share on other sites

mritter,

We may be at cross purposes here. I am looking at my XP x64 system and know almost nothing about Vista. I have a regedit.exe in my Windows folder not System32. It is about 220KB while the one in the SysWOW64 is about 140KB. The large one is the same (identical hashes) as the one in the amd64 folder under the ServicePackFiles folder. Here is a KB about Regedit and Regedt32:

Differences between Regedit.exe and Regedt32.exe

And here is a KB about determining OS 32/64: See Method 2 under XP.

How to determine whether your computer is running a 32-bit version or a 64-bit version of the Windows operating system

Enjoy, John.

Link to comment
Share on other sites

I think you can check for, if the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node" is present, it will only be there in 64 bit OS'es, I have checked that it is the case for Windows XP x64 Professional, and for Windows Vista x64 Ultimate.

Sorry for my bad english.

Link to comment
Share on other sites

I think you can check for, if the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node" is present, it will only be there in 64 bit OS'es, I have checked that it is the case for Windows XP x64 Professional, and for Windows Vista x64 Ultimate.

Thats true until someone opens a regfile made for a 64bit system on a 32bit system. Then he might have that key in there as well although it won´t do anything. But it will confuse WPI ;-)

I would rely on environment variables for instance like this:

IF /i %PROCESSOR_ARCHITECTURE%==AMD64 goto x64
IF DEFINED PROCESSOR_ARCHITEW6432 goto x64

This would detect both situations on a 64bit system: either the 64bit mode or the 32bit mode. On a 32bit system this would also give the expected result.

Bye,

Alex

Link to comment
Share on other sites

Could point on regkey. Will stick my processor check method.

I have been talking with a few people and the easiest way we have come up with to tell WPI when to use 64 or 32 bit cmd/regedit is to add a checkbox to the Config wizard:

[ ] This program is 64 bits.

If checked, use 64bit commands, else 32 bit comands.

This will be saved with each entry in config.js. The default is unchecked, so will NOT affect anyone's current config file. The new lines will be added the first time you re-save with the new version of WPI.

This seems to be the easiest, most full-proof, simplest method. Will be very easy to implement and 100% backwards compatible.

This will also be good because if WPI was launched with 32bit mshta on a 64bit system, then the proper calls will still be made. I still recommend doing a Cond/GCond check to hide 64bit programs on 32bit systems.

What do you think? Have a better idea? Post them here.

Edited by mritter
Link to comment
Share on other sites

Hi Mark,

as I wrote you in my last mail, I also think that this checkbox way of doing things is the right way. Just make sure that even if the checkbox is checked, it would still work without an error on a 32bit system because some of us start a cmd in WPI and have our checks in there as well so that we can start a 32bit version of a program on a 32bit system and a 64bit version of the same program on a 64bit OS. This needs the checkbox in WPI to be set to 64bit but on a 32 bit system the same config.js should work too.

I guess it will, just being careful ;-)

Bye,

Alex

Link to comment
Share on other sites

Alex,

I understand your needs, but I think what you want is not possible.

If the checkbox is checked then this program, and all it's sub-commands and reg calls, are 64 bit. WPI will use the 64 bit versions of cmd and regedit. WPI will check if it is run on a 64 bit OS, not caring what mshta was used (will take some extra testing on my part). If the OS is 64 bit, use 64 bit commands in System32 folder, not SysWOW64 folder.

Now, if the OS is 32 bits, and the checkbox is checked, this program should be skipped. WPI will do it internally. Still do a Cond/GCond to hide them. I can have it add this automatically when check the checkbox.

So, I don't see why you want to still be able to launch a 64 bit program or script on a 32 bit system.

Link to comment
Share on other sites

Alex,

Re-read your last email...I see why you want to launch a 64 bit program on 32 bit system: Installer may have both 32 and 64 versions in one package.

I think the final "decision" will be how to 100% determine the OS bits, not taking mshta into account.

Link to comment
Share on other sites

Hi Mark,

Re-read your last email...I see why you want to launch a 64 bit program on 32 bit system: Installer may have both 32 and 64 versions in one package.

Yeah, thats one of the reasons why you definitely should never skip the program if the checkbox is checked but OS is 32bit. More and more programs will contain 32 and 64bit components inside one common installer. Also if the user does check for the bitlevel of the OS inside his own script and start that in WPI that should be allowed otherwise WPI would impact the way people use it.

One last note:

I would not call the checkbox "This program is 64bit" for the above reasons. I would call it something like "enable 64bit processing" or something like that because thats what you do with it. This checkbox should enable the user to run a program or script or registry tweak as 64bit native but if the OS is NOT 64bit it should still run fine. Otherwise people would need more than one config.js depending on bitlevel of the OS and this would not be very nice :rolleyes:

The final decision if the 64bit or 32bit cmd/regedit/whatever.exe´s are used should be decided by your check of the OS (environment variables for instance). I don´t see a reason why this would not work easily because the 64bit versions of those programs are in "%windir%/system32", the same place where they are on a 32bit Windows anyway :sneaky:

Thanks for listening !

Alex

Link to comment
Share on other sites

Hi again, Mark,

one last addition because that may not be clear enough yet.

If this checkbox is NOT enabled by the user and the OS is 64bit then WPI should redirect the calls to the SysWOW64 folder so that the 32bit versions of cmd/regedit/etc. are called. May be clear anyway, I just thought I´d mention it again :-)

Bye,

Alex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...