Created
August 5, 2017 01:14
-
-
Save blaquee/b311654133ef070a69f07d978203692d to your computer and use it in GitHub Desktop.
Misc Unicode helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL RtlEndsWithUnicodeString(PUNICODE_STRING Source, PUNICODE_STRING Find) | |
{ | |
if (Source->Length == Find->Length || | |
(Find->Length > Source->Length)) | |
{ | |
//do a regular RtlEqualUnicodeString? | |
return FALSE; | |
} | |
USHORT bytesDif = Source->Length - Find->Length; | |
USHORT strLen = bytesDif / sizeof(WCHAR); | |
const UNICODE_STRING endStr = | |
{ | |
Source->Length - bytesDif, | |
Source->MaximumLength - bytesDif, | |
Source->Buffer + strLen | |
}; | |
return RtlEqualUnicodeString_(&endStr, Find, TRUE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment