[PATCH 1/3] msvcp: Implement the wchar version of _Open_dir.

Stefan Dösinger stefandoesinger at gmail.com
Thu May 18 10:46:17 CDT 2017


Am 2017-05-18 um 14:35 schrieb Piotr Caban:
> Could you please check if there really is such a length limit in wchar
> version of the function?
I'm working on it. What is the deal with wchar_t vs WCHAR in the
implementation vs the tests?

Also I am not sure the existing test establishes the -3 for the A
version. I'll extend it if my reading is right.

>> +        WideCharToMultiByte(CP_ACP, 0, target_w, -1, target, wcslen(target_w) + 1, NULL, NULL);
> You can use MAX_PATH here instead of wcslen(target_w)+1. 
I guess the app is required to pass a pointer to a string that's at
least MAX_PATH in size because there is no way to communicate the
length. Given that constraint it should be safe to convert MAX_PATH chars.

However, with the actual implementation an app could get away with a
shorter array if the actual path is shorter I think, and the app may be
able to know the length in advance. So blindly converting MAX_PATH
characters could cause a problem.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20170518/562a2f12/attachment.sig>


More information about the wine-devel mailing list