View Issue Details

IDProjectCategoryView StatusLast Update
0028435LazarusIDEpublic2016-01-27 14:36
ReporterlainzAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86 / x64OSWindowsOS VersionAny
Product Version1.4.2Product Build49524 
Target Version1.4.4Fixed in Version1.4.4 
Summary0028435: Manifest for Windows in Project Options must be updated
DescriptionHi,

With the IDE is possible to add a manifest to enable themes and other stuff. This manifest is outdated and need more sections.

Quote from microsoft article: "With Windows 10 VerifyVersionInfo is now subject to the same manifest-based behavior as GetVersion(Ex): by default IsWindows8OrGreater and earlier will return 'true' as expected on Windows 10, but both IsWindows8Point1OrGreater and IsWindows10OrGreater will return 'false' without the appropriate GUIDs present in the <compatibility> section."

Article: http://blogs.msdn.com/b/chuckw/archive/2013/09/10/manifest-madness.aspx

Let me explain you:
GetVersionEx is used in Sysutils unit for win32: CheckWin32Version depend on this. So is mandatory to get this working well to add the <compatibility> section.

Another usefull thing about adding the <compatibility> section is that if you made a custom setup for your windows application with lazarus (like copying files under program files) when your setup finish you will not get an error message about compatibility.

Under additional information I give you a manifest file directly from Visual Studio 2015 project, with just the needed things for lazarus application and indenting well written.

Manifest should be added always! but you can separate into pieces:
- The to chose the execution level is OK, but please include it always, as default "asInvoker". UI Access checkbox is fine.
- Add a checkbox to chose each <compatibility> windows version, checked all by default since is needed as I explained before.
- The dpi aware checkbox, the current works fine. New applications should be high dpi aware, else will look blurry, I've made a wiki article about this. Enable by default and add a link to the wiki article to help users implement this (it does not takes much time).
- Add the '<dependency>' part checkbox: this will enable themes, if not checked themes will not shown, but the rest of the manifest will work the same.

If this is a lot of work, just add an option to include a custom manifest file. Provide the one I show you as default since it covers everything needed.
Additional InformationThis is a final manifest file with everything well written:

