Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. xp or vista?

xp or vista?

Scheduled Pinned Locked Moved Windows API
tutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sheetal_06
    wrote on last edited by
    #1

    How to check whether the os is xp or vista? Thanks

    M M 2 Replies Last reply
    0
    • S sheetal_06

      How to check whether the os is xp or vista? Thanks

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      I'm assuming you mean from code? Microsoft's recommended approach now is to call VerifyVersionInfo. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people called GetVersion or GetVersionEx, but made mistakes in the comparison.

      Stability. What an interesting concept. -- Chris Maunder

      S realJSOPR 2 Replies Last reply
      0
      • M Mike Dimmick

        I'm assuming you mean from code? Microsoft's recommended approach now is to call VerifyVersionInfo. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people called GetVersion or GetVersionEx, but made mistakes in the comparison.

        Stability. What an interesting concept. -- Chris Maunder

        S Offline
        S Offline
        sheetal_06
        wrote on last edited by
        #3

        Ya through code.. Thankyou very much.

        1 Reply Last reply
        0
        • M Mike Dimmick

          I'm assuming you mean from code? Microsoft's recommended approach now is to call VerifyVersionInfo. Windows XP is version 5.1 internally; Windows Vista is version 6.0. The reason for the complicated API is that traditionally people called GetVersion or GetVersionEx, but made mistakes in the comparison.

          Stability. What an interesting concept. -- Chris Maunder

          realJSOPR Online
          realJSOPR Online
          realJSOP
          wrote on last edited by
          #4

          If you try to do that in Vista, the UAC will be activated, and you'll be presented with somehting like this: You are attempting to retrieve sensitive system information. Your action is being reported to Microsoft, along with any personal information that might be stored on this system. Continuing on this course of action will void your warranty, and this instance of Vista will be reduced even further in functionality until your intentions have been verified. Continue this course of action - cancel or allow?

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          M 1 Reply Last reply
          0
          • realJSOPR realJSOP

            If you try to do that in Vista, the UAC will be activated, and you'll be presented with somehting like this: You are attempting to retrieve sensitive system information. Your action is being reported to Microsoft, along with any personal information that might be stored on this system. Continuing on this course of action will void your warranty, and this instance of Vista will be reduced even further in functionality until your intentions have been verified. Continue this course of action - cancel or allow?

            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            M Offline
            M Offline
            Mike Dimmick
            wrote on last edited by
            #5

            Just to make it clear, since John didn't use the joke icon: it doesn't do this. UAC only fires when you run an application, or an application is run on your behalf which has:

            1. A manifest which sets the requestedExecutionLevel for the program to requireAdministrator (and also highestAvailable, if you're an administrator rather than a standard user)
            2. The compatibility option 'Run as administrator' is ticked
            3. A compatibility shim detects the program should run elevated (e.g. for setup programs)
            4. You used the 'Run As Administrator' context menu option

            If you have an administrator account, by default you get an infamous Cancel/Allow prompt; standard users get an 'over the shoulder' prompt for an administrative account name and password. The aim is to avoid constantly prompting the user for a password, which is deemed a security risk because if you're constantly entering your password, you stop thinking carefully about whether you should enter it in a given dialog and can end up disclosing it to something you didn't mean to. Standard users only see UAC prompts for requireAdministrator; code silently runs non-elevated for highestAvailable. If you're coding for Vista you should ensure that you're not trying to write to any protected locations and you should set requestedExecutionLevel to asInvoker to enforce this. Omitting the manifest causes file system and registry redirection to occur, for some protected locations. Only if your application actually performs an administrative function should you use anything higher. Preferably you should split all administrative functions into a separate program, marked requireAdministrator, which you launch from the main application as required. As developers, we see many more UAC prompts than a regular user would, because we generally want our tools to affect global system state (e.g. for COM registration) and because Vista wasn't finalized before the last release of Visual Studio. I myself haven't moved across as some of my tools - eMbedded Visual C++, primarily - don't even work. VB6 SP6 doesn't work for a standard user on XP (which is peculiar, as SP5 did) which is presumably why it requires elevation on Windows Vista. Yes, these tools are archaic - nine years old now - but they remain vital to support the software that is in the market.

            Stability. What an interesting concept. --

            realJSOPR 1 Reply Last reply
            0
            • S sheetal_06

              How to check whether the os is xp or vista? Thanks

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              Check the OS version, there are many ways to do this as the other replies said. XP is 5.1 or 5.2, Vista is 6.0.

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

              1 Reply Last reply
              0
              • M Mike Dimmick

                Just to make it clear, since John didn't use the joke icon: it doesn't do this. UAC only fires when you run an application, or an application is run on your behalf which has:

                1. A manifest which sets the requestedExecutionLevel for the program to requireAdministrator (and also highestAvailable, if you're an administrator rather than a standard user)
                2. The compatibility option 'Run as administrator' is ticked
                3. A compatibility shim detects the program should run elevated (e.g. for setup programs)
                4. You used the 'Run As Administrator' context menu option

                If you have an administrator account, by default you get an infamous Cancel/Allow prompt; standard users get an 'over the shoulder' prompt for an administrative account name and password. The aim is to avoid constantly prompting the user for a password, which is deemed a security risk because if you're constantly entering your password, you stop thinking carefully about whether you should enter it in a given dialog and can end up disclosing it to something you didn't mean to. Standard users only see UAC prompts for requireAdministrator; code silently runs non-elevated for highestAvailable. If you're coding for Vista you should ensure that you're not trying to write to any protected locations and you should set requestedExecutionLevel to asInvoker to enforce this. Omitting the manifest causes file system and registry redirection to occur, for some protected locations. Only if your application actually performs an administrative function should you use anything higher. Preferably you should split all administrative functions into a separate program, marked requireAdministrator, which you launch from the main application as required. As developers, we see many more UAC prompts than a regular user would, because we generally want our tools to affect global system state (e.g. for COM registration) and because Vista wasn't finalized before the last release of Visual Studio. I myself haven't moved across as some of my tools - eMbedded Visual C++, primarily - don't even work. VB6 SP6 doesn't work for a standard user on XP (which is peculiar, as SP5 did) which is presumably why it requires elevation on Windows Vista. Yes, these tools are archaic - nine years old now - but they remain vital to support the software that is in the market.

                Stability. What an interesting concept. --

                realJSOPR Online
                realJSOPR Online
                realJSOP
                wrote on last edited by
                #7

                Mike Dimmick wrote:

                Just to make it clear, since John didn't use the joke icon:

                I shouldn't have had to use the joke icon...

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups