Click or drag to resize

MemDWord Function

Get a pointer to a matching double word in a memory buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION MemDWord(
	ptrBuffer AS IntPtr,
	dwValue AS DWORD,
	dwCount AS DWORD
) AS IntPtr
View Source

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
dwValue
Type: UInt32
The double word value to match.
dwCount
Type: UInt32
The number of double words in <ptrBuffer> to examine.

Return Value

Type: IntPtr
A pointer to the first occurrence of <dwValue> within the first <dwCount> characters of <ptrBuffer>.  If <dwValue> is not matched, MemDWord() returns a NULL_PTR.
Remarks
Examples
This example uses MemDWord() on a PSZ:
X#
FUNCTION FindDWord() AS VOID
        LOCAL pszC := "ABCDEFGHIJ" AS PSZ
        ? MemDWord(pszC, Bin2DW("EFGH"), 2)        // A  pointer
        ? MemDWord(pszC, Bin2DW("EFGH"), 1)
        // Pattern not found in the first DWord of pszC
        //  0000:0000
See Also