<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity version="1.0.0.0" name="lazarus.app" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- 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}" />
      <!-- Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
      <!-- Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
    </application>
  </compatibility>
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
</assembly>
TagsNo tags attached.
Fixed in Revisionr49587
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • manifest.xml (1,615 bytes)
  • w32manifest.pas (8,568 bytes)
    {
     /***************************************************************************
                            w32manifest.pas  -  Lazarus IDE unit
                            ---------------------------------------
                  TProjectXPManifest is responsible for the inclusion of the 
                       manifest in windows executables.
    
    
     ***************************************************************************/
    
     ***************************************************************************
     *                                                                         *
     *   This source is free software; you can redistribute it and/or modify   *
     *   it under the terms of the GNU General Public License as published by  *
     *   the Free Software Foundation; either version 2 of the License, or     *
     *   (at your option) any later version.                                   *
     *                                                                         *
     *   This code is distributed in the hope that it will be useful, but      *
     *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
     *   General Public License for more details.                              *
     *                                                                         *
     *   A copy of the GNU General Public License is available on the World    *
     *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
     *   obtain it by writing to the Free Software Foundation,                 *
     *   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.        *
     *                                                                         *
     ***************************************************************************
    
      The manifest file is needed for windows XP themes.
      The file is created in the directory, where the project exe is created.
    }
    unit W32Manifest;
    
    {$mode objfpc}{$H+}
    
    interface
    
    uses
      Classes, SysUtils, FileUtil, Laz2_XMLCfg, Process, LCLProc, Controls, Forms,
      CodeToolManager, LazConf, LResources,
      ProjectResourcesIntf, resource;
       
    type
      TXPManifestExecutionLevel = (
        xmelAsInvoker,
        xmelHighestAvailable,
        xmelRequireAdministrator
      );
    
      { TProjectXPManifest }
    
      TProjectXPManifest = class(TAbstractProjectResource)
      private
        FExecutionLevel: TXPManifestExecutionLevel;
        FIsDpiaAware: boolean;
        FUIAccess: Boolean;
        FUseManifest: boolean;
        procedure SetDpiAware(const AValue: boolean);
        procedure SetExecutionLevel(AValue: TXPManifestExecutionLevel);
        procedure SetUIAccess(AValue: Boolean);
        procedure SetUseManifest(const AValue: boolean);
      public
        constructor Create; override;
        function UpdateResources(AResources: TAbstractProjectResources; const {%H-}MainFilename: string): Boolean; override;
        procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
        procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
    
        property UseManifest: boolean read FUseManifest write SetUseManifest;
        property DpiAware: boolean read FIsDpiaAware write SetDpiAware;
        property ExecutionLevel: TXPManifestExecutionLevel read FExecutionLevel write SetExecutionLevel;
        property UIAccess: Boolean read FUIAccess write SetUIAccess;
      end;
    
    const
      ExecutionLevelToStr: array[TXPManifestExecutionLevel] of String = (
        'asInvoker',
        'highestAvailable',
        'requireAdministrator'
      );
    implementation
    
    const
      sManifestFileDataStart: String =
        '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'#$D#$A+
        '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">'#$D#$A+
        ' <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Lazarus.Application" type="win32"/>'#$D#$A+
        ' <description>Lazarus Application</description>'#$D#$A+
        ' <dependency>'#$D#$A+
        '  <dependentAssembly>'#$D#$A+
        '   <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>'#$D#$A+
        '  </dependentAssembly>'#$D#$A+
        ' </dependency>'#$D#$A+
        ' <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">'#$D#$A+
        '  <security>'#$D#$A+
        '   <requestedPrivileges>'#$D#$A+
        '    <requestedExecutionLevel level="%s" uiAccess="%s"/>'#$D#$A+
        '   </requestedPrivileges>'#$D#$A+
        '  </security>'#$D#$A+
        ' </trustInfo>'#$D#$A+
    	' <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">'#$D#$A+
        '  <application>'#$D#$A+
        '   <!-- Windows Vista -->'#$D#$A+
        '   <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />'#$D#$A+
        '   <!-- Windows 7 -->'#$D#$A+
        '   <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />'#$D#$A+
        '   <!-- Windows 8 -->'#$D#$A+
        '   <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />'#$D#$A+
        '   <!-- Windows 8.1 -->'#$D#$A+
        '   <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />'#$D#$A+
        '   <!-- Windows 10 -->'#$D#$A+
        '   <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />'#$D#$A+
        '  </application>'#$D#$A+
        ' </compatibility>'#$D#$A;
      sManifestFileDataEnd: String =
        '</assembly>';
      sManifestFileDataDpiAware: String =
        ' <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">'#$D#$A+
        '  <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">'#$D#$A+
        '   <dpiAware>true</dpiAware>'#$D#$A+
        '  </asmv3:windowsSettings>'#$D#$A+
        ' </asmv3:application>'#$D#$A;
    
    procedure TProjectXPManifest.SetUseManifest(const AValue: boolean);
    begin
      if FUseManifest = AValue then exit;
      FUseManifest := AValue;
      Modified := True;
    end;
    
    procedure TProjectXPManifest.SetDpiAware(const AValue: boolean);
    begin
      if FIsDpiaAware = AValue then exit;
      FIsDpiaAware := AValue;
      Modified := True;
    end;
    
    procedure TProjectXPManifest.SetExecutionLevel(AValue: TXPManifestExecutionLevel);
    begin
      if FExecutionLevel = AValue then Exit;
      FExecutionLevel := AValue;
      Modified := True;
    end;
    
    procedure TProjectXPManifest.SetUIAccess(AValue: Boolean);
    begin
      if FUIAccess = AValue then Exit;
      FUIAccess := AValue;
      Modified := True;
    end;
    
    constructor TProjectXPManifest.Create;
    begin
      inherited Create;
      UseManifest := False;
      DpiAware := False;
      ExecutionLevel := xmelAsInvoker;
      UIAccess := False;
    end;
    
    function TProjectXPManifest.UpdateResources(AResources: TAbstractProjectResources;
      const MainFilename: string): Boolean;
    var
      Res: TGenericResource;
      RName, RType: TResourceDesc;
      ManifestFileData: String;
    begin
      Result := True;
      if UseManifest then
      begin
        RType := TResourceDesc.Create(RT_MANIFEST);
        RName := TResourceDesc.Create(1);
        Res := TGenericResource.Create(RType, RName);
        RType.Free; //no longer needed
        RName.Free;
        ManifestFileData := Format(sManifestFileDataStart, [ExecutionLevelToStr[ExecutionLevel], BoolToStr(UIAccess, 'true', 'false')]);
        if DpiAware then
          ManifestFileData := ManifestFileData + sManifestFileDataDpiAware;
        ManifestFileData := ManifestFileData + sManifestFileDataEnd;
        Res.RawData.Write(ManifestFileData[1], Length(ManifestFileData));
        AResources.AddSystemResource(Res);
      end;
    end;
    
    procedure TProjectXPManifest.WriteToProjectFile(AConfig: TObject; Path: String);
    begin
      TXMLConfig(AConfig).SetDeleteValue(Path+'General/UseXPManifest/Value', UseManifest, False);
      TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/DpiAware/Value', DpiAware, False);
      TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/ExecutionLevel/Value', Ord(ExecutionLevel), 0);
      TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/UIAccess/Value', UIAccess, False);
    end;
    
    procedure TProjectXPManifest.ReadFromProjectFile(AConfig: TObject; Path: String);
    begin
      UseManifest := TXMLConfig(AConfig).GetValue(Path+'General/UseXPManifest/Value', False);
      DpiAware := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/DpiAware/Value', False);
      ExecutionLevel := TXPManifestExecutionLevel(TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/ExecutionLevel/Value', 0));
      UIAccess := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/UIAccess/Value', False);
    end;
    
    initialization
      RegisterProjectResource(TProjectXPManifest);
    
    end.
    
    
    w32manifest.pas (8,568 bytes)
  • manifest.diff (1,223 bytes)
    Index: w32manifest.pas
    ===================================================================
    --- w32manifest.pas	(revision 49565)
    +++ w32manifest.pas	(working copy)
    @@ -97,7 +97,21 @@
         '    <requestedExecutionLevel level="%s" uiAccess="%s"/>'#$D#$A+
         '   </requestedPrivileges>'#$D#$A+
         '  </security>'#$D#$A+
    -    ' </trustInfo>'#$D#$A;
    +    ' </trustInfo>'#$D#$A+
    +    ' <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">'#$D#$A+
    +    '  <application>'#$D#$A+
    +    '   <!-- Windows Vista -->'#$D#$A+
    +    '   <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />'#$D#$A+
    +    '   <!-- Windows 7 -->'#$D#$A+
    +    '   <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />'#$D#$A+
    +    '   <!-- Windows 8 -->'#$D#$A+
    +    '   <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />'#$D#$A+
    +    '   <!-- Windows 8.1 -->'#$D#$A+
    +    '   <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />'#$D#$A+
    +    '   <!-- Windows 10 -->'#$D#$A+
    +    '   <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />'#$D#$A+
    +    '   </application>'#$D#$A+
    +    '  </compatibility>'#$D#$A;
       sManifestFileDataEnd: String =
         '</assembly>';
       sManifestFileDataDpiAware: String =
    
    manifest.diff (1,223 bytes)

Relationships

related to 0027488 resolvedBart Broersma [Patch] Improve compatibility platform support (win7 until 8.1) on Manifest 

Activities

lainz

2015-07-26 05:47

reporter  

manifest.xml (1,615 bytes)

lainz

2015-07-26 05:55

reporter   ~0085053

Hi,

I forget to add the link to wiki article about DPI under Windows: this was improved by different users under time.
http://wiki.lazarus.freepascal.org/High_DPI

This apply to any Windows Vista or newer OS's up to Windows 10 application produced with Lazarus. (win32 / win64 .exe)-

Juha Manninen

2015-07-27 10:30

developer   ~0085068

Could you provide a patch please.

lainz

2015-07-27 13:07

reporter   ~0085071

Hi,

I never changed the IDE by myself. But I'll add the updated w32manifest.pas that includes the <compatibility> section and you can diff it (is the same in 1.4.2 and trunk, I've checked it). Is not all I wanted to add but it works. The other changes are more specific to IDE but are not needed at all to add the <compatibility> section that in fact is always wanted to be added.

