Exemple #1
0
def test_open_process():
    pid = rwin32.GetCurrentProcessId()
    assert pid != 0
    handle = rwin32.OpenProcess(rwin32.PROCESS_QUERY_INFORMATION, False, pid)
    rwin32.CloseHandle(handle)
    py.test.raises(WindowsError, rwin32.OpenProcess, rwin32.PROCESS_TERMINATE,
                   False, 0)
Exemple #2
0
 def dup(fd):
     with lltype.scoped_alloc(_c.WSAPROTOCOL_INFO, zero=True) as info:
         if _c.WSADuplicateSocket(fd, rwin32.GetCurrentProcessId(), info):
             raise last_error()
         result = _c.WSASocket(
             _c.FROM_PROTOCOL_INFO, _c.FROM_PROTOCOL_INFO,
             _c.FROM_PROTOCOL_INFO, info, 0, 0)
         if result == INVALID_SOCKET:
             raise last_error()
         return result