Re: filever.exe sub?
On 2/1/19 6:24 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 4:26 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how windows things work internally (though of course they only reverse-engineered how windows things work, so there's often still differences in the exact behaviour). Here's their implementation of the version info code: https://source.winehq.org/git/wine.git/blob/908903b7f105c62061d62959fd8d8c866095dcdc:/dlls/version/info.c and the corresponding header file (i think?) https://source.winehq.org/git/wine.git/blob/c84b7d33dd18651057a80f609e11f809cc7f4bd0:/include/winver.h Normally I'd just say "good luck and have fun!", but that whole file is very big and doesn't seem very self-explanatory at all. I don't have time right now to go through it, but if you want to give understanding it a try, here's a link to wine's "cross-referenced source browser" thingie where most keywords are clickable so you can directly find other header files, or where and how symbols/types that are used in the code are defined: https://source.winehq.org/source/dlls/version/version.c Sorry for not giving a super simple solution. Perhaps there's something on the net for "PE metadata parser" or "PE file parser" or whatever. Hope that gets you closer to your goal! - Timo I am hopeless when it comes to C. I am still trying to figure out where the information is located in the exe Figured out one of my problems. Oe of the test exe I was using did not have a revision. If it has a revision, it will have the following: 001500E0 36 00 0B 00 01 00 46 00 69 00 6C 00 65 00 56 00 6.F.i.l.e.V. 001500F0 65 00 72 00 73 00 69 00 6F 00 6E 00 00 00 00 00 e.r.s.i.o.n. 00150100 37 00 2E 00 30 00 2E 00 38 00 30 00 30 00 2E 00 7...0...8.0.0... 00150110 31 00 35 00 00 00 00 00 3A 00 0D 00 01 00 46 00 1.5.:.F. 00 The revision is 7.0.800.15 Question: What is the best way to test for a series of bytes is a Buf? I want to find 46 00 69 00 6C 00 65 00 56 00 65 00 72 00 73 00 69 00 6F 00 6E The terminator is OD in the forth line. So I want everything after the above test up to OD
Re: filever.exe sub?
On 2/1/19 4:26 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how windows things work internally (though of course they only reverse-engineered how windows things work, so there's often still differences in the exact behaviour). Here's their implementation of the version info code: https://source.winehq.org/git/wine.git/blob/908903b7f105c62061d62959fd8d8c866095dcdc:/dlls/version/info.c and the corresponding header file (i think?) https://source.winehq.org/git/wine.git/blob/c84b7d33dd18651057a80f609e11f809cc7f4bd0:/include/winver.h Normally I'd just say "good luck and have fun!", but that whole file is very big and doesn't seem very self-explanatory at all. I don't have time right now to go through it, but if you want to give understanding it a try, here's a link to wine's "cross-referenced source browser" thingie where most keywords are clickable so you can directly find other header files, or where and how symbols/types that are used in the code are defined: https://source.winehq.org/source/dlls/version/version.c Sorry for not giving a super simple solution. Perhaps there's something on the net for "PE metadata parser" or "PE file parser" or whatever. Hope that gets you closer to your goal! - Timo I am hopeless when it comes to C. I am still trying to figure out where the information is located in the exe Figured out one of my problems. Oe of the test exe I was using did not have a revision. If it has a revision, it will have the following: 001500E0 36 00 0B 00 01 00 46 00 69 00 6C 00 65 00 56 00 6.F.i.l.e.V. 001500F0 65 00 72 00 73 00 69 00 6F 00 6E 00 00 00 00 00 e.r.s.i.o.n. 00150100 37 00 2E 00 30 00 2E 00 38 00 30 00 30 00 2E 00 7...0...8.0.0... 00150110 31 00 35 00 00 00 00 00 3A 00 0D 00 01 00 46 00 1.5.:.F. 00 The revision is 7.0.800.15 Question: What is the best way to test for a series of bytes is a Buf? I want to find 46 00 69 00 6C 00 65 00 56 00 65 00 72 00 73 00 69 00 6F 00 6E
Re: filever.exe sub?
On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how windows things work internally (though of course they only reverse-engineered how windows things work, so there's often still differences in the exact behaviour). Here's their implementation of the version info code: https://source.winehq.org/git/wine.git/blob/908903b7f105c62061d62959fd8d8c866095dcdc:/dlls/version/info.c and the corresponding header file (i think?) https://source.winehq.org/git/wine.git/blob/c84b7d33dd18651057a80f609e11f809cc7f4bd0:/include/winver.h Normally I'd just say "good luck and have fun!", but that whole file is very big and doesn't seem very self-explanatory at all. I don't have time right now to go through it, but if you want to give understanding it a try, here's a link to wine's "cross-referenced source browser" thingie where most keywords are clickable so you can directly find other header files, or where and how symbols/types that are used in the code are defined: https://source.winehq.org/source/dlls/version/version.c Sorry for not giving a super simple solution. Perhaps there's something on the net for "PE metadata parser" or "PE file parser" or whatever. Hope that gets you closer to your goal! - Timo I am hopeless when it comes to C. I am still trying to figure out where the information is located in the exe -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: filever.exe sub?
On 01/02/2019 01:33, Bruce Gray wrote: > To call those Windows APIs in Perl 6, you would use NativeCall. > Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how windows things work internally (though of course they only reverse-engineered how windows things work, so there's often still differences in the exact behaviour). Here's their implementation of the version info code: https://source.winehq.org/git/wine.git/blob/908903b7f105c62061d62959fd8d8c866095dcdc:/dlls/version/info.c and the corresponding header file (i think?) https://source.winehq.org/git/wine.git/blob/c84b7d33dd18651057a80f609e11f809cc7f4bd0:/include/winver.h Normally I'd just say "good luck and have fun!", but that whole file is very big and doesn't seem very self-explanatory at all. I don't have time right now to go through it, but if you want to give understanding it a try, here's a link to wine's "cross-referenced source browser" thingie where most keywords are clickable so you can directly find other header files, or where and how symbols/types that are used in the code are defined: https://source.winehq.org/source/dlls/version/version.c Sorry for not giving a super simple solution. Perhaps there's something on the net for "PE metadata parser" or "PE file parser" or whatever. Hope that gets you closer to your goal! - Timo
Re: filever.exe sub?
> On Jan 31, 2019, at 12:46 PM, ToddAndMargo via perl6-users > wrote: > > On 1/29/19 9:53 PM, ToddAndMargo via perl6-users wrote: >> Hi All, >> Windows provides a utility called filever.exe which will >> tell you the revision of and exe file. (You can also see this >> through the gui with properties). >> Currently I run filever.exe through Wine. It is cumbersome, >> especially since Wine floods STDERR. I work around it. >> Do we have a module for the file's version? If so, does >> it run in Linux? >> If not, does anyone know where the version information is >> stored in and .exe file so I can write one myself? >> Many thanks, >> -T > > > Well, I learned it is called "metadata". And that > Perl 5 has a module for it, but I can not figure out > from where they are reading the metadata: > > https://metacpan.org/pod/release/ALEXEYT/Win32-File-Ver-0.02/Ver.pm The Ver.pm module loads Ver.xs (pre-compiled during module installation), so the real work is done in Perl 5’s “XS” language, which is a fusion of “C” language and Perl-specific macros. https://st.aticpan.org/source/ALEXEYT/Win32-File-Ver-0.02/Ver.xs Calls: 1. GetFileVersionInfoSize() to get the max size of the memory block (VS_VERSIONINFO) needed by GetFileVersionInfo(). 2. malloc() to allocate that memory block. 3. GetFileVersionInfo() to populate VS_VERSIONINFO with the version info. 4. VerQueryValue to read into the VS_VERSIONINFO block, to get the root pointer. After that, there is basic bit-twiddling to sprintf() the FileVersion and ProductVersion into human-readable format, and store them in the hash that is returned up into Perl. Hopefully you don't need anything more that those two values; I see that just after them, the source code says: /* Brace thyselves */ To call those Windows APIs in Perl 6, you would use NativeCall. -- Hope this helps, Bruce Gray (Util of PerlMonks)
Re: filever.exe sub?
On 1/29/19 9:53 PM, ToddAndMargo via perl6-users wrote: Hi All, Windows provides a utility called filever.exe which will tell you the revision of and exe file. (You can also see this through the gui with properties). Currently I run filever.exe through Wine. It is cumbersome, especially since Wine floods STDERR. I work around it. Do we have a module for the file's version? If so, does it run in Linux? If not, does anyone know where the version information is stored in and .exe file so I can write one myself? Many thanks, -T Well, I learned it is called "metadata". And that Perl 5 has a module for it, but I can not figure out from where they are reading the metadata: https://metacpan.org/pod/release/ALEXEYT/Win32-File-Ver-0.02/Ver.pm
Re: filever.exe sub?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 A quick search yields me the program `pev`: http://pev.sourceforge.net/doc/manual/en_us/ Maybe this can help you out. If it performs the tasks you need it to perform, you could browse the source code and rewrite it into a Perl 6 project :) On Tue, 29 Jan 2019 21:57:28 -0800 ToddAndMargo via perl6-users wrote: > On 1/29/19 9:53 PM, ToddAndMargo via perl6-users wrote: > > Hi All, > > > > Windows provides a utility called filever.exe which will > > tell you the revision of and exe file. (You can also see this > > through the gui with properties). > > > > Currently I run filever.exe through Wine. It is cumbersome, > > especially since Wine floods STDERR. I work around it. > > > > Do we have a module for the file's version? If so, does > > it run in Linux? > > > > If not, does anyone know where the version information is > > stored in and .exe file so I can write one myself? > > > > Many thanks, > > -T > > Sorry. I keep using "and" instead of "an". Stinkin' typos. -BEGIN PGP SIGNATURE- iQEzBAEBCgAdFiEEtvaXdC78r18jzlHVAx1lkC6ECCEFAlxRuQMACgkQAx1lkC6E CCFC0gf/T4if9Gt3YUcTLWDobaWlvo6ewwsxcXJQlD7u8O46ImcAlVSyJRBjAkkN 5Lbatc/UleyzIk3qJmWSCgJyzEV0ZgakdcBAtumB9mrxZrg0cPWBNblDDo+pnSJA qjpkB690KqlUNuZmBhfp/Xh6E2wWi7PhoDWlYtrJ/1j+AF8iGonuV1/93cXXw1fO MCs+S9Rn41hb4SqTJShaELLxzR39UmdE3/f0istOFOq3bsaE/WOxxJ4ovccuIEJw /xdS7tOLHMQoTSQTH/xjx7BdyUmCTfspsEmqqfoh2NgD+IOuo4lt3Ns3INPFfNfO 4EwZc2IgWaFrJPe1lf2Hmag/0pPoyg== =TCki -END PGP SIGNATURE-
filever.exe sub?
Hi All, Windows provides a utility called filever.exe which will tell you the revision of and exe file. (You can also see this through the gui with properties). Currently I run filever.exe through Wine. It is cumbersome, especially since Wine floods STDERR. I work around it. Do we have a module for the file's version? If so, does it run in Linux? If not, does anyone know where the version information is stored in and .exe file so I can write one myself? Many thanks, -T