lainz

2015-07-27 13:08

reporter  

w32manifest.pas (8,568 bytes)
{
 /***************************************************************************
                        w32manifest.pas  -  Lazarus IDE unit
                        ---------------------------------------
              TProjectXPManifest is responsible for the inclusion of the 
                   manifest in windows executables.


 ***************************************************************************/

 ***************************************************************************
 *                                                                         *
 *   This source is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This code is distributed in the hope that it will be useful, but      *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   A copy of the GNU General Public License is available on the World    *
 *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
 *   obtain it by writing to the Free Software Foundation,                 *
 *   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.        *
 *                                                                         *
 ***************************************************************************

  The manifest file is needed for windows XP themes.
  The file is created in the directory, where the project exe is created.
}
unit W32Manifest;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Laz2_XMLCfg, Process, LCLProc, Controls, Forms,
  CodeToolManager, LazConf, LResources,
  ProjectResourcesIntf, resource;
   
type
  TXPManifestExecutionLevel = (
    xmelAsInvoker,
    xmelHighestAvailable,
    xmelRequireAdministrator
  );

  { TProjectXPManifest }

  TProjectXPManifest = class(TAbstractProjectResource)
  private
    FExecutionLevel: TXPManifestExecutionLevel;
    FIsDpiaAware: boolean;
    FUIAccess: Boolean;
    FUseManifest: boolean;
    procedure SetDpiAware(const AValue: boolean);
    procedure SetExecutionLevel(AValue: TXPManifestExecutionLevel);
    procedure SetUIAccess(AValue: Boolean);
    procedure SetUseManifest(const AValue: boolean);
  public
    constructor Create; override;
    function UpdateResources(AResources: TAbstractProjectResources; const {%H-}MainFilename: string): Boolean; override;
    procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
    procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;

    property UseManifest: boolean read FUseManifest write SetUseManifest;
    property DpiAware: boolean read FIsDpiaAware write SetDpiAware;
    property ExecutionLevel: TXPManifestExecutionLevel read FExecutionLevel write SetExecutionLevel;
    property UIAccess: Boolean read FUIAccess write SetUIAccess;
  end;

