Ejemplo n.º 1
0
HOOKFUNC BOOL WINAPI MySetWindowTextA(HWND hWnd, LPCSTR lpString)
{
	debuglog(LCF_WINDOW, __FUNCTION__ "(0x%X, \"%s\") called.\n", hWnd, lpString);
	if(tasflags.appLocale)
	{
		str_to_wstr(wstr, lpString, LocaleToCodePage(tasflags.appLocale));
		BOOL rv = MySetWindowTextW(hWnd, wstr);
		DispatchMessageInternal(hWnd, WM_SETTEXT, 0, (LPARAM)wstr, false, MAF_BYPASSGAME|MAF_RETURN_OS);
		return rv;
	}
	BOOL rv = SetWindowTextA(hWnd, lpString);
	DispatchMessageInternal(hWnd, WM_SETTEXT, 0, (LPARAM)lpString, true, MAF_BYPASSGAME|MAF_RETURN_OS);
	return rv;
}
Ejemplo n.º 2
0
    HOOKFUNC HFONT WINAPI MyCreateFontIndirectA(CONST LOGFONTA *lplf)
    {
        ENTER(lplf->lfQuality, lplf->lfCharSet, lplf->lfFaceName);

        if (lplf->lfQuality != NONANTIALIASED_QUALITY)
            ((LOGFONTA*)lplf)->lfQuality = ANTIALIASED_QUALITY; // disable ClearType so it doesn't get into AVIs

        HFONT rv;
        if (tasflags.appLocale
            && (lplf->lfCharSet == LocaleToCharset(tasflags.appLocale)
                || (/*tasflags.movieVersion >= 79
                 && */(lplf->lfCharSet == DEFAULT_CHARSET || lplf->lfCharSet == OEM_CHARSET)))
            /*&& lplf->lfCharSet != LocaleToCharset(GetACP())*/)
        {
            // since windows 2000, the CreateFont functions can recognize either the localized or unlocalized font name.
            // but, they still can't recognize the localized font name in the incorrect codepage.
            str_to_wstr(wstr, lplf->lfFaceName, LocaleToCodePage(tasflags.appLocale));

            LOGFONTW fontw;
            memcpy(&fontw, lplf, (int)&fontw.lfFaceName - (int)&fontw);
            wcscpy(fontw.lfFaceName, wstr);
            if (/*tasflags.movieVersion >= 79 && */tasflags.appLocale == 1041 && !DoesFontExistW(&fontw))
            {
                wcscpy(fontw.lfFaceName, _L(DEFAULT_FONT_FOR_LOCALE_1041));
                if (!DoesFontExistW(&fontw))
                    wcscpy(fontw.lfFaceName, wstr);
            }
            rv = CreateFontIndirectW(&fontw);
        }
        else
        {
            rv = CreateFontIndirectA(lplf);
        }

        return rv;
    }