UNICODE_STRING的操作集

来源:互联网 发布:sharpdesk桌面软件 编辑:程序博客网 时间:2024/05/26 09:55
UNICODE_STRING uStr1;
UNICODE_STRING uStr2;
ANSI_STRING         aStr1;
WCHAR         *str1 = L"Hello, world";
WCHAR         *str2 = L"Goodbye, world";

LPWSTR        *s1;
LPCWSTR     *s2;

uStr2.Buffer = ExAllocatePoolWithTag(PagedPool, length, 'UNIC');
uStr2.Length = 0;
uStr2.MaximumLength = length;


RtlInitUnicodeString(&uStr1, str1);
RtlCopyUnicodeString(&uStr1, &uStr2);
RtlAppendUnicodeToString(&uStr1, str1);
RtlAppendUnicodeStringToString(&uStr1, &uStr2);
RtlCompareUnicodeString(&uStr1, &uStr2, TRUE/FALSE);//TRUE:case sensible
RtlAnsiStringToUnicodeString(&uStr1, &aStr1, TRUE/FALSE);//TRUE: memory allocation for uStr1 and should be freed by RtlFreeUnicodeString

ExFreePool(uStr2.Buffer);

_tcslen
_tcsicmp
_tcsnicmp
_tcscmp
_tcscat
_tcscpy
_wcsicmp
_wcsnicmp

wcscat
wcslen
wcscmp
wcsncmp
原创粉丝点击