title: How to get a win32 handle of an open file in python?
body: <p>I'm sure this is documented somewhere but i can't find it...</p>
  
  <p>My code is getting a python object from another library (that i can't modify), and i need to call some win32 api functions on it.</p>
  
  <p>Python returns something that isn't the os-level handle from file.fileno(), my guess is that it gives MSVCRT's fileno. </p>
  
  <pre><code>&gt;&gt;&gt; ctypes.windll.kernel32.CreateFileA('test',0x80000000L,1,None,3,0,0)
  1948 # &lt;- HANDLE
  
  &gt;&gt;&gt; file('test','r').fileno()
  4 # &lt;- not a HANDLE
  </code></pre>
  
  <p>How do i convert it into a real win32 handle?</p>