Partager 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

Parameter Description

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 Method instead.

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

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorDebugProcess Interface
ICorDebugProcess2 Interface