Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddurieux committed Feb 27, 2023
1 parent 202b025 commit 627d329
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
11 changes: 8 additions & 3 deletions lib/FusionInventory/Agent/Task/Inventory/Generic/Screen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ sub _setNortonInfos {
sub _getSoftwareRegistryKeys {
my ($base, $values, $callback) = @_;

my %reg;
if (is64bit()) {
my %reg = getNewRegistryValues(
root => "HKEY_LOCAL_MACHINE",
Expand Down
4 changes: 2 additions & 2 deletions lib/FusionInventory/Agent/Task/Inventory/Win32/License.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ sub _scanWmiSoftwareLicensingProducts {
}

sub _scanOfficeLicences {
my ($key) = @_;
my (%key) = @_;

# registry data structure:
# SOFTWARE/Microsoft/Office
Expand All @@ -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;

Expand Down
11 changes: 9 additions & 2 deletions lib/FusionInventory/Agent/Tools/Win32.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down

0 comments on commit 627d329

Please sign in to comment.