Re: advpack: Forward the remaining advpack.c ansi functions to their unicode counterparts
"James Hawkins" <truiken(a)gmail.com> writes:
+HRESULT WINAPI SetPerUserSecValuesA(PERUSERSECTIONA* pPerUser) +{ + PERUSERSECTIONW perUserW; + + if (!pPerUser) + return E_INVALIDARG; + + TRACE("(%p)\n", pPerUser); + + /* lengths copied from PERUSERSECTION structure definition */ + MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, 59, perUserW.szGUID, 59); + MultiByteToWideChar(CP_ACP, 0, pPerUser->szDispName, 128, perUserW.szDispName, 128); + MultiByteToWideChar(CP_ACP, 0, pPerUser->szLocale, 10, perUserW.szLocale, 10); + MultiByteToWideChar(CP_ACP, 0, pPerUser->szStub, MAX_PATH * 4, perUserW.szStub, MAX_PATH * 4); + MultiByteToWideChar(CP_ACP, 0, pPerUser->szVersion, 32, perUserW.szVersion, 32); + MultiByteToWideChar(CP_ACP, 0, pPerUser->szCompID, 128, perUserW.szCompID, 128);
The source lengths are wrong, these are null-terminated strings. Also please use sizeof() instead of hardcoding the constants. -- Alexandre Julliard julliard(a)winehq.org
On 3/22/06, Alexandre Julliard <julliard(a)winehq.org> wrote:
The source lengths are wrong, these are null-terminated strings. Also please use sizeof() instead of hardcoding the constants.
Would MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID, sizeof(perUserW.szGUID)) be a better solution? -- James Hawkins
James Hawkins wrote:
Would MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID, sizeof(perUserW.szGUID)) be a better solution?
The counts for both A and W are in characters, and sizeof() gives bytes, so you need to divide the sizeof a WCHAR array by sizeof(WCHAR) to get the number of characters in the array. Mike
participants (3)
-
Alexandre Julliard -
James Hawkins -
Mike McCormack