ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:22.09KB ,
资源ID:6898420      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6898420.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(SystemInfo.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

SystemInfo.docx

1、SystemInfo Win32-SystemInfo-0.11.zip SystemInfo.pm, change:2008-08-26,size:22028b package Win32:SystemInfo; require 5.005_62; use strict; use warnings; use Win32:API 0.55; use Win32:TieRegistry qw(:KEY_); use vars qw($VERSION); $VERSION = 0.11; # Not sure how useful these are anymore - # may get rid

2、 of them soon. use constant PROCESSOR_ARCHITECTURE_INTEL = 0; use constant PROCESSOR_ARCHITECTURE_MIPS = 1; use constant PROCESSOR_ARCHITECTURE_ALPHA = 2; use constant PROCESSOR_ARCHITECTURE_PPC = 3; use constant PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF; my %Procedures = (); my %Types = (); my %Struc

3、ts = (); #= my $check_OS = sub () # Attempt to make this as private as possible my $dwPlatformId; my $osType; if ( !defined( $TypesOSVERSIONINFO ) ) # (See GetVersionEx on MSDN) Win32:API:Struct-typedef( OSVERSIONINFO = qw DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD

4、dwBuildNumber; DWORD dwPlatformID; TCHAR szCSDVersion128; ); $TypesOSVERSIONINFO = 1; if ( !defined( $ProceduresGetVersionEx ) ) Win32:API-Import( kernel32, BOOL GetVersionEx(LPOSVERSIONINFO lpOSVersionInfo) ) or die Could not locate kernel32.dll - SystemInfo.pm cannot continuen; $ProceduresGetVersi

5、onEx = 1; my $OSVERSIONINFO; if ( !defined( $StructsOSVERSIONINFO ) ) $OSVERSIONINFO = Win32:API:Struct-new(OSVERSIONINFO); $StructsOSVERSIONINFO = $OSVERSIONINFO; else $OSVERSIONINFO = $StructsOSVERSIONINFO; # Ignore Win32:API warnings. Its ugly, but what are you gonna do? local $SIG_WARN_ = sub ;

6、$OSVERSIONINFO-dwMajorVersion = 0; $OSVERSIONINFO-dwMinorVersion = 0; $OSVERSIONINFO-dwBuildNumber = 0; $OSVERSIONINFO-dwPlatformID = 0; $OSVERSIONINFO-szCSDVersion = x 128; $OSVERSIONINFO-dwOSVersionInfoSize = 148; #Win32:API:Struct-sizeof($OSVERSIONINFO); #148; #Win32:API:Struct-sizeof($OSVERSIONI

7、NFO); GetVersionEx($OSVERSIONINFO) or return undef; $dwPlatformId = $OSVERSIONINFO-dwPlatformID; if ( $dwPlatformId = 2 ) my $majorVersion = $OSVERSIONINFO-dwMajorVersion; if ( $majorVersion = 4 ) $osType = WinNT; else $osType = Win2K; elsif ( $dwPlatformId = 1 ) $osType = Win9x; return ( $osType ne

8、 ) ? $osType : undef; ; #= #= my $canUse64Bit = sub () # Another private sub - see if we can do 64 bit eval my $foo = pack( Q, 1234 ) ; return ($) ? 0 : 1; ; #= #= sub MemoryStatus (%;$) my $return = shift; #hash to return my $ret_type |= shift | B; #what format does the user want? my %fmt_types = (

9、 B = 1, KB = 1024, MB = 1024 * 1024, GB = 1024 * 1024 * 1024 ); my params = qw(MemLoad TotalPhys AvailPhys TotalPage AvailPage TotalVirtual AvailVirtual); my %results; #results of fn call my $MemFormat; #divisor for format my $dwMSLength; #validator from fn call $MemFormat = ( $ret_type = /BKMGB?$/

10、) ? $fmt_types$ret_type : $fmt_typesB; # Determine operating system return undef unless my $OS = &$check_OS; my $use64Bit = &$canUse64Bit; if ( ( $OS eq Win2K ) & ($use64Bit) ) if ( !defined( $TypesMEMORYSTATUSEX ) ) # (See GlobalMemoryStatusEx on MSDN) Win32:API:Struct-typedef( MEMORYSTATUSEX = qw

11、DWORD dwLength; DWORD MemLoad; ULONGLONG TotalPhys; ULONGLONG AvailPhys; ULONGLONG TotalPage; ULONGLONG AvailPage; ULONGLONG TotalVirtual; ULONGLONG AvailVirtual; ULONGLONG AvailExtendedVirtual; ); $TypesMEMORYSTATUSEX = 1; if ( !defined( $ProceduresGlobalMemoryStatusEx ) ) Win32:API-Import( kernel3

12、2, BOOL GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpMemoryStatusEx) ) or die Could not locate kernel32.dll - SystemInfo.pm cannot continuen; $ProceduresGlobalMemoryStatusEx = 1; my $MEMORYSTATUSEX; if ( !defined( $StructsMEMORYSTATUSEX ) ) $MEMORYSTATUSEX = Win32:API:Struct-new(MEMORYSTATUSEX); else $ME

13、MORYSTATUSEX = $StructsMEMORYSTATUSEX; $MEMORYSTATUSEX-dwLength = Win32:API:Struct-sizeof($MEMORYSTATUSEX); GlobalMemoryStatusEx($MEMORYSTATUSEX); if ( keys(%$return) = 0 ) foreach (params) $return-$_ = ( $_ eq MemLoad ) ? $MEMORYSTATUSEX-$_ : $MEMORYSTATUSEX-$_ / $MemFormat; else foreach (params) $

14、return-$_ = $MEMORYSTATUSEX-$_ / $MemFormat unless ( !defined( $return-$_ ) ); else if ( !defined( $TypesMEMORYSTATUS ) ) # (See GlobalMemoryStatus on MSDN) # I had to change some of the types to get the struct to # play nicely with Win32:API. The SIZE_Ts are actually # DWORDS in previous versions o

15、f the Win32 API, so this # change doesnt hurt anything. # The names of the members in the struct are different than # in the API to make my life easier, and to keep the same # return values this method has always had. Win32:API:Struct-typedef( MEMORYSTATUS = qw DWORD dwLength; DWORD MemLoad; DWORD T

16、otalPhys; DWORD AvailPhys; DWORD TotalPage; DWORD AvailPage; DWORD TotalVirtual; DWORD AvailVirtual; ); $TypesMEMORYSTATUS = 1; if ( !defined( $ProceduresGlobalMemoryStatus ) ) Win32:API-Import( kernel32, VOID GlobalMemoryStatus(LPMEMORYSTATUS lpMemoryStatus) ) or die Could not locate kernel32.dll -

17、 SystemInfo.pm cannot continuen; $ProceduresGlobalMemoryStatus = 1; my $MEMORYSTATUS; if ( !defined( $StructsMEMORYSTATUS ) ) $MEMORYSTATUS = Win32:API:Struct-new(MEMORYSTATUS); $StructsMEMORYSTATUS = $MEMORYSTATUS; else $MEMORYSTATUS = $StructsMEMORYSTATUS; $MEMORYSTATUS-align(auto); $MEMORYSTATUS-

18、dwLength = 0; $MEMORYSTATUS-MemLoad = 0; $MEMORYSTATUS-TotalPhys = 0; $MEMORYSTATUS-AvailPhys = 0; $MEMORYSTATUS-TotalPage = 0; $MEMORYSTATUS-AvailPage = 0; $MEMORYSTATUS-TotalVirtual = 0; $MEMORYSTATUS-AvailVirtual = 0; GlobalMemoryStatus($MEMORYSTATUS); return undef if $MEMORYSTATUS-dwLength = 0;

19、if ( keys(%$return) = 0 ) foreach (params) $return-$_ = ( $_ eq MemLoad ) ? $MEMORYSTATUS-$_ : $MEMORYSTATUS-$_ / $MemFormat; else foreach (params) $return-$_ = $MEMORYSTATUS-$_ / $MemFormat unless ( !defined( $return-$_ ) ); 1; #= #= sub ProcessorInfo (;%) my $allHash = shift; # Determine operating

20、 system return undef unless my $OS = &$check_OS; if ( !defined( $TypesSYSTEM_INFO ) ) # (See GetSystemInfo on MSDN) # Win32:API does not seem to recognize LPVOID or DWORD_PTR types, # so theyve been changed to DWORDs in the struct. These values are # not checked by this module, so this seems like a

21、safe way around the # problem. Win32:API:Struct-typedef( SYSTEM_INFO = qw WORD wProcessorArchitecture; WORD wReserved; DWORD dwPageSize; DWORD lpMinimumApplicationAddress; DWORD lpMaximumApplicationAddress; DWORD dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAlloc

22、ationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; ); $TypesSYSTEM_INFO = 1; if ( !defined( $ProceduresGetSystemInfo ) ) Win32:API-Import( kernel32, VOID GetSystemInfo(LPSYSTEM_INFO lpSystemInfo) ) or die Could not locate kernel32.dll - SystemInfo.pm cannot continuen; $ProceduresGetSys

23、temInfo = 1; my $SYSTEM_INFO; if ( !defined( $StructsSYSTEM_INFO ) ) $SYSTEM_INFO = Win32:API:Struct-new(SYSTEM_INFO); $StructsSYSTEM_INFO = $SYSTEM_INFO; else $SYSTEM_INFO = $StructsSYSTEM_INFO; # Ignore Win32:API warnings. Its ugly, but what are you gonna do? local $SIG_WARN_ = sub ; $SYSTEM_INFO-

24、wProcessorArchitecture = 0; $SYSTEM_INFO-wReserved = 0; $SYSTEM_INFO-dwPageSize = 0; $SYSTEM_INFO-lpMinimumApplicationAddress = 0; $SYSTEM_INFO-lpMaximumApplicationAddress = 0; $SYSTEM_INFO-dwActiveProcessorMask = 0; $SYSTEM_INFO-dwNumberOfProcessors = 0; $SYSTEM_INFO-dwProcessorType = 0; $SYSTEM_IN

25、FO-dwAllocationGranularity = 0; $SYSTEM_INFO-wProcessorLevel = 0; $SYSTEM_INFO-wProcessorRevision = 0; GetSystemInfo($SYSTEM_INFO); my $proc_type; # Holds 386,586,PPC, etc my $num_proc; # number of processors $num_proc = $SYSTEM_INFO-dwNumberOfProcessors; if ( $OS eq Win9x ) $proc_type = $SYSTEM_INF

26、O-dwProcessorType; elsif ( ( $OS eq WinNT ) | ( $OS eq Win2K ) ) my $proc_level; # first digit of Intel chip (5,6,etc) my $proc_val; $proc_val = $SYSTEM_INFO-wProcessorArchitecture; $proc_level = $SYSTEM_INFO-wProcessorLevel; # Not sure we need to make this check - who # uses this value? if ( $proc_val = PROCESSOR_ARCHITECTURE_INTEL ) $proc_type = $proc_level . 86; el

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1