Skip to content

Commit

Permalink
fix: Fix error on win32 video inventory during remoteinventory
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Dec 4, 2024
1 parent cf0a5e4 commit 55a7cf9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/GLPI/Agent/Task/Inventory/Win32/Videos.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,18 @@ sub _getVideos {
or next;
next unless $thispnpdeviceid eq $pnpdeviceid;
if (defined($videokey->{$subkey}->{"/HardwareInformation.qwMemorySize"})) {
my $memorysize = unpack("Q", $videokey->{$subkey}->{"/HardwareInformation.qwMemorySize"});
$video->{MEMORY} = $memorysize if $memorysize > 0;
my $memorysize = $videokey->{$subkey}->{"/HardwareInformation.qwMemorySize"} =~ /^\d+$/ ?
int($videokey->{$subkey}->{"/HardwareInformation.qwMemorySize"})
: unpack("Q", $videokey->{$subkey}->{"/HardwareInformation.qwMemorySize"});
$video->{MEMORY} = $memorysize if $memorysize && $memorysize > 0;
last;
} elsif (defined($videokey->{$subkey}->{"/HardwareInformation.MemorySize"})) {
my $memorysize = $videokey->{$subkey}->{"/HardwareInformation.MemorySize"} =~ /^0x/ ?
hex2dec($videokey->{$subkey}->{"/HardwareInformation.MemorySize"})
: $videokey->{$subkey}->{"/HardwareInformation.MemorySize"} =~ /^\d+$/ ?
int($videokey->{$subkey}->{"/HardwareInformation.MemorySize"})
: unpack("L", $videokey->{$subkey}->{"/HardwareInformation.MemorySize"});
$video->{MEMORY} = $memorysize if $memorysize > 0;
$video->{MEMORY} = $memorysize if $memorysize && $memorysize > 0;
last;
}
}
Expand Down

0 comments on commit 55a7cf9

Please sign in to comment.