BOOL NTAPI LeNtUserDefSetText( HWND hWnd, PLARGE_UNICODE_STRING Text ) { BOOL Success; LARGE_UNICODE_STRING UnicodeText; PLeGlobalData GlobalData = LeGetGlobalData(); InitEmptyLargeString(&UnicodeText); LOOP_ONCE { if (Text == nullptr) break; if (GlobalData->GetWindowDataA(hWnd) == nullptr) break; if (LargeStringAnsiToUnicode(Text, &UnicodeText) == nullptr) break; Text = &UnicodeText; } Success = GlobalData->NtUserSetDefText(hWnd, Text); FreeLargeString(&UnicodeText); return Success; }
PLARGE_UNICODE_STRING CaptureAnsiWindowName(PLARGE_UNICODE_STRING WindowName, PLARGE_UNICODE_STRING UnicodeWindowName) { InitEmptyLargeString(UnicodeWindowName); if (WindowName == NULL || WindowName->Buffer == NULL) return NULL; if (WindowName->UnicodeBuffer[0] == 0xFFFF) { WCHAR Buffer[0x10]; ULONG_PTR Length; LARGE_UNICODE_STRING TitleAsResourceId; TitleAsResourceId.Ansi = FALSE; Length = WindowName->Ansi ? 3 : 4; CopyMemory(Buffer, WindowName->AnsiBuffer + WindowName->Ansi, Length); TitleAsResourceId.Length = Length; TitleAsResourceId.MaximumLength = Length; TitleAsResourceId.Buffer = (ULONG64)Buffer; return LargeStringDuplicate(&TitleAsResourceId, UnicodeWindowName); } return LargeStringAnsiToUnicode(WindowName, UnicodeWindowName); }