const
  ExecutionLevelToStr: array[TXPManifestExecutionLevel] of String = (
    'asInvoker',
    'highestAvailable',
    'requireAdministrator'
  );
implementation

const
  sManifestFileDataStart: String =
    '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'#$D#$A+
    '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">'#$D#$A+
    ' <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Lazarus.Application" type="win32"/>'#$D#$A+
    ' <description>Lazarus Application</description>'#$D#$A+
    ' <dependency>'#$D#$A+
    '  <dependentAssembly>'#$D#$A+
    '   <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>'#$D#$A+
    '  </dependentAssembly>'#$D#$A+
    ' </dependency>'#$D#$A+
    ' <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">'#$D#$A+
    '  <security>'#$D#$A+
    '   <requestedPrivileges>'#$D#$A+
    '    <requestedExecutionLevel level="%s" uiAccess="%s"/>'#$D#$A+
    '   </requestedPrivileges>'#$D#$A+
    '  </security>'#$D#$A+
    ' </trustInfo>'#$D#$A+
	' <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">'#$D#$A+
    '  <application>'#$D#$A+
    '   <!-- Windows Vista -->'#$D#$A+
    '   <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />'#$D#$A+
    '   <!-- Windows 7 -->'#$D#$A+
    '   <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />'#$D#$A+
    '   <!-- Windows 8 -->'#$D#$A+
    '   <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />'#$D#$A+
    '   <!-- Windows 8.1 -->'#$D#$A+
    '   <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />'#$D#$A+
    '   <!-- Windows 10 -->'#$D#$A+
    '   <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />'#$D#$A+
    '  </application>'#$D#$A+
    ' </compatibility>'#$D#$A;
  sManifestFileDataEnd: String =
    '</assembly>';
  sManifestFileDataDpiAware: String =
    ' <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">'#$D#$A+
    '  <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">'#$D#$A+
    '   <dpiAware>true</dpiAware>'#$D#$A+
    '  </asmv3:windowsSettings>'#$D#$A+
    ' </asmv3:application>'#$D#$A;

