Recent

Author Topic: [SOLVED] Targeting your application for Windows 10  (Read 15265 times)

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
[SOLVED] Targeting your application for Windows 10
« on: October 12, 2015, 06:59:55 am »
Developing apps for windows 10 how to add this manifest to my executable.

Code: XML  [Select][+][-]
  1. <exe>.manifest
  2. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  3. <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  4.     <assemblyIdentity
  5.        type="win32"
  6.        name=SXS_ASSEMBLY_NAME
  7.        version=SXS_ASSEMBLY_VERSION
  8.        processorArchitecture=SXS_PROCESSOR_ARCHITECTURE
  9.    />
  10.     <description> my foo exe </description>
  11.     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  12.         <security>
  13.             <requestedPrivileges>
  14.                 <requestedExecutionLevel
  15.                    level="asInvoker"
  16.                    uiAccess="false"
  17.                 />     
  18.             </requestedPrivileges>
  19.         </security>
  20.     </trustInfo>
  21.     <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
  22.         <application>
  23.             <!-- Windows 10 -->
  24.             <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
  25.             <!-- Windows 8.1 -->
  26.             <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
  27.             <!-- Windows Vista -->
  28.             <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
  29.             <!-- Windows 7 -->
  30.             <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
  31.             <!-- Windows 8 -->
  32.             <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
  33.         </application>
  34.     </compatibility>
  35. </assembly>
  36.  
  37.  

So OS Version Information is returned correctly.

Quote
Details can be found here
https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241%28v=vs.85%29.aspx

Quote
OS version number
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
« Last Edit: October 13, 2015, 06:24:47 am by Deepaak »
Holiday season is online now. :-)

balazsszekely

  • Guest
Re: Targeting your application for Windows 10
« Reply #1 on: October 12, 2015, 08:19:26 am »
Create two files in your project folder(OsVersion.dat and OSVersion.rc):

1. The content of OsVersion.dat:
Quote
<exe>.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity
        type="win32"
        name=SXS_ASSEMBLY_NAME
        version=SXS_ASSEMBLY_VERSION
        processorArchitecture=SXS_PROCESSOR_ARCHITECTURE
    />
    <description> my foo exe </description>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />   
            </requestedPrivileges>
        </security>
    </trustInfo>
    <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 Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        </application>
    </compatibility>
</assembly>

2.  The content of OSVersion.rc:
Quote
OSVersion RCDATA "OSVersion.dat"

3. Add the following line to your project
{$R OsVersion.rc}

Menu-->Run-->Build all.

balazsszekely

  • Guest
Re: Targeting your application for Windows 10
« Reply #2 on: October 12, 2015, 08:47:57 am »
Probably the easiest solution(which will always work) is to extract the version information from a known dll(kernel32.dll for example). Windows provides the following functions to access version information: GetFileVersionInfo, VerQueryValue.

Thaddy

  • Hero Member
  • *****
  • Posts: 18797
  • Glad to be alive.
Re: Targeting your application for Windows 10
« Reply #3 on: October 12, 2015, 11:49:09 am »
Create two files in your project folder(OsVersion.dat and OSVersion.rc):


Close, but no cigar.

The resource should be of type RC_MANIFEST, not RC_DATA and you can simply compile the rc file that contains a reference to the manifest xml.

RC_MANIFEST is defined as MAKEINTRESOURCE(24)

Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

balazsszekely

  • Guest
Re: Targeting your application for Windows 10
« Reply #4 on: October 12, 2015, 12:34:07 pm »
@Deepaak

Tested on Win10(see attachment).

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
Re: Targeting your application for Windows 10
« Reply #5 on: October 13, 2015, 06:22:45 am »
@Deepaak

Tested on Win10(see attachment).

Thank you @GetMem its awesome. found a new method which don't require manifest inclusion
below is the code

Code: Pascal  [Select][+][-]
  1.  ZeroMemory(@os,SizeOf(OSVERSIONINFOEXW));
  2.  os.dwOSVersionInfoSize:=SizeOf(OSVERSIONINFOEXW);
  3.  
  4.  RtlGetVersion(@os);
  5. ShowMessage('Major : ' + IntToStr(Os.dwMajorVersion))
  6. ShowMessage('Major : ' + IntToStr(Os.dwMinorVersion))
  7.  

Thank you guys you are really awesome.  ;D :)
Holiday season is online now. :-)

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
Re: Targeting your application for Windows 10
« Reply #6 on: October 13, 2015, 06:24:28 am »
Probably the easiest solution(which will always work) is to extract the version information from a known dll(kernel32.dll for example). Windows provides the following functions to access version information: GetFileVersionInfo, VerQueryValue.

even this function is also worked.
Holiday season is online now. :-)

 

TinyPortal © 2005-2018