Home
Auto Debug On Line Help
 
User Script: Auto Debug System

setProcessMemory

The setProcessMemory function to set debuggee process memory context..

VOID setProcessMemory(
  LONG pAddress,       // The pointer to the base address in the debuggee process.
  int nSize,           // The number of bytes to be set to the debuggee process.
  VARIANT  val,        // The array of data to be set to the debuggee process.
  ArrayDataType nType  // The array type.
);

Parameters

pAddress
A pointer to the base address in the debuggee process to which to set.
nSize
The number of bytes to be set to the debuggee process.
val
The array of data to be set to the debuggee process.
nType
Which type will be set.
ArrayByteType=0 : return byte array data
ArrayShortType=1 : return short array data
ArrayIntType=2 : return int array data
ArrayLongLongType=3 : return LongLong array data
ArrayUnicodeType=4 : return unicode string data
ArrayAnsiType=5 : return ansi string data

Remark

This function only can be call at OnBreakPointEntry or OnBreakPointReturn event.

Examples

VBscript Example:

sub main
  addMenuItem "Save Log", "SaveLogFile"
  addMenuItem "Kill Trace Process", "KillTraceProcess"
  startProcess "Notepad.exe", "c:\a.txt"
end sub

sub SaveLogFile
    MsgBox "Call Save Log File"
    saveLog "c:\aaa.dsf"
end sub

sub KillTraceProcess
    MsgBox "Call Kill Process"
    killProcess false
end sub

sub OnBreakPointEntry(pszDll, pszName, nParam, pParam, dwProcessId)
  rc = getParamAddress(pParam, 0)
  buf = getProcessMemory(rc, 100, 0)
  setProcessMemory(rc, 100, buf, 0)
end sub

JavaScript Example:

function main(){
  addMenuItem("Save Log", "SaveLogFile");
  addMenuItem("Kill Trace Process", "KillTraceProcess");

  startProcess("Notepad.exe", "c:\a.txt");
}

function SaveLogFile(){
    echo("Call Save Log File");
    saveLog("c:\aaa.dsf");
}

function KillTraceProcess(){
    echo("Call Kill Process");
    killProcess(false);
}

function OnBreakPointEntry(pszDll, pszName, nParam, pParam, dwProcessId)
{
  rc = getParamAddress(pParam, 0);
  vbTemp = getProcessMemory(rc, 100, 0);
  buf = new VBArray(vbTemp);
  setProcessMemory(rc, 100, buf, 0);
}

Requirements

Auto Debug for Windows: Unsupport.
Auto Debug Professional: Requires version 5.0 or later.

See Also

Script Information Overview, Script Functions, getParamAddress,getProcessMemory, OnBreakPointReturn ,OnBreakPointEntry

Copyright c 2003-2024, www.autodebug.com All Rights Reserved