Results 1 to 3 of 3

Thread: How to determine specific OS(Windows 7) in C language ?

  1. #1
    Join Date
    Nov 2010
    Posts
    4

    question How to determine specific OS(Windows 7) in C language ?

    Hello Everyone,

    My requirement is such that, I need to identify OS (in my case it is Windows 7) in C language and based on that condition have to proceed further.
    As we have 2 OS(Windows 7 and Windows Server 2008 R2) having the similar dwMajorVersion(6) and dwMinorVersion(1) but different product type.

    So we can differentiate "Windows 7" and "Windows Server 2008 R2" by product type.

    But my problem begins here:
    Currently I am working on "Microsoft Windows XP".

    On Windows XP Structure OSVERSIONINFOEX->
    Code:
    typedef struct _OSVERSIONINFOEXA {
        DWORD dwOSVersionInfoSize;
        DWORD dwMajorVersion;
        DWORD dwMinorVersion;
        DWORD dwBuildNumber;
        DWORD dwPlatformId;
        CHAR   szCSDVersion[ 128 ];     // Maintenance string for PSS usage
        WORD wServicePackMajor;
        WORD wServicePackMinor;
        WORD wReserved[2];
    }
    It does not contain variable to get information about product type that is "wProductType".

    Request you to please help me, how to determine the OS type between "Windows 7" and "Windows Server 2008 R2" considering I am coding on Microsft Windows XP.

    Thanks.

  2. #2
    Join Date
    May 2008
    Posts
    4,085

    Re: How to determine specific OS(Windows 7) in C language ?

    Maybe, you can get some more information about how to differentiate between the OS'es by looking at here - http://msdn.microsoft.com/en-us/libr...33(VS.85).aspx

  3. #3
    Join Date
    Nov 2010
    Posts
    4

    sad Re: How to determine specific OS(Windows 7) in C language ?

    Hello,

    Thank you for quick response.
    But I don't know the reason behind the structure OSVERSIONINFOEX that is showing on Microsoft Windows XP professional version 2002 as below.

    It does not have following 2 variables mainly wProductType through which OS with same version can be uniquely identified:

    Code:
    WORD wSuiteMask;
    BYTE wProductType;
    On Microsoft Windows XP Structure OSVERSIONINFOEX->

    Code:
    typedef struct _OSVERSIONINFOEXA {
        DWORD dwOSVersionInfoSize;
        DWORD dwMajorVersion;
        DWORD dwMinorVersion;
        DWORD dwBuildNumber;
        DWORD dwPlatformId;
        CHAR   szCSDVersion[ 128 ];     // Maintenance string for PSS usage
        WORD wServicePackMajor;
        WORD wServicePackMinor;
        WORD wReserved[2];
    }OSVERSIONINFOEXA, *POSVERSIONINFOEX,A *LPOSVERSIONINFOEXA;
    In my case I have to differentiate between "Windows 7" and "Windows Server 2008 R2"

    Thanks.

Similar Threads

  1. Windows cannot determine the user or computer name
    By HawleyBeach in forum Windows Server Help
    Replies: 5
    Last Post: 27-04-2012, 11:49 PM
  2. Replies: 3
    Last Post: 31-01-2011, 11:57 PM
  3. How do i determine which windows service pack i am using?
    By cplspls in forum Windows Software
    Replies: 2
    Last Post: 27-02-2010, 05:34 PM
  4. How to determine correct wireless channel in Windows XP
    By Ebadaah in forum Networking & Security
    Replies: 3
    Last Post: 12-06-2009, 04:50 PM
  5. Replies: 0
    Last Post: 05-05-2009, 06:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,582,046.54055 seconds with 17 queries