Background information: --------------------------------- in order to monitor mainboard sensory data as fan speeds, temperatures, applications like SpeedFan http://www.almico.com/speedfan.php or MBM http://mbm.livewiredev.com/ can be used. Both of the mentioned apps expose data got from the hardware in a shared memory area.
The goal to achieve: --------------------------- is to supervise the motherboard sensory data from within a Python script The approach: ------------------- access to the shared memory area exposed by motherboard hardware querying apps from Python script. The problem: ----------------- the below listed script code returns always same values, what leads to the conclusion, that something is going wrong. Can anyone help? Thanks in advance Claudio The code ------------- I use is provided also here: http://www.codecomments.com/Python/message430495.html http://mail.python.org/pipermail/python-list/2005-March/271853.html (the mmap part of it doesn't work at all) from ctypes import * class Buffer(Structure): # just to see if any useful data can be acquired _fields_ = [ ("Data0", c_longlong) ,("Data1", c_longlong) ,("Data2", c_longlong) ,("Data3", c_longlong) ,("Data4", c_longlong) ,("Data5", c_longlong) ,("Data6", c_longlong) ,("Data7", c_longlong) ,("Data8", c_longlong) ,("Data9", c_longlong) ,("DataA", c_longlong) ,("DataB", c_longlong) ,("DataC", c_longlong) ,("DataD", c_longlong) ,("DataE", c_longlong) ,("DataF", c_longlong) ] szName = c_char_p("SFSharedMemory_ALM") # SpeedFan szName = c_char_p("$M$B$M$5$S$D$") # MBM # szName = c_char_p("blabla") # not existing shared memory FILE_MAP_ALL_ACCESS = 0xF001F FALSE = 0 hMapObject = windll.kernel32.OpenFileMappingA( FILE_MAP_ALL_ACCESS ,FALSE ,szName ) if (hMapObject == 0): print "Could not open file mapping object" raise WinError() pBuf = windll.kernel32.MapViewOfFile( hMapObject ,FILE_MAP_ALL_ACCESS ,0 ,0 ,0 ) if (pBuf == 0): print "Could not map view of file" raise WinError() else: print repr(pBuf) print repr(hMapObject) pBuf_str = cast(pBuf, c_char_p) print repr(pBuf_str.value) print repr(pBuf_str) pBuf_buf = cast(pBuf, Buffer) print print print repr(pBuf_buf) print print repr(pBuf_buf.Data0) print repr(pBuf_buf.Data1) print repr(pBuf_buf.Data2) print repr(pBuf_buf.Data3) print repr(pBuf_buf.Data4) print repr(pBuf_buf.Data5) print repr(pBuf_buf.Data6) print repr(pBuf_buf.Data7) print repr(pBuf_buf.Data8) print repr(pBuf_buf.Data9) print repr(pBuf_buf.DataA) print repr(pBuf_buf.DataB) print repr(pBuf_buf.DataC) print repr(pBuf_buf.DataD) print repr(pBuf_buf.DataE) print repr(pBuf_buf.DataF) #:if/else (pBuf == 0) windll.kernel32.UnmapViewOfFile(pBuf) windll.kernel32.CloseHandle(hMapObject) The output -------------- is always the same: 13107200 80 '' c_char_p('') <__main__.Buffer object at 0x007E3570> 13107200L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L 0L -- http://mail.python.org/mailman/listinfo/python-list