bug cWinVersion() [fixed in 20.04]

Re: bug cWinVersion() [still not fixed in 20.02]

Postby MOISES » Wed Apr 29, 2020 8:50 am

Antonio,

As to use Windows() function is mandatory to use a new manifest file, in this case GetVersion() correctly returns the value 10 for Windows 10.

Here is the fix for cWinVersion() too. This code is dual, for old manifest and new manifest files:

Code: Select all  Expand view


#define VER_PLATFORM_WIN32s         0
#define VER_PLATFORM_WIN32_WINDOWS  1
#define VER_PLATFORM_WIN32_NT       2

function cWinVersion()

   local aVersion := GetVersion()
   local cVersion := ""

   do case
      case aVersion[ 4 ] == VER_PLATFORM_WIN32_NT
           if aVersion[ 1 ] == 6
             if aVersion[ 2 ] == 0
                cVersion = "Vista"
             elseif aVersion[ 2 ] == 1
                cVersion = "7"
             elseif aVersion[ 2 ] == 2
                if IsWindows10()
                   cVersion = "10"
                else
                   cVersion = "8"
                endif
             endif
           endif

           if aVersion[ 1 ] == 10 /* New manifest file correctly returns the value 10 for Windows 10 */
              cVersion = "10"
           endif

           if aVersion[ 1 ] == 5
              if aVersion[ 2 ] == 2
                 cVersion = "Server 2003"
              elseif aVersion[ 2 ] == 1
                 cVersion = "XP"
              elseif aVersion[ 2 ] == 0
                 cVersion = "2000"
              endif
           endif

           if aVersion[ 1 ] <= 4
              cVersion = "NT"
           endif

      case aVersion[ 4 ] == VER_PLATFORM_WIN32_WINDOWS
           if aVersion[ 1 ] == 4
              if aVersion[ 2 ] == 90
                 cVersion = "ME"
              elseif aVersion[ 2 ] == 10
                 cVersion = "98"
              elseif aVersion[ 2 ] == 0
                 cVersion = "95"
              endif
           endif
   endcase

   cVersion += IF( IsWin64(), " 64 ", " 32 " ) + "Bits"

return cVersion


 
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug cWinVersion() [still not fixed in 20.02]

Postby Antonio Linares » Thu Apr 30, 2020 5:26 am

Moisés,

many thanks!

Included in next FWH 20.04
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bug cWinVersion() [fixed in 20.04]

Postby Antonio Linares » Thu Apr 30, 2020 7:09 am

New Windows10.Manifest that seems to be working fine:

Windows10.Manifest
Code: Select all  Expand view
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity
        type="win32"
        name="FiveTech Software.FiveWin.32bits"
        version="20.04.0.0"
        processorArchitecture="x86"
    />
    <description>FiveTech Software SL</description>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="X86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
    </dependency>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!-- Windows 10 -->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        </application>
    </compatibility>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <!--
                  UAC settings:
                  - app should run at same integrity level as calling process
                  - app does not need to manipulate windows belonging to
                    higher-integrity-level processes
                  -->
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />  
            </requestedPrivileges>
        </security>
    </trustInfo>
</assembly>
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 61 guests