-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMiniStd.c
73 lines (59 loc) · 1.27 KB
/
MiniStd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "MiniStd.h"
// functions are from https://github.com/vxunderground/VX-API
// https://github.com/xrombar/flower/blob/06ba9f1eca599c1ea157e81868ab61ab57d35c8a/src/Flower.c#L1181
INT
MemCompare(
_In_ PVOID m1,
_In_ PVOID m2,
_In_ UINT len
) {
PUCHAR p = m1;
PUCHAR q = m2;
INT charCompareStatus = 0;
if ( m1 == m2 ) {
return charCompareStatus;
}
while ( len > 0 )
{
if ( *p != *q )
{
charCompareStatus = ( *p > *q ) ? 1 : -1;
break;
}
len--;
p++;
q++;
}
return charCompareStatus;
}
PVOID
CopyMemoryEx(
_Inout_ PVOID Destination,
_In_ CONST PVOID Source,
_In_ SIZE_T Length
) {
PBYTE Dst = ( PBYTE )Destination;
PBYTE Src = ( PBYTE )Source;
while ( Length-- )
{
*Dst++ = *Src++;
}
return Destination;
}
// https://github.com/vxunderground/VX-API/blob/main/VX-API/StringLength.cpp
SIZE_T
StrLenA(
_In_ LPCSTR String
) {
LPCSTR String2;
for ( String2 = String; *String2; ++String2 );
return ( String2 - String );
}
SIZE_T
StrLenW(
_In_ LPCWSTR String
) {
LPCWSTR String2;
for ( String2 = String; *String2; ++String2 );
return ( String2 - String );
}