burak / CPAN-Sys-Info-Driver-Windows

Windows driver for Sys::Info (Perl)

commit 20: 5f44567f0948
parent 19: a2acd6622534
branch: default
implement bitness()
Burak Gursoy
12 months ago

Changed (Δ453 bytes):

raw changeset »

Changes (3 lines added, 0 lines removed)

PREREQ (2 lines added, 2 lines removed)

Windows.xs (20 lines added, 22 lines removed)

lib/Sys/Info/Driver/Windows.pm (1 lines added, 1 lines removed)

lib/Sys/Info/Driver/Windows/Device/CPU.pm (11 lines added, 0 lines removed)

lib/Sys/Info/Driver/Windows/OS.pm (3 lines added, 2 lines removed)

Up to file-list Changes:

@@ -2,6 +2,9 @@ Revision history for Perl extension Sys:
2
2
3
3
Time zone is GMT+2.
4
4
5
0.69_11 Sat Apr  4 06:04:21 2009
6
    => Implement os->bitness cpu->bitness.
7
5
8
0.69_10 Fri Apr  3 22:21:51 2009
6
9
    => Update test suite.
7
10

Up to file-list PREREQ:

@@ -11,8 +11,8 @@ use vars qw(%PREREQ %RECOMMEND %BUILD_RE
11
11
12
12
%PREREQ = (
13
13
   'IO::File'                   => 0,
14
   'Sys::Info::Base'            => '0.69_10',
15
   'Sys::Info::Driver::Unknown' => '0.69_10',
14
   'Sys::Info::Base'            => '0.69_11',
15
   'Sys::Info::Driver::Unknown' => '0.69_11',
16
16
   'ExtUtils::CBuilder'         => 0,
17
17
   'Win32::OLE'                 => 0,
18
18
);

Up to file-list Windows.xs:

@@ -22,7 +22,6 @@ CODE:
22
22
OUTPUT:
23
23
    RETVAL
24
24
25
26
25
void
27
26
GetSystemInfo()
28
27
PREINIT:
@@ -38,8 +37,8 @@ PREINIT:
38
37
    TCHAR           wProcessorModel         [10];
39
38
    TCHAR           wProcessorStepping      [10];
40
39
    TCHAR           wProcessorArchitecture2 [64];
41
    unsigned int    process_bitness;
42
    unsigned int    cpu_bitness;
40
    unsigned int    wProcessBitness;
41
    unsigned int    wProcessorBitness;
43
42
PPCODE:
44
43
    /*
45
44
        See:
@@ -57,8 +56,8 @@ PPCODE:
57
56
                        "GetNativeSystemInfo"
58
57
                    );
59
58
60
    process_bitness = 0;
61
    cpu_bitness     = 0;
59
    wProcessBitness = 0;
60
    wProcessorBitness     = 0;
62
61
    bIsWow = FALSE;
63
62
64
63
    (NULL != pGNSI) ? pGNSI(&si) : GetSystemInfo(&si);
@@ -72,24 +71,24 @@ PPCODE:
72
71
                lstrcpy(  wProcessorArchitecture2, TEXT("Alpha"));
73
72
                wsprintf( wProcessorModel        , TEXT("%d"), HIBYTE(si.wProcessorRevision) );
74
73
                wsprintf( wProcessorStepping     , TEXT("%d"), LOBYTE(si.wProcessorRevision) );
75
                process_bitness = 64;
76
                cpu_bitness     = 64;
74
                wProcessBitness = 64;
75
                wProcessorBitness     = 64;
77
76
                break;
78
77
79
78
            case PROCESSOR_ARCHITECTURE_IA64:
80
79
                lstrcpy(  wProcessorArchitecture2, TEXT("IA-64"));
81
80
                wsprintf( wProcessorModel        , TEXT("%d"), HIBYTE(si.wProcessorRevision) );
82
81
                wsprintf( wProcessorStepping     , TEXT("%d"), LOBYTE(si.wProcessorRevision) );
83
                process_bitness = 64;
84
                cpu_bitness     = 64;
82
                wProcessBitness = 64;
83
                wProcessorBitness     = 64;
85
84
                break;
86
85
87
86
            case PROCESSOR_ARCHITECTURE_ALPHA64:
88
87
                lstrcpy(wProcessorArchitecture2  , TEXT("Alpha64"));
89
88
                wsprintf( wProcessorModel        , TEXT("%d"), HIBYTE(si.wProcessorRevision) );
90
89
                wsprintf( wProcessorStepping     , TEXT("%d"), LOBYTE(si.wProcessorRevision) );
91
                process_bitness = 64;
92
                cpu_bitness     = 64;
90
                wProcessBitness = 64;
91
                wProcessorBitness     = 64;
93
92
                break;
94
93
95
94
            case PROCESSOR_ARCHITECTURE_INTEL:
@@ -109,21 +108,21 @@ PPCODE:
109
108
                        if (bIsWow) {
110
109
                            pGNSI(&si2);
111
110
                            if (si2.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) {
112
                                process_bitness = 32;
113
                                cpu_bitness     = 64;
111
                                wProcessBitness = 32;
112
                                wProcessorBitness     = 64;
114
113
                                //printf("32 bit process on IA64");
115
114
                            } else if (si2.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
116
                                process_bitness = 32;
117
                                cpu_bitness     = 64;
115
                                wProcessBitness = 32;
116
                                wProcessorBitness     = 64;
118
117
                                //printf("32 bit process on AMD64");
119
118
                            } else {
120
119
                                //printf("I am running in the future!");
121
120
                            }
122
121
                        } else {
123
                            cpu_bitness     = (si.wProcessorLevel == 6 && si.wProcessorRevision >= 14)
122
                            wProcessorBitness     = (si.wProcessorLevel == 6 && si.wProcessorRevision >= 14)
124
123
                                            ? 64 // Core2
125
124
                                            : 32;
126
                            process_bitness = 32;
125
                            wProcessBitness = 32;
127
126
                        }
128
127
                    }
129
128
                }
@@ -181,12 +180,11 @@ PPCODE:
181
180
        PUSHs( sv_2mortal( newSVpv( "lpMaximumApplicationAddress"  , 0 ) ) );
182
181
        PUSHs( sv_2mortal( newSVuv( si.lpMaximumApplicationAddress     ) ) );
183
182
183
        PUSHs( sv_2mortal( newSVpv( "wProcessBitness"             , 0 ) ) );
184
        PUSHs( sv_2mortal( newSViv(  wProcessBitness                  ) ) );
184
185
185
        PUSHs( sv_2mortal( newSVpv( "process_bitness"  , 0 ) ) );
186
        PUSHs( sv_2mortal( newSViv( process_bitness     ) ) );
187
188
        PUSHs( sv_2mortal( newSVpv( "cpu_bitness"  , 0 ) ) );
189
        PUSHs( sv_2mortal( newSViv( cpu_bitness     ) ) );
186
        PUSHs( sv_2mortal( newSVpv( "wProcessorBitness"                 , 0 ) ) );
187
        PUSHs( sv_2mortal( newSViv(  wProcessorBitness                      ) ) );
190
188
191
189
    }
192
190
    else {

Up to file-list lib/Sys/Info/Driver/Windows.pm:

@@ -14,7 +14,7 @@ use constant SM_SERVERR2 => 89; # Win
14
14
use Exporter ();
15
15
use XSLoader;
16
16
17
$VERSION = '0.69_10';
17
$VERSION = '0.69_11';
18
18
@ISA     = qw( Exporter );
19
19
@EXPORT  = qw(  );
20
20
%EXPORT_TAGS = (

Up to file-list lib/Sys/Info/Driver/Windows/Device/CPU.pm:

@@ -6,6 +6,7 @@ use base qw(
6
6
    Sys::Info::Driver::Windows::Device::CPU::WMI
7
7
);
8
8
use Sys::Info::Constants qw( :windows_reg );
9
use Sys::Info::Driver::Windows qw( :info );
9
10
use Carp qw( croak );
10
11
11
12
$VERSION = '0.69_10';
@@ -30,6 +31,12 @@ sub load {
30
31
    return $cpu[0]->{load};
31
32
}
32
33
34
sub bitness {
35
    my $self = shift;
36
    my %i    = GetSystemInfo();
37
    return $i{wProcessorBitness};
38
}
39
33
40
# XXX: interface is unclear. return data based on context !!!
34
41
# Take a parameter named cpu_num and return properties based on that
35
42
# ... else: add a method named properties() !!!
@@ -114,6 +121,10 @@ See identify in L<Sys::Info::Device::CPU
114
121
115
122
See load in L<Sys::Info::Device::CPU>.
116
123
124
=head2 bitness
125
126
See bitness in L<Sys::Info::Device::CPU>.
127
117
128
=head1 SEE ALSO
118
129
119
130
L<Sys::Info>,

Up to file-list lib/Sys/Info/Driver/Windows/OS.pm:

@@ -7,7 +7,7 @@ use vars qw( $VERSION );
7
7
use base qw( Sys::Info::Driver::Windows::OS::Editions );
8
8
use Win32;
9
9
use Win32::OLE qw( in );
10
use Sys::Info::Driver::Windows qw( :WMI :etc );
10
use Sys::Info::Driver::Windows qw( :all );
11
11
use Sys::Info::Driver::Windows::OS::Net;
12
12
use Carp qw( croak );
13
13
BEGIN {
@@ -193,7 +193,8 @@ sub cdkey {
193
193
194
194
sub bitness {
195
195
    my $self = shift;
196
    
196
    my %i    = GetSystemInfo();
197
    return $i{wProcessBitness};
197
198
}
198
199
199
200
# ------------------------[ P R I V A T E ]------------------------ #