FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bug cWinVersion() [fixed in 20.04]
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: bug cWinVersion() [still not fixed in 20.02]
Posted: Wed Apr 29, 2020 08: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 (fw): Select all Collapse
#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: bug cWinVersion() [still not fixed in 20.02]
Posted: Thu Apr 30, 2020 05:26 AM

Moisés,

many thanks!

Included in next FWH 20.04

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: bug cWinVersion() [fixed in 20.04]
Posted: Thu Apr 30, 2020 07:09 AM
New Windows10.Manifest that seems to be working fine:

Windows10.Manifest
Code (fw): Select all Collapse
<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

Continue the discussion