Discussion:
[rt.cpan.org #124445] Par-Packer 'falsifies' PerlTk server() and Win32 GetOSName() and GetOSVersion() output on Windows 10
(too old to reply)
Arne via RT
2018-02-16 12:50:33 UTC
Permalink
Fri Feb 16 07:50:32 2018: Request 124445 was acted upon.
Transaction: Ticket created by adr-***@linuxtech.net
Queue: PAR-Packer
Subject: Par-Packer 'falsifies' PerlTk server() and Win32 GetOSName() and GetOSVersion() output on Windows 10
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: adr-***@linuxtech.net
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124445 >


When calling the Perl-Tk '$mw->server()' function or the Win32
'GetOSName()' and 'GetOSVersion()' funnctions on Windows 10 in a Perl
script the output is correct as expected:

$mw->server() returns 'Windows 10.0 10586 Win32'

Win32::GetOSName() returns 'Win10Business (64-bit)'

Win32::GetOSVersion() returns '100105862002561'

But when creating an exe with Par::Packer containing the above
functions and running it, the output changes to:

$mw->server() returns 'Windows 6.2 9200 Win32'

Win32::GetOSName() returns 'Win8Professional (64-bit)'

Win32::GetOSVersion() returns '6292002002561'

Please see the following perlmonks node for examples scripts and for
confirmation of the issue by at least one other Perl user:
http://www.perlmonks.org/?node_id=1209281

It looks to me like Par-Packer is somehow intercepting and 'falsifying'
the return values of these Perl functions.
Roderich Schupp via RT
2018-02-17 17:27:16 UTC
Permalink
Sat Feb 17 12:27:14 2018: Request 124445 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: Par-Packer 'falsifies' PerlTk server() and Win32 GetOSName() and GetOSVersion() output on Windows 10
Broken in: (no value)
Severity: (no value)
Owner: RSCHUPP
Requestors: adr-***@linuxtech.net
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124445 >
Post by Arne via RT
It looks to me like Par-Packer is somehow intercepting and 'falsifying'
the return values of these Perl functions.
Nope, PAR::Packer doesn't intercept and falsify anything.
I have a theory what's causing this (see below), but first, for the record:

- what version of Module::ScanDeps, PAR and PAR::Packer are you using?
- what version of Perl and what distro (Strawberry, ActiveState etc)?
- and most important: did you build PAR::Packer yourself or got it from somwhere?

Now for the theory: the bug report https://rt.cpan.org/Public/Bug/Display.html?id=90807
has some links to Microsoft docs which further link to
https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx

The key why this may be relevant is that an executable packed by PAR::Packer
contains a custom version of the Perl interpreter, i.e. not the original perl.exe.
It's this interpreter that runs your script and all the packed modules.
According to the above docs, unless an executable was build with a special entry
in its manifest file, the function GetVersionExA (which is used by the Perl module Win32)
will always report that you're running Windows 8 while in fact you may be running
a higher version of Windows. I checked that perl/bin/perl.exe from
strawberry-perl-5.26.1.1-64bit has indeed been built with this magic incantation
in its manifest, but the custom Perl interpreter build by PAR::Packer is
missing it.

It will take me a few days to procure a Windows 10 machine, would you be willing to
build PAR::Packer yourself with a tentative fix?

Cheers, Roderich
Arne via RT
2018-02-18 13:27:38 UTC
Permalink
Sun Feb 18 08:27:37 2018: Request 124445 was acted upon.
Transaction: Correspondence added by adr-***@linuxtech.net
Queue: PAR-Packer
Subject: Re: [rt.cpan.org #124445] Par-Packer 'falsifies' PerlTk server() and Win32 GetOSName() and GetOSVersion() output on Windows 10
Broken in: (no value)
Severity: (no value)
Owner: RSCHUPP
Requestors: adr-***@linuxtech.net
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124445 >



Hi, thanks for looking into this.
Post by Roderich Schupp via RT
- what version of Module::ScanDeps, PAR and PAR::Packer are you using?
Module::ScanDeps 1.24
PAR 1.014
PAR::Packer 1.041
Post by Roderich Schupp via RT
- what version of Perl and what distro (Strawberry, ActiveState etc)?
Strawberry 5.24.1.1
Post by Roderich Schupp via RT
- and most important: did you build PAR::Packer yourself or got it
from somwhere?
installed it with cpan
Post by Roderich Schupp via RT
I checked that perl/bin/perl.exe from strawberry-perl-5.26.1.1-64bit
has indeed been built with this magic incantation in its manifest, but
the custom Perl interpreter build by PAR::Packer is missing it.
I think you are right, I came to a similar conclusion and therefore
tried adding the <compatibility> section of the manifest file from MSDN
to the myldr/winres/pp.manifest file in the PAR-Packer-1.041 source, and
then rebuilt and reinstalled PAR-Packer from the modified source.

With this change, PAR-Packer displays the Windows version info correctly
(tested on Win 10 and 8.1).

Please also see the following node on perlmonks where I quoted exactly
what I added: http://www.perlmonks.org/?node_id=1209323
Post by Roderich Schupp via RT
It will take me a few days to procure a Windows 10 machine, would you be willing to
build PAR::Packer yourself with a tentative fix?
No problem, in case your fix differs from what I already tried (as
described above) I can certainly try it.
Roderich Schupp via RT
2018-02-18 17:55:07 UTC
Permalink
Sun Feb 18 12:55:06 2018: Request 124445 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: Par-Packer 'falsifies' PerlTk server() and Win32 GetOSName() and GetOSVersion() output on Windows 10
Broken in: (no value)
Severity: (no value)
Owner: RSCHUPP
Requestors: adr-***@linuxtech.net
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124445 >
Post by Arne via RT
I think you are right, I came to a similar conclusion and therefore
tried adding the <compatibility> section of the manifest file from
MSDN
to the myldr/winres/pp.manifest file in the PAR-Packer-1.041 source,
and
then rebuilt and reinstalled PAR-Packer from the modified source.
With this change, PAR-Packer displays the Windows version info
correctly
(tested on Win 10 and 8.1).
That coincides with my solution. This fix will be in the next release of PAR::Packer.
Thanks for testing and confirmation!

Cheers, Roderich

Loading...