Win32:...nifest(3pm)
π Win32::Exe::Manifest π
okay bestie, so this is a page from the User Contributed Perl Documentation collection, and it's called Win32::Exe::Manifest. It lives in the 3pm section (that's the perl module girlies π
). Strap in, we're doing Windows manifests and honestly? it's giving powerful.
β¨ NAME β¨
Win32::Exe::Manifest β MSWin Application and Assembly manifest handling πͺπ¦
πΈ VERSION πΈ
This doc describes version 0.15 of Win32::Exe::Manifest, and it was released on November 30, 2010. vintage era, iconic behavior.
π SYNOPSIS π
use Win32::Exe
my $exe = Win32:::Exe->new('somefilepath');
my $manifest = $exe->get_manifest if $exe->has_manifest;
# Get themed controls
$manifest->add_common_controls;
# Change name
$manifest->set_assembly_name('My.App.Name');
# Require Admin permissions
$manifest->set_execution_level('requireAdministrator');
# write it out
$exe->set_manifest($manifest);
$exe->write;
#roll your own
use Win32::Exe::Manifest
my $xml = $handmademanifest;
......
my $manifest = Win32::Exe::Manifest->new($xml, 'application');
$exe->set_manifest($manifest);
$exe->write;
#get formatted $xml
my $xml = $manifest->output;
#try merge (experimental)
my $mfest1 = $exe->get_manifest;
my $mfest2 = Win32::Exe::Manifest->new($xml, 'application');
$mfest1->merge_manifest($mfest2);
$exe->set_manifest($mfest1);
$exe->write;
#add a dependency
my $info =
{ type => 'win32',
name => 'Dependency.Prog.Id',
version => 1.0.0.0,
language => '*',
processorArchitecture => '*',
publicKeyToken => 'hjdajhahdsa7sadhaskl',
};
$manifest->add_dependency($info);
$exe->set_manifest($manifest);
$exe->write;
π DESCRIPTION π
So this module parses and manipulates application and assembly manifests β the ones used inside MS Windows executables and DLLs. It's part of the Win32::Exe distribution, so it's not out here alone, it has a whole friend group. π«Ά
π METHODS π
π§ Constructors
new
Win32::Exe::Manifest->new($xml, $type);
Make a brand new manifest instance from the manifest xml sitting in $xml. The $type param is optional and can hold 'application' (which is the default, mwah) or 'assembly'.
Manifest objects can also be created using Win32::Exe:
my $exe = Win32:::Exe->new('somefilepath');
my $manifest = $exe->get_manifest if $exe->has_manifest;
π Output
output
my $xml = $manifest->output;
Hands you back a formatted $xml string containing all the edits and changes you made using Win32::Exe::Manifest. every little thing, preserved. periodt.
πΈ Application Identity
set_assembly_name
$manifest->set_assembly_name('My.Application.Name');
Set the application or assembly name. The name should take the form of a progid and should not include any spaces. no spaces bestie, we don't do that here.
get_assembly_name
my $appname = $manifest->get_assembly_name;
Return the assembly or application name from the manifest. π¦
set_assembly_description
$manifest->set_assembly_description('My Application Description');
Set the application description. The description is an informative string β it's just here to say a little something.
get_assembly_decription
my $desc = $manifest->get_assembly_description;
Return the assembly description from the manifest. (yes the heading above is spelled decription in the original, we respect the lore π)
set_assembly_version
$manifest->set_assembly_version('1.7.8.34456');
Set the application or assembly version. The version should take the form of n.n.n.n where each n is a number between 0-65535 inclusive. yes inclusive, she's generous.
get_assembly_version
my $version = $manifest->get_assembly_version;
Return the assembly or application version from the manifest. π¦
set_assembly_language
$manifest->set_assembly_language($langid);
Set the application or assembly language. The language id is the DHTML language code. If you want to set 'language neutral' then pass '*' for the value.
see : <http://msdn.microsoft.com/en-us/library/ms533052(VS.85).aspx>
get_assembly_language
my $langid = $manifest->get_assembly_language;
Return the assembly or application language from the manifest. If there is no language id in the manifest, the method will return '*'. default queen behavior.
set_assembly_architecture
$manifest->set_assembly_architecture($arch);
Set the application or assembly architecture. Accepted values are: x86 msil ia64 amd64 *. Note the lowercase format β lowercase only, she's picky. If you want your manifest to be architecture neutral, set architecture to '*'.
get_assembly_architecture
my $arch = $manifest->get_assembly_architecture;
Return the assembly or application architecture from the manifest. ποΈ
π Trust and Security
set_execution_level
$manifest->set_execution_level($level);
Set the application execution level. Accepted values are: asInvoker, highestAvailable, requireAdministrator, none. If you pass the value 'none', any trustInfo section will be removed from the manifest entirely. gone. deleted. no trace.
See <http://msdn.microsoft.com/en-us/library/bb756929.aspx>
get_execution_level
my $level = $manifest->get_execution_level;
Return the application execution level. π‘οΈ
set_uiaccess
$manifest->set_uiaccess($needed);
Set the application uiAccess requirement in the trustInfo manifest section. Accepted values are 'true', 'false'. If no trustInfo section exists, one gets created for you with the execution level set to 'asInvoker'. she'll build it for you, so generous π
See <http://msdn.microsoft.com/en-us/library/bb756929.aspx>
get_uiaccess
my $accessneeded = $manifest->get_uiaccess;
Return the uiAccess setting from the trustInfo structure. If there's no trustInfo structure, the method returns undef. sad but honest.
π§© Application Dependencies
set_resource_id
$manifest->set_resource_id($id);
Set the resource Id for the manifest. Valid id's are 1, 2 and 3. The default is 1.
β οΈ Don't set this unless you are fully aware of the effects. fr fr, this is a "you need to know what you're doing" situation.
See <http://msdn.microsoft.com/en-us/library/aa376607(VS.85).aspx>
get_resource_id
my $id = $manifest->get_resource_id();
Return the resource Id for the manifest. π’
add_common_controls
$manifest->add_common_controls();
Add a dependency on minimum version 6.0.0.0 of the Microsoft.Windows.Common-Controls shared library. This is normally done with GUI applications so they get themed controls on Windows XP and above. cute windows era.
add_dependency
$manifest->add_dependency($info);
Add a dependency on the assembly detailed in the $info hash reference. The contents of $info should be of the form:
my $info = { type => 'win32',
name => 'Dependency.Prog.Id',
version => 1.0.0.0,
language => '*',
processorArchitecture => '*',
publicKeyToken => 'hjdajhahdsa7sadhaskl',
};
Note that the version should be the least specific that your application requires. For example, a version of '2.0.0.0' would mean the system loads the first matching assembly it finds with a version of at least '2.0.0.0'.
See: <http://msdn.microsoft.com/en-us/library/aa374219(v=VS.85).aspx>
remove_dependency
$manifest->remove_dependency($progid);
Remove a dependency with the $progid. For example, passing a $progid of 'Microsoft.Windows.Common-Controls' will remove the dependency added via 'add_common_controls' from the manifest. unfollowing the dependency, essentially. π
get_dependency
my $info = $manifest->get_dependency($progid);
Return a dependency info hash for a dependency in the manifest with the 'name' $progid. The info hash is a reference to a hash with the format:
{ type => 'win32',
name => 'Dependency.Prog.Id',
version => 1.0.0.0,
language => '*',
processorArchitecture => '*',
publicKeyToken => 'hjdajhahdsa7sadhaskl',
};
If there is no dependency with the name $progid, it returns undef. ghosted.
get_dependencies
my @deps = $manifest->get_dependencies($progid);
Return an array of hash references, one for each dependency in the manifest. Each member is a reference to a hash with the format:
{ type => 'win32',
name => 'Dependency.Prog.Id',
version => 1.0.0.0,
language => '*',
processorArchitecture => '*',
publicKeyToken => 'hjdajhahdsa7sadhaskl',
};
If there are no dependencies, it returns an empty array. the void. the silence.
π¦ Compatibility Settings
set_compatibility
$manifest->set_compatibility( ('Windows Vista') );
Set the operating system feature compatibility flags. The parameter is a list of operating systems that the application targets. In addition to the opertating system identifier keys, this method also accepts the shorthand strings 'Windows Vista' and 'Windows 7'. (yes, opertating β we don't edit the original's typo lore π)
See: <http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx>
get_compatibility
my @osids = $manifest->get_compatibility();
Returns a list of operating system identifier keys that the manifest notes as targeted operating systems. You can convert these os ids to the shorthand strings 'Windows Vista' and 'Windows 7' using the method:
my $shortstring = $manifest->get_osname_from_osid($osid);
There is a reverse method:
my $osid = $manifest->get_osid_from_osname($shortstring);
β οΈ NOTE: Don't set this unless you fully understand the effects. for real for real, this is a read-the-docs-first moment.
See: <http://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx>
set_dpiaware
$manifest->set_dpdaware( 'true' );
Set section in the manifest if the application is dpi aware. Accepts values true, false, and none. If the value 'none' is passed, the application\windowsSettings section is removed from the manifest entirely. poof.
See: <http://msdn.microsoft.com/en-us/library/ee308410(VS.85).aspx>
get_dpiaware
$manifest->set_dpdaware( 'true' );
Return the dpiAware setting from the manifest, if any. If there is no setting, the method returns undef. (and yeah, that synopsis line above is set_dpdaware in the original, keeping it exactly as-is π«Ά)
See: <http://msdn.microsoft.com/en-us/library/ee308410(VS.85).aspx>
π Manifest Information
get_manifest_type
my $type = $manifest->get_manifest_type;
Returns the manifest type ( 'application' or 'assembly' ). the vibe check of manifests. β
π SEE ALSO π
Modules that use Win32::Exe::Manifest:
Win32::Exe
π AUTHORS π
Mark Dootson <mdootson@cpan.org> β legend, icon, ate.
π COPYRIGHT & LICENSE π
Copyright 2010 by Mark Dootson <mdootson@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
and that's the whole page bestie!! πβ¨ this doc was rendered by perl v5.34.0 and the page date is 2022-08-14 β so like, go forth, manifest responsibly, and remember: don't touch set_resource_id or set_compatibility unless you fully understand the effects, no cap π«ΆπΈπ
π¦ where this page comes from
- debian bookworm: libwin32-exe-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libwin32-exe-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwin32-exe-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libwin32-exe-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libwin32-exe-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms