I'm getting the error 299, which according to MSDN is "Only part of a ReadProcessMemory or WriteProcessMemory request was completed.". I'm unsure what I've done wrong.
Also I'm using Windows 7 & running as Administrator.
$pMem = _MemVirtualAllocEx($hProc, 0, StringLen($SomeVar) + 1, $MEM_COMMIT, $PAGE_READWRITE)
If $pMem = 0 Then
MsgBox(16, $Title, "Failed to allocate memory.")
Exit
EndIf
$nBytes = 0
If _WinAPI_WriteProcessMemory($hProc, $pMem, $SomeVar, StringLen($SomeVar) + 1, $nBytes) = 0 Then
MsgBox(0, $Title, "Failed to write to allocated memory." & @CRLF & @CRLF & "Error Code: " & _WinAPI_GetLastError())
Exit
EndIf