Look for ctypes, win32api modules, if you can do it in C you can do it in Python but it will be much slower and using C types in Python is just ugly.