title: I can't do WriteProcessMemory in python, so why?
body: <p>I write some code based in stackoverflow code's just to readmemory and compare with a single value. When true i need to replace this value for 0 or another value. But my writeprocessmemory isn't working, and i don't know why.
  The output value for result is 1 - that means it's working
  but the outbut value for result2 is 0 - means that isn't working</p>
  <pre><code>import ctypes as c
  from ctypes import wintypes as w
  import winsound
  import time
  
  pid = 7740 
  Ids_pointer = [0x016E3E60, 0x015E47E0, 0x013E4A90, 0x011E4AB8, 0x016E4AB0, 0x014E4B08, 0x012B40C0]
  k32 = c.windll.kernel32
  OpenProcess = k32.OpenProcess
  OpenProcess.argtypes = [w.DWORD,w.BOOL,w.DWORD]
  OpenProcess.restype = w.HANDLE
  
  ReadProcessMemory = k32.ReadProcessMemory
  ReadProcessMemory.argtypes = [w.HANDLE,w.LPCVOID,w.LPVOID,c.c_size_t,c.POINTER(c.c_size_t)]
  ReadProcessMemory.restype = w.BOOL
  
  
  WriteMemory = k32.WriteProcessMemory
  WriteMemory.argtypes = [w.HANDLE,w.LPCVOID,w.LPVOID,c.c_size_t,c.POINTER(c.c_size_t)]
  WriteMemory.restype = w.BOOL
  
  GetLastError = k32.GetLastError
  GetLastError.argtypes = None
  GetLastError.restype = w.DWORD
  
  CloseHandle = k32.CloseHandle
  CloseHandle.argtypes = [w.HANDLE]
  CloseHandle.restype = w.BOOL
  e = GetLastError()
  
  
  processHandle = OpenProcess(0x0010, False, pid)
  processHandle2 = OpenProcess(0x0020, False, pid)
  
  
  while 1:
      for q in range (0,7):
          data = c.c_ulong()
          bytesRead = c.c_ulonglong()
          result = ReadProcessMemory(processHandle, Ids_pointer[q], c.byref(data), c.sizeof(data), c.byref(bytesRead))
          cmd = data.value
          print(cmd)
          print('result: {}, err code: {}, bytesRead: {}'.format(result, e, bytesRead.value))
  
          if cmd == 1919902817:
              for i in range (0,7):
                  result2 = WriteMemory(processHandle2, Ids_pointer[i], c.byref(data), c.sizeof(data), None)
                  print('result: {}, err code: {}, bytesRead: {}'.format(result2, e, bytesRead.value))
  
  CloseHandle(processHandle)
  </code></pre>