Click or drag to resize

MemDWord Function

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

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

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
dwValue
Type: DWord
The double word value to match.
dwCount
Type: DWord
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#
1FUNCTION FindDWord() AS VOID
2    LOCAL pszC := "ABCDEFGHIJ" AS PSZ
3    ? MemDWord(pszC, Bin2DW("EFGH"), 2)    // A  pointer
4    ? MemDWord(pszC, Bin2DW("EFGH"), 1)
5    // Pattern not found in the first DWord of pszC
6    //  0000:0000
See Also