#include "4J_Profile.h" #include "INP_Keyboard.h" CKeyboard::CKeyboard() { bActive = false; pwchResult = L""; } void CKeyboard::Tick(void) { if (bActive && KeyboardOverlap.InternalLow != ERROR_IO_PENDING) { if(Func != NULL) Func(lpParam, KeyboardOverlap.dwExtendedError == 0); bActive = false; } } C_4JInput::EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR uiTitle, LPCWSTR uiText, LPCWSTR uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode) { if (bActive) return C_4JInput::EKeyboard_Cancelled; this->iPad = (int)dwPad; this->pwchResult = pwchResult; this->uiMaxChars = uiMaxChars; this->Func = Func; this->lpParam = lpParam; int LockedProfile = this->iPad; if (LockedProfile == -1) { LockedProfile = ProfileManager.GetLockedProfile(); if (LockedProfile == -1) { LockedProfile = ProfileManager.GetLockedProfile(); if (LockedProfile == -1) return C_4JInput::EKeyboard_Cancelled; } } switch (eMode) { //str1k3r - look at xam.h for the modes case C_4JInput::EKeyboardMode_Numeric: keyboardMode = VKBD_LATIN_NUMERIC; break; case C_4JInput::EKeyboardMode_Password: keyboardMode = VKBD_LATIN_PASSWORD; break; //str1k3r - Alphabet and Full need multi lang support case C_4JInput::EKeyboardMode_Alphabet: keyboardMode = VKBD_LATIN_ALPHABET; break; case C_4JInput::EKeyboardMode_Full: keyboardMode = VKBD_LATIN_FULL; break; case C_4JInput::EKeyboardMode_Alphabet_Extended: keyboardMode = VKBD_LATIN_EXTENDED; break; case C_4JInput::EKeyboardMode_IP_Address: keyboardMode = VKBD_LATIN_IP_ADDRESS; break; case C_4JInput::EKeyboardMode_Phone: keyboardMode = VKBD_LATIN_PHONE; break; case C_4JInput::EKeyboardMode_Email: keyboardMode = VKBD_LATIN_EMAIL; break; default: keyboardMode = VKBD_DEFAULT; break; } ZeroMemory(&KeyboardOverlap, sizeof(XOVERLAPPED)); for (;;) { DWORD result = XShowKeyboardUI(LockedProfile, keyboardMode, uiText, uiTitle, uiDesc, this->pwchResult, this->uiMaxChars, &KeyboardOverlap); if (result == ERROR_IO_PENDING) break; if (result != ERROR_ACCESS_DENIED) return C_4JInput::EKeyboard_Cancelled; Sleep(250); } bActive = true; return eState; } //str1k3r - These 2 only exist cause of iggy C_4JInput::EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR uiTitle, LPCWSTR uiText, LPCWSTR uiDesc, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode) { return RequestKeyboard(uiTitle, uiText, uiDesc, dwPad, pwchResult, uiMaxChars, Func, lpParam, eMode); } void CKeyboard::GetText(uint16_t *UTF16String) { //uint16_t *keyString; //for (unsigned int index = 0; keyString[index] && index < 0x200; index++) //{ // UTF16String[index] = keyString[index]; //} }