-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.pl
49 lines (39 loc) · 1.04 KB
/
test.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use strict;
use Win32::GUI;
use Win32API::File qw(:ALL);
use Config::IniFiles;
my $IniFile = "u3-autorun.ini";
sub ScanForGoodDrives{
my $good_drives = [];
foreach my $drive (getLogicalDrives()){
my $uDriveType = GetDriveType( $drive );
next if ($uDriveType != DRIVE_REMOVABLE);
my $uOldMode= SetErrorMode( SEM_FAILCRITICALERRORS );
push @{$good_drives},$drive if (-e $drive);
SetErrorMode($uOldMode);
}
return $good_drives;
}
sub GetExeFileName{
my ( $drive,$IniFile ) = @_;
my $file = $drive . $IniFile;
my $cfg = Config::IniFiles->new( -file=>$file );
my $exefile = $cfg->val("u3-autorun","exefile");
return $exefile;
}
my $drives = ScanForGoodDrives();
foreach my $drive (@{$drives}){
my $exefile = $drive . GetExeFileName( $drive,$IniFile );
system(1,$exefile);
}
my $main = Win32::GUI::Window->new(
-name => 'Main',
-width => 100,
-height => 100,
);
$main->AddLabel(-text => "Hello, world");
#$main->Show();
#Win32::GUI::Dialog();
sub Main_Terminate {
-1;
}