procedure TProjectXPManifest.SetUseManifest(const AValue: boolean);
begin
  if FUseManifest = AValue then exit;
  FUseManifest := AValue;
  Modified := True;
end;

procedure TProjectXPManifest.SetDpiAware(const AValue: boolean);
begin
  if FIsDpiaAware = AValue then exit;
  FIsDpiaAware := AValue;
  Modified := True;
end;

procedure TProjectXPManifest.SetExecutionLevel(AValue: TXPManifestExecutionLevel);
begin
  if FExecutionLevel = AValue then Exit;
  FExecutionLevel := AValue;
  Modified := True;
end;

procedure TProjectXPManifest.SetUIAccess(AValue: Boolean);
begin
  if FUIAccess = AValue then Exit;
  FUIAccess := AValue;
  Modified := True;
end;

constructor TProjectXPManifest.Create;
begin
  inherited Create;
  UseManifest := False;
  DpiAware := False;
  ExecutionLevel := xmelAsInvoker;
  UIAccess := False;
end;

function TProjectXPManifest.UpdateResources(AResources: TAbstractProjectResources;
  const MainFilename: string): Boolean;
var
  Res: TGenericResource;
  RName, RType: TResourceDesc;
  ManifestFileData: String;
begin
  Result := True;
  if UseManifest then
  begin
    RType := TResourceDesc.Create(RT_MANIFEST);
    RName := TResourceDesc.Create(1);
    Res := TGenericResource.Create(RType, RName);
    RType.Free; //no longer needed
    RName.Free;
    ManifestFileData := Format(sManifestFileDataStart, [ExecutionLevelToStr[ExecutionLevel], BoolToStr(UIAccess, 'true', 'false')]);
    if DpiAware then
      ManifestFileData := ManifestFileData + sManifestFileDataDpiAware;
    ManifestFileData := ManifestFileData + sManifestFileDataEnd;
    Res.RawData.Write(ManifestFileData[1], Length(ManifestFileData));
    AResources.AddSystemResource(Res);
  end;
end;

procedure TProjectXPManifest.WriteToProjectFile(AConfig: TObject; Path: String);
begin
  TXMLConfig(AConfig).SetDeleteValue(Path+'General/UseXPManifest/Value', UseManifest, False);
  TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/DpiAware/Value', DpiAware, False);
  TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/ExecutionLevel/Value', Ord(ExecutionLevel), 0);
  TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/UIAccess/Value', UIAccess, False);
end;

procedure TProjectXPManifest.ReadFromProjectFile(AConfig: TObject; Path: String);
begin
  UseManifest := TXMLConfig(AConfig).GetValue(Path+'General/UseXPManifest/Value', False);
  DpiAware := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/DpiAware/Value', False);
  ExecutionLevel := TXPManifestExecutionLevel(TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/ExecutionLevel/Value', 0));
  UIAccess := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/UIAccess/Value', False);
end;

initialization
  RegisterProjectResource(TProjectXPManifest);

end.

w32manifest.pas (8,568 bytes)

Juha Manninen

2015-08-01 00:34

developer   ~0085128

http://wiki.freepascal.org/Creating_A_Patch

lainz

2015-08-01 17:09

reporter   ~0085148

Sorry. As I said before, I don't have trunk and I don't want it. The file is the same in release and trunk.

Is as simple as adding this:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- 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}" />
      <!-- Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
      <!-- Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
    </application>
  </compatibility>

Bart Broersma

2015-08-01 20:01

developer  

manifest.diff (1,223 bytes)
Index: w32manifest.pas
===================================================================
--- w32manifest.pas	(revision 49565)
+++ w32manifest.pas	(working copy)
@@ -97,7 +97,21 @@
     '    <requestedExecutionLevel level="%s" uiAccess="%s"/>'#$D#$A+
     '   </requestedPrivileges>'#$D#$A+
     '  </security>'#$D#$A+
-    ' </trustInfo>'#$D#$A;
+    ' </trustInfo>'#$D#$A+
+    ' <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">'#$D#$A+
+    '  <application>'#$D#$A+
+    '   <!-- Windows Vista -->'#$D#$A+
+    '   <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />'#$D#$A+
+    '   <!-- Windows 7 -->'#$D#$A+
+    '   <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />'#$D#$A+
+    '   <!-- Windows 8 -->'#$D#$A+
+    '   <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />'#$D#$A+
+    '   <!-- Windows 8.1 -->'#$D#$A+
+    '   <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />'#$D#$A+
+    '   <!-- Windows 10 -->'#$D#$A+
+    '   <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />'#$D#$A+
+    '   </application>'#$D#$A+
+    '  </compatibility>'#$D#$A;
   sManifestFileDataEnd: String =
     '</assembly>';
   sManifestFileDataDpiAware: String =
manifest.diff (1,223 bytes)

Bart Broersma

2015-08-01 20:02

developer   ~0085149

Patch uploaded.
IDE builds fine and runs fine on W7, I cannot test on XP/Vista/W8/W10.

Bart Broersma

2015-08-01 22:08

developer   ~0085152

Thanks for the update to the manifest.
Please test and close if OK.

lainz

2015-08-01 23:38

reporter   ~0085154

It's ok for me. Thanks.

Issue History

Date Modified Username Field Change
2015-07-26 05:46 lainz New Issue
2015-07-26 05:47 lainz File Added: manifest.xml
2015-07-26 05:55 lainz Note Added: 0085053
2015-07-27 10:30 Juha Manninen Note Added: 0085068
2015-07-27 13:07 lainz Note Added: 0085071
2015-07-27 13:08 lainz File Added: w32manifest.pas
2015-08-01 00:34 Juha Manninen Note Added: 0085128
2015-08-01 17:09 lainz Note Added: 0085148
2015-08-01 20:01 Bart Broersma File Added: manifest.diff
2015-08-01 20:02 Bart Broersma Note Added: 0085149
2015-08-01 21:51 Juha Manninen Assigned To => Bart Broersma
2015-08-01 21:51 Juha Manninen Status new => assigned
2015-08-01 22:08 Bart Broersma Fixed in Revision => r49587
2015-08-01 22:08 Bart Broersma LazTarget => -
2015-08-01 22:08 Bart Broersma Note Added: 0085152
2015-08-01 22:08 Bart Broersma Status assigned => resolved
2015-08-01 22:08 Bart Broersma Fixed in Version => 1.4.4
2015-08-01 22:08 Bart Broersma Resolution open => fixed
2015-08-01 22:08 Bart Broersma Target Version => 1.4.4
2015-08-01 23:38 lainz Note Added: 0085154
2015-08-01 23:38 lainz Status resolved => closed
2016-01-27 14:36 Bart Broersma Relationship added related to 0027488