NAME

Win32::File::Ver - file version information on Win32


SYNOPSIS

  use Win32::File::Ver qw(ver print_ansi convert_raw_ver);   $file = "c:\\windows\\system\\wininet.dll"; 

  $ver = ver($file);   print_ansi($file); 

  print "Calculated FileVersion: ".      convert_raw_ver( $ver->{RawVersionInfo}[0], $ver->{RawVersionInfo}[1] )."\n";   print "Calculated ProductVersion: ".      convert_raw_ver( $ver->{RawVersionInfo}[2], $ver->{RawVersionInfo}[3] )."\n"; 


ABSTRACT

File version, description, copyright, company name, product name, version, OS, file type retrieved from the version-information resource.

The current version of Win32::File::Ver is available at:

  http://www.dux.ru/guest/fno/perl/ 


DESCRIPTION

This module is a collection of subroutines. None of them are exported by default.

ver ( )
 $version = ver( $file_path ); 

This function returns a hash ref or undef on errors. The keys of the %$version hash are:

 CompanyName      \   FileDescription  |   InternalName     | The ame values as you see in the windows explorer  LegalCopyright   | property sheet  OriginalFilename |   ProductName      /   FileOS           - one of the following values:          UNKNOWN, WINDOWS32, NT, NT_WINDOWS32, WINDOWS16,           DOS, DOS_WINDOWS16, DOS_WINDOWS32,          OS216, OS232, PM16, PM32, OS216_PM16, OS232_PM32          Specifies the operating system for which this file was designed. 

         For example "NT_WINDOWS32" means that file was designed for the          Win32 API running on Windows NT, "OS232_PM32" means          OS/2-32 with PM-32 etc.                       FileType         - one of the following values:         UNKNOWN, APP, DLL, DRV, FONT, VXD, STATIC_LIB         Probably the correctness is not guaranteed. 

 FileSubtype      - if FileType is DRV one of the following         UNKNOWN, PRINTER, KEYBOARD, LANGUAGE, DISPLAY, MOUSE,         NETWORK, SYSTEM, INSTALLABLE, SOUND, COMM, INPUTMETHOD         if FileType is FONT         UNKNOWN, RASTER, VECTOR, or TRUETYPE         if FileType is VXD FileSubtype contains the virtual device         identifier included in the virtual device control block   . 

 FileVersion      - the same as in the Properties sheet, free format,                     anything including "1,0,0,1" etc. 

 ProductVersion   - the same for the product version 

 RawVersionInfo   - referer to array that contains raw digital                     version info, kinda "real version". 

    Elements of this array are:       $dwFileVersionMS, $dwFileVersionLS,       $dwProductVersionMS, $dwProductVersionLS,       $dwFileFlagsMask, $dwFileFlags, $dwFileOS,       $dwFileType,  $dwFileSubtype,       $dwFileDateMS, $dwFileDateLS 

    All values are 32-bit digital.     For more info look at the Win32 SDK - VS_FIXEDFILEINFO structure.     You can convert raw file and product versions to the "Microsoft     version style" - how I understood it ;) - with the     convert_raw_ver() function 

 Flags            - referer to array that contains none, one or more of the                     following values:     DEBUG, PRERELEASE, PATCHED, PRIVATEBUILD, INFOINFERRED, SPECIALBUILD   версия для печати 

convert_raw_ver ( )
This function takes 2 32-bit numbers that represent the 64-bit number. The first argument contains the most significant 32 bits, the last argument - the least significant 32 bits of the file's binary version number.

  $microsoft_style_string = convert_raw_ver( $versionMS, $versionLS ); 

OK. What's ``M$ style''? 64 bits are splited to 4 16-bit numbers. Each of them is converted to decimal number. If the 3rd of these 4 numbers is zero, the third part is omitted. The 1st and the 4th parts are at least 1 digit long, the second one - at least 2 digits long (with zero-padding).

Look into the code for (not much) more.

print_ansi ( )
This is the simple way to print file info.

 perl -MWin32::File::Ver=print_ansi -e print_ansi filename 

If called within the program this function requires one argument

 print_ansi($file_path); 

The Flags data are being printed if there is at least one element in @{$ver->{Flags}} array.

print_oem ( )
The same as print_ansi() but the output is converted into the OEM-defined character set. (OEM stands for original equipment manufacturer.)

This function is handy to print to MS DOS console on localized machines.


INSTALLATION

As this is just a plain module no special installation is needed. Put it into the Win32/File subdirectory somewhere in your @INC.

This module requires:

Win32::API module by Aldo Calpini.

enum.pm (1.014 or later, no compilations) by Byron Brummer (aka Zenin)


CAVEATS

This module has been created and tested in a Win95 environment. Although I expect it to function correctly on Windows NT, that fact has not been confirmed.


CHANGES

 0.02 One small fix that solves the problem with more then 8 bytes long       lang_charset  


TODO

Any suggestions are much appreciated.


BUGS

Please report.


VERSION

This man page documents ``Win32::File::Ver'' version 0.02.

Septemer 8, 1999.


CREDITS

Thanks to Aldo for the nice tip and great Win32::API module.

Thanks to Brad Turner for poining out one problem in v.0.01


AUTHOR

Mike Blazer, blazer@mail.nevalink.ru

http://www.dux.ru/guest/fno/perl/


SEE ALSO

perl


COPYRIGHT

Copyright (C) 1999 Mike Blazer.

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.