We'll.... I found out how MultiByteToWideChar (MBTWC) is implemented, and looks OK.
But then, there are following issues:
1 some functions (DefWindowProcA) call MBTWC, but with CP_ACP and HeapAlloc ALWAYS (IMHO should be: CP_THREAD_ACP, use some local cache if the 8-bit string is short enough, for performance) 2 some functions (GetMonitorInfoA) call MBTWC using CP_THREAD_ACP 3 yet other functions (RegisterClassExA) call RtlCreateUnicodeStringFromAsciiz and and RtlFreeUnicodeString later (no TEB cache, allocation ALWAYS) 4 and some other functions (CreateEventExA) call RtlAnsiStringToUnicodeString and use cache from TEB 5 other functions use RtlAnsiStringToUnicodeString with allocation, and RtlFreeUnicodeString later. 6 and some other functions (SetWindowTextA) call RtlAnsiStringToUnicodeString and RtlFreeUnicodeString (allocation ALWAYS)
Is this inconsistent or what?!
Best regards
Daniel