2017-11-14 0:40 GMT-07:00 Nikolay Sivov bunglehead@gmail.com:
Is it possible we're picking wrong resource with FindResource() here? Maybe we should be using explicit language instead of a neutral one, so
propsheet.c:69: Test failed: Unexpected template buffer size 508, resource size 270
could mean we were supposed to pick up a different resource of size 254.
I tried FindResourceExA on Hebrew Windows 10 with all of the following, and got a resource of size 250 every time:
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT) MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT) MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED) MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT) MAKELANGID(LANG_HEBREW, SUBLANG_HEBREW_ISRAEL)
Interestingly, 508 is exactly 2 times the US English resource size. Maybe the RTL locales base their buffer size on the US English resource? I checked and other languages such as German have different resource and buffer sizes from English.
I also checked Kurdish, Persian, Punjabi, Urdu, and Uyghur Windows 10, and resource sizes were the same for both the localized resource and the US English resource. So, I couldn't tell whether they compute buffer size based on the English resource or based on their own resource.
P.S. GetLocaleInfo() takes LCID not LANGID, and you can use special constants like LOCALE_USER_DEFAULT too.
OK, LOCALE_USER_DEFAULT should be fine. Out of curiosity, what is the correct way to specify a LCID? Do I have to say something like MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0)?
More importantly, how do you think these tests should be written? Should I use the US English resource size to determine the correct buffer size on RTL locales, or should I just continue accepting sizes within 32 bytes of expected? Also, should the different code path be for all RTL locales, or just for Arabic and Hebrew specifically?
-Alex