Results 1 to 5 of 5

Thread: Determine OS bit Version not Processor bit

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    15

    Lightbulb Determine OS bit Version not Processor bit

    I have a little problem and im stuck with my application since im not sure if it will work correctly on a x64 bit version.
    Now im trying to create a VBScript which will check for OS bit and install the msi according to the OS bit.
    I have found a lot of trash by googling for this solution which i think im not sure if it will work.

    I have found another interesting code which will check if ProgramFilesx86 exist but the problem is only win7 has this option to check for xp and vista this folder seems not to exists. My processor is 32bit and i cant install an OS x64 to check it myself what differences are there to ensure what OS architecture it is.
    I ask for help if somebody could tell me which folders or files or system files are different to a 32bit OS so to make a script to make sure which msi i can install(i will embed both assemblies on the main package)
    Some scripts try to check from registry which will not work to all win versions.
    Please refer me to the right answer, thanks Begi

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Determine OS bit Version not Processor bit

    I am not sure what your goal is. Is it to prevent installation of 64 bit systems? If you don't have a 64 bit system to test on, how can you be sure the vbscript is even going to work correctly?

    Your best bet may be compiling the software for x86 instead of AnyCPU, so that it will run as a 32 bit process regardless of windows being 32bit or 64bit.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    15

    Re: Determine OS bit Version not Processor bit

    I already found some help
    checking if HKLM\SOFTWARE\Wow64NODE\ exists then we are on a 64 bit OS else we are on a 32 bit platform!
    Now i ask you another question what about API codes will they run as x86 process on a x64 machine because in my x86 app the code is referencing to user32.dll to get the API functions will this also run on x64 os what if user32.dll doesnt exist which i am pretty sure i doesnt?

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Determine OS bit Version not Processor bit

    User32.Dll should be there otherwise it would break like every windows application on the planet.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Determine OS bit Version not Processor bit

    For .NET 4 and later you can use the, Environment.Is64BitOperatingSystem Property

    One of the main things about AMD64 (x86-64) was the 32-bit backward compatibility. There were rumors Intel wanted to dump x86-32bit and force us to switch to their x86 incompatible IA-64 (64bit) architecture (now in Itanium), AMD added extensions to the x86 instruction set so the CPUs could run in 64-bit mode while also running code compiled in 32-bit mode at the same time. Intel were also working on x86-64bit but MS said they would only support one x86-64bit architecture and went with AMD's solution, Intel copied AMD64 to be compatible.

    So when your on a 64-bit OS and the app is compiled for 64-bit it can do 32-bit and 64-bit, if you compile your app as 32-bit then you you should only make 32-bit calls, AFAIK a 32-bit app can't call 64-bit.

    When using API calls also make sure they are supported on the target OS(s), at the bottom of the MSDN docs for the API they usually tell you what the minimum client and server OS are supported.

    http://en.wikipedia.org/wiki/X86-64
    http://en.wikipedia.org/wiki/Itanium
    Last edited by Edgemeal; Sep 29th, 2012 at 01:00 PM.

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
  •  



Click Here to Expand Forum to Full Width