diff --git a/lib/FusionInventory/Agent/Task/Inventory/Generic/Screen.pm b/lib/FusionInventory/Agent/Task/Inventory/Generic/Screen.pm index 6aa698d30f..89c9a7cfab 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Generic/Screen.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Generic/Screen.pm @@ -8,7 +8,7 @@ use parent 'FusionInventory::Agent::Task::Inventory::Module'; use English qw(-no_match_vars); use MIME::Base64; use UNIVERSAL::require; - +use Data::Dumper; use File::Find; use FusionInventory::Agent::Tools; use FusionInventory::Agent::Tools::Screen; @@ -148,10 +148,15 @@ sub _getScreensFromWindows { foreach my $screen (@screens) { next unless $screen->{id}; - $screen->{edid} = getRegistryValue( - path => "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Enum/$screen->{id}/Device Parameters/EDID", + # $screen->{id} =~ s/\\/\//g; + $screen->{edid} = getNewRegistryValues( + root => "HKEY_LOCAL_MACHINE", + path => "SYSTEM/CurrentControlSet/Enum/$screen->{id}/Device Parameters", + keyName => "EDID", logger => $params{logger} ); + print("SYSTEM/CurrentControlSet/Enum/$screen->{id}/Device Parameters/EDID"); + print(Dumper($screen->{edid})); $screen->{edid} =~ s/^\s+$// if $screen->{edid}; delete $screen->{id}; $screen->{edid} or delete $screen->{edid}; diff --git a/lib/FusionInventory/Agent/Task/Inventory/Win32/AntiVirus.pm b/lib/FusionInventory/Agent/Task/Inventory/Win32/AntiVirus.pm index e96369f7c1..a3cf56d83e 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Win32/AntiVirus.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Win32/AntiVirus.pm @@ -461,7 +461,6 @@ sub _setNortonInfos { sub _getSoftwareRegistryKeys { my ($base, $values, $callback) = @_; - my %reg; if (is64bit()) { my %reg = getNewRegistryValues( root => "HKEY_LOCAL_MACHINE", diff --git a/lib/FusionInventory/Agent/Task/Inventory/Win32/License.pm b/lib/FusionInventory/Agent/Task/Inventory/Win32/License.pm index 3cdcd54164..52a47d49ce 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Win32/License.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Win32/License.pm @@ -124,7 +124,7 @@ sub _scanWmiSoftwareLicensingProducts { } sub _scanOfficeLicences { - my ($key) = @_; + my (%key) = @_; # registry data structure: # SOFTWARE/Microsoft/Office @@ -135,7 +135,7 @@ sub _scanOfficeLicences { # └── ProductID:value # └── ... - foreach my $versionKey (keys %{$key}) { + foreach my $versionKey (keys %key) { my $registrationKey = $key{$versionKey}->{Registration}; next unless $registrationKey; diff --git a/lib/FusionInventory/Agent/Tools/Win32.pm b/lib/FusionInventory/Agent/Tools/Win32.pm index 209e0dc85a..c5b6ec56a2 100644 --- a/lib/FusionInventory/Agent/Tools/Win32.pm +++ b/lib/FusionInventory/Agent/Tools/Win32.pm @@ -311,7 +311,7 @@ sub getNewRegistryValues { if ($keyType == REG_DWORD) { $newKeyValue = unpack("L", $keyValue); } else { - $keyValue =~ s/\x0$//; + $keyValue =~ s/\x00$//; $newKeyValue = decode("UTF-16LE", $keyValue); # $newKeyValue =~ s/^((?:..)*)\0\0//s; } @@ -324,10 +324,17 @@ sub getNewRegistryValues { sub getNewRegistryValue { my (%params) = @_; + my $swKey; my $keyType; my $keyValue; + my $path = $params{path}; + my $root = _getNewRegistryRoot( + root => $params{root} + ); - RegQueryValueExW($params{swKey}, encode("UTF-16LE", $params{keyName}), [], $keyType, $keyValue, 100); + RegOpenKeyExW($root, encode("UTF-16LE", $path), 0, KEY_READ, $swKey); + RegQueryValueExW($swKey, encode("UTF-16LE", $params{keyName}), [], $keyType, $keyValue, 100); + return $keyValue; $keyValue =~ s/^((?:..)*)\0\0//s; if ($keyType == REG_DWORD) {