memcmp

Description of the 'memcmp' function in HyperDbg Scripts

Function

memcmp

Syntax

memcmp( Ptr1, Ptr2, Num );

Parameters

[Ptr1]

A MASM-like expression or a string to compare with Ptr2.

[Ptr2]

A MASM-like expression or a string to compare with Ptr1.

[Num]

Number of bytes to compare.

Description

Compares the first Num bytes of the block of memory pointed by Ptr1 to the first num bytes pointed by Ptr2.

Return value

Returns an integer value indicating the relationship between the content of the memory blocks:

return valueindicates

<0

The first byte that does not match in both memory blocks has a lower value in Ptr1 than in Ptr2 (if evaluated as unsigned char values).

0

The contents of both memory blocks are equal.

>0

The first byte that does not match in both memory blocks has a greater value in Ptr1 than in Ptr2 (if evaluated as unsigned char values).

Examples

memcmp(fffff806`6de00000, @rax+c0, 5);

Compare the first 5 bytes of the memory located at fffff806`6de00000 with the memory located at @rax+c0.

memcmp(@rcx, "Test1", 5);

Compare the first 5 bytes of the memory located at @rcx with the string "Test1".

Remarks

This function checks for the validity of both the source and the destination address before the comparison.

The support for this function is added from v0.7.

strcmp

wcscmp

Last updated