Delen via


ICorDebugProcess::WriteMemory Method

Writes data to an area of memory in this process.

HRESULT WriteMemory(
    [in]  CORDB_ADDRESS address,
    [in]  DWORD size,
    [in, size_is(size)] BYTE buffer[],
    [out] SIZE_T *written);

Parameters

  • address
    [in] A CORDB_ADDRESS value that is the base address of the memory area to which data is written. Before data transfer occurs, the system verifies that the memory area of the specified size, beginning at the base address, is accessible for writing. If it is not accessible, the method fails.

  • size
    [in] The number of bytes to be written to the memory area.

  • buffer
    [in] A buffer that contains data to be written.

  • written
    [out] A pointer to a variable that receives the number of bytes written to the memory area in this process. If written is NULL, this parameter is ignored.

Remarks

Data is automatically written behind any breakpoints. In the .NET Framework version 2.0, native debuggers should not use this method to inject breakpoints into the instruction stream. Use ICorDebugProcess2::SetUnmanagedBreakpoint instead.

The WriteMemory method should be used only outside of managed code. This method can corrupt the runtime if used improperly.

Requirements

Platforms: See .NET Framework System Requirements.

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

See Also

Reference

ICorDebugProcess Interface

ICorDebugProcess2 Interface