home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 September / maximum-cd-2009-09.iso / DiscContents / digsby_setup.exe / lib / gui / native / win / winsysinfo.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  2.8 KB  |  70 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import os
  5. import ctypes
  6. from ctypes import c_ulong, c_void_p, byref, POINTER, windll
  7. from ctypes.wintypes import DWORD, WORD
  8. kernel32 = windll.kernel32
  9. DWORD_PTR = POINTER(DWORD)
  10.  
  11. class SYSTEM_INFO(ctypes.Structure):
  12.     _fields_ = [
  13.         ('dwOemId', DWORD),
  14.         ('dwPageSize', DWORD),
  15.         ('lpMinimumApplicationAddress', c_void_p),
  16.         ('lpMaximumApplicationAddress', c_void_p),
  17.         ('dwActiveProcessorMask', DWORD_PTR),
  18.         ('dwNumberOfProcessors', DWORD),
  19.         ('dwProcessorType', DWORD),
  20.         ('dwAllocationGranularity', DWORD),
  21.         ('wProcessorLevel', WORD),
  22.         ('wProcessorRevision', WORD)]
  23.  
  24.  
  25. class MEMORYSTATUS(ctypes.Structure):
  26.     _fields_ = [
  27.         ('dwLength', c_ulong),
  28.         ('dwMemoryLoad', c_ulong),
  29.         ('dwTotalPhys', c_ulong),
  30.         ('dwAvailPhys', c_ulong),
  31.         ('dwTotalPageFile', c_ulong),
  32.         ('dwAvailPageFile', c_ulong),
  33.         ('dwTotalVirtual', c_ulong),
  34.         ('dwAvailVirtual', c_ulong)]
  35.  
  36.  
  37. try:
  38.     GetSystemInfo = kernel32.GetSystemInfo
  39. except ImportError:
  40.     pass
  41.  
  42.  
  43. def get_num_processors():
  44.     info = SYSTEM_INFO()
  45.     GetSystemInfo(byref(info))
  46.     return info.dwNumberOfProcessors
  47.  
  48.  
  49. class SystemInformation(object):
  50.     
  51.     def _ram(self):
  52.         kernel32 = ctypes.windll.kernel32
  53.         memoryStatus = MEMORYSTATUS()
  54.         memoryStatus.dwLength = ctypes.sizeof(MEMORYSTATUS)
  55.         kernel32.GlobalMemoryStatus(ctypes.byref(memoryStatus))
  56.         return (dict,)((lambda .0: for k, _type in .0:
  57. (k, getattr(memoryStatus, k)))(MEMORYSTATUS._fields_))
  58.  
  59.     
  60.     def _disk_c(self):
  61.         drive = unicode(os.getenv('SystemDrive'))
  62.         freeuser = ctypes.c_int64()
  63.         total = ctypes.c_int64()
  64.         free = ctypes.c_int64()
  65.         ctypes.windll.kernel32.GetDiskFreeSpaceExW(drive, ctypes.byref(freeuser), ctypes.byref(total), ctypes.byref(free))
  66.         d = dict(drive = drive, freeuser = freeuser.value, total = total.value, free = free.value)
  67.         return d
  68.  
  69.  
  70.