LNK.pm (Image-ExifTool-12.57) | : | LNK.pm (Image-ExifTool-12.58) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
# References: 1) http://msdn.microsoft.com/en-us/library/dd871305(PROT.10).asp x | # References: 1) http://msdn.microsoft.com/en-us/library/dd871305(PROT.10).asp x | |||
# 2) http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Forma t.pdf | # 2) http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Forma t.pdf | |||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | |||
package Image::ExifTool::LNK; | package Image::ExifTool::LNK; | |||
use strict; | use strict; | |||
use vars qw($VERSION); | use vars qw($VERSION); | |||
use Image::ExifTool qw(:DataAccess :Utils); | use Image::ExifTool qw(:DataAccess :Utils); | |||
$VERSION = '1.08'; | $VERSION = '1.09'; | |||
sub ProcessItemID($$$); | sub ProcessItemID($$$); | |||
sub ProcessLinkInfo($$$); | sub ProcessLinkInfo($$$); | |||
# Information extracted from LNK (Windows Shortcut) files | # Information extracted from LNK (Windows Shortcut) files | |||
%Image::ExifTool::LNK::Main = ( | %Image::ExifTool::LNK::Main = ( | |||
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | |||
GROUPS => { 2 => 'Other' }, | GROUPS => { 2 => 'Other' }, | |||
VARS => { HEX_ID => 1 }, # print hex ID's in documentation | VARS => { HEX_ID => 1 }, # print hex ID's in documentation | |||
NOTES => 'Information extracted from MS Shell Link (Windows shortcut) files. ', | NOTES => 'Information extracted from MS Shell Link (Windows shortcut) files. ', | |||
skipping to change at line 510 | skipping to change at line 510 | |||
my %opts = ( | my %opts = ( | |||
DataPt => $dataPt, | DataPt => $dataPt, | |||
DataPos => $$dirInfo{DataPos}, | DataPos => $$dirInfo{DataPos}, | |||
Size => 4, # (typical value size) | Size => 4, # (typical value size) | |||
); | ); | |||
my ($off, $unicode, $pos, $val, $size); | my ($off, $unicode, $pos, $val, $size); | |||
$et->VerboseDir('LinkInfo', undef, $dataLen); | $et->VerboseDir('LinkInfo', undef, $dataLen); | |||
if ($lif & 0x01) { | if ($lif & 0x01) { | |||
# read Volume ID | # read Volume ID | |||
$off = Get32u($dataPt, 0x0c); | $off = Get32u($dataPt, 0x0c); | |||
if ($off + 0x20 <= $dataLen) { | if ($off and $off + 0x20 <= $dataLen) { | |||
# my $len = Get32u($dataPt, $off); | # my $len = Get32u($dataPt, $off); | |||
$et->HandleTag($tagTablePtr, 'DriveType', undef, %opts, Start=>$off+ 4); | $et->HandleTag($tagTablePtr, 'DriveType', undef, %opts, Start=>$off+ 4); | |||
$et->HandleTag($tagTablePtr, 'DriveSerialNumber', undef, %opts, Star t=>$off+8); | $et->HandleTag($tagTablePtr, 'DriveSerialNumber', undef, %opts, Star t=>$off+8); | |||
$pos = Get32u($dataPt, $off + 0x0c); | $pos = Get32u($dataPt, $off + 0x0c); | |||
if ($pos == 0x14) { | if ($pos == 0x14) { | |||
# use VolumeLabelOffsetUnicode instead | # use VolumeLabelOffsetUnicode instead | |||
$pos = Get32u($dataPt, $off + 0x10); | $pos = Get32u($dataPt, $off + 0x10); | |||
$unicode = 1; | $unicode = 1; | |||
} | } | |||
$pos += $off; | $pos += $off; | |||
skipping to change at line 548 | skipping to change at line 548 | |||
$size = length $val; | $size = length $val; | |||
$val = $et->Decode($val, 'UCS2') if $unicode; | $val = $et->Decode($val, 'UCS2') if $unicode; | |||
$et->HandleTag($tagTablePtr, 'LocalBasePath', $val, %opts, Start=>$p os, Size=>$size); | $et->HandleTag($tagTablePtr, 'LocalBasePath', $val, %opts, Start=>$p os, Size=>$size); | |||
} | } | |||
} | } | |||
if ($lif & 0x02) { | if ($lif & 0x02) { | |||
# read common network relative link | # read common network relative link | |||
$off = Get32u($dataPt, 0x14); | $off = Get32u($dataPt, 0x14); | |||
if ($off and $off + 0x14 <= $dataLen) { | if ($off and $off + 0x14 <= $dataLen) { | |||
my $siz = Get32u($dataPt, $off); | my $siz = Get32u($dataPt, $off); | |||
return 0 if $off + $siz > $dataLen; | ||||
$pos = Get32u($dataPt, $off + 0x08); | $pos = Get32u($dataPt, $off + 0x08); | |||
if ($pos > 0x14 and $siz >= 0x18) { | if ($pos > 0x14 and $siz >= 0x18) { | |||
$pos = Get32u($dataPt, $off + 0x14); | $pos = Get32u($dataPt, $off + 0x14); | |||
$unicode = 1; | $unicode = 1; | |||
} else { | } else { | |||
undef $unicode; | undef $unicode; | |||
} | } | |||
$val = GetString($dataPt, $pos, $unicode); | $val = GetString($dataPt, $off + $pos, $unicode); | |||
if (defined $val) { | if (defined $val) { | |||
$size = length $val; | $size = length $val; | |||
$val = $et->Decode($val, 'UCS2') if $unicode; | $val = $et->Decode($val, 'UCS2') if $unicode; | |||
$et->HandleTag($tagTablePtr, 'NetName', $val, %opts, Start=>$pos , Size=>$size); | $et->HandleTag($tagTablePtr, 'NetName', $val, %opts, Start=>$pos , Size=>$size); | |||
} | } | |||
my $flg = Get32u($dataPt, $off + 0x04); | my $flg = Get32u($dataPt, $off + 0x04); | |||
if ($flg & 0x01) { | if ($flg & 0x01) { | |||
$pos = Get32u($dataPt, $off + 0x0c); | $pos = Get32u($dataPt, $off + 0x0c); | |||
if ($pos > 0x14 and $siz >= 0x1c) { | if ($pos > 0x14 and $siz >= 0x1c) { | |||
$pos = Get32u($dataPt, $off + 0x18); | $pos = Get32u($dataPt, $off + 0x18); | |||
$unicode = 1; | $unicode = 1; | |||
} else { | } else { | |||
undef $unicode; | undef $unicode; | |||
} | } | |||
$val = GetString($dataPt, $pos, $unicode); | $val = GetString($dataPt, $off + $pos, $unicode); | |||
if (defined $val) { | if (defined $val) { | |||
$size = length $val; | $size = length $val; | |||
$val = $et->Decode($val, 'UCS2') if $unicode; | $val = $et->Decode($val, 'UCS2') if $unicode; | |||
$et->HandleTag($tagTablePtr, 'DeviceName', $val, %opts, Star t=>$pos, Size=>$size); | $et->HandleTag($tagTablePtr, 'DeviceName', $val, %opts, Star t=>$pos, Size=>$size); | |||
} | } | |||
} | } | |||
if ($flg & 0x02) { | if ($flg & 0x02) { | |||
$val = Get32u($dataPt, $off + 0x10); | $val = Get32u($dataPt, $off + 0x10); | |||
$et->HandleTag($tagTablePtr, 'NetProviderType', $val, %opts, Sta rt=>$off + 0x10); | $et->HandleTag($tagTablePtr, 'NetProviderType', $val, %opts, Sta rt=>$off + 0x10); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |