While debugging an issue with _vsnprintf_s() on Windows, I discovered that the behavior of %ls depends on the CRT locale, not on the Windows code page.
Consider this example:
std::string Log(const char* fmt, ...)
{
char buffer[1024];| // full_align_test.cpp | |
| // | |
| // Сравнивает поведение старых (non-Ex) и новых (Ex) версий функций работы | |
| // с иконками на предмет чувствительности к выравниванию входного буфера: | |
| // - CreateIconFromResource vs CreateIconFromResourceEx | |
| // - LookupIconIdFromDirectory vs LookupIconIdFromDirectoryEx | |
| // | |
| // Гипотеза: возможно, именно старые (non-Ex) версии реально требуют | |
| // DWORD-aligned буфер, а Ex-версии — просто унаследовали формулировку | |
| // в документации по инерции, хотя внутри используют более терпимый код. |
Firmware: LSW5_32_5406_SS_04_00.00.00.11-u.bin
Decompressed: LSW5_32_5406_SS_04_decompressed.bin (1,062,168 bytes)
Build date: 2025-02-06 17:00
Version string: 3.00.16 (2025-02-06 17:00 8M) (L13558)
Module: HiFlying HF-LPx70 (Bouffalo Lab BL602 SoC, RISC-V RV32IMACF)
Flash base: 0x23000000 (XIP)
Container: HF-LPx70x1 Image — 256-byte header + LZMA at offset 0x100
| deye_evse: | |
| logger: | |
| logs: | |
| custom_components.ev_smart_charger: debug | |
| template: | |
| - sensor: | |
| - name: "EV Charger Status Mapped" | |
| unique_id: ev_charger_status_mapped | |
| state: > |
| #include <windows.h> | |
| #include <string> | |
| #include <vector> | |
| /* | |
| * Returns a BCP-47 language tag (e.g. "en-US", "uk-UA", "jv-Java") | |
| * for the given HKL (keyboard layout handle). | |
| * | |
| * WM_INPUTLANGCHANGE provides HKL, whose low word is LANGID. However, | |
| * for transient keyboard layouts (LOCALE_TRANSIENT_KEYBOARD*), LANGID |
| #include <windows.h> | |
| #include <string> | |
| /* | |
| * Returns a 3-letter uppercase language abbreviation (e.g. ENG, РУС, УКР) | |
| * derived from the language autonym using winlangdb.dll. | |
| * | |
| * This matches Windows UI behavior (language indicator in taskbar): | |
| * - Uses GetLanguageNames (undocumented, WinRT language database) | |
| * - Takes the first 3 characters of the autonym |
| using System; | |
| class klGDIBitmapConversion | |
| { | |
| public static System.Drawing.Bitmap MainConv(System.Drawing.Bitmap img) | |
| { | |
| System.Drawing.Bitmap b = img;// new System.Drawing.Bitmap("test.jpg"); | |
| SplashImage(b, 0, 0); | |
| DateTime dtFaq = DateTime.Now; | |
| System.Drawing.Bitmap b0 = CopyToBpp(b, 8); | |
| TimeSpan tsFaq = DateTime.Now - dtFaq; |