title: Lua Alien Module - Trouble using WriteProcessMemory function, unsure on types (unit32)
body: <pre><code>require "alien"
  
  --the address im trying to edit in the Mahjong game on Win7
  local SCOREREF = 0x0744D554 
  --this should give me full access to the process
  local ACCESS = 0x001F0FFF
  --this is my process ID for my open window of Mahjong
  local PID = 1136
  
  --function to open proc
  local op = alien.Kernel32.OpenProcess
  op:types{ ret = "pointer", abi = "stdcall"; "int", "int", "int"}
  
  --function to write to proc mem
  local wm = alien.Kernel32.WriteProcessMemory
  wm:types{ ret = "long", abi = "stdcall"; "pointer", "pointer", "pointer", "long", "pointer" }
  
  
  local pRef = op(ACCESS, true, PID)
  local buf = alien.buffer("99")
  
  --         ptr,uint32,byte arr (no idea what to make this),int, ptr
  print( wm( pRef, SCOREREF, buf, 4, nil))
  --prints 1 if success, 0 if failed
  </code></pre>
  
  <p>So that is my code. I am not even sure if I have the types set correctly.</p>
  
  <p>I am completely lost and need some guidance. I really wish there was more online help/documentation for alien, it confuses my poor brain. </p>
  
  <p>What utterly baffles me is that it <em>WriteProcessMemory</em> will sometimes complete successfully (though it does nothing at all, to my knowledge) and will also sometimes fail to complete successfully. As I've stated, my brain hurts. </p>
  
  <p>Any help appreciated.</p>