MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function. It was recovered with from dissassambled code.
Signed-off-by: Alexey Fisher bug-track@fisher-privat.net --- dlls/comctl32/comctl32undoc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index ff94051..6eb6c0f 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -560,6 +560,47 @@ INT WINAPI AddMRUStringW(HANDLE hList, LPCWSTR lpszString) }
/************************************************************************** + * comctl_MultiByteToWideChar (internal) + * Convert Multibyte string to WideChar string. + * + * PARAMS + * CodePage [I] COdepage of lpMultiByteStr + * lpMultiByteStr [I] multibyte string + * + * RETURNS + * Pointer to lpWideCharStr [O] or NULL if failed. Do not forget to + * Free the lpWideCharStr after use! + */ +LPWSTR comctl_MultiByteToWideChar(UINT CodePage, LPCSTR lpMultiByteStr) +{ + LPWSTR lpWideCharStr; + int len; + + if (lpMultiByteStr == NULL || lpMultiByteStr == -1) + return NULL; + + if (IsBadReadPtr(lpMultiByteStr, 1)) + return NULL; + + len = MultiByteToWideChar(CodePage, NULL, lpMultiByteStr, -1, NULL, NULL); + if (!len) + len = 1; + + lpWideCharStr = LocalAlloc(len * sizeof(WCHAR), 0); + if (!lpWideCharStr) + return NULL; + + if (!MultiByteToWideChar(CodePage, 1, lpMultiByteStr, -1, + lpWideCharStr, len)) { + LocalFree(lpWideCharStr); + lpWideCharStr = NULL; + return NULL; + } + + return lpWideCharStr; +} + +/************************************************************************** * AddMRUStringA [COMCTL32.153] * * See AddMRUStringW.
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Am Donnerstag, den 28.04.2011, 10:49 +0400 schrieb Nikolay Sivov:
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Ouch... bad start. Hmm... but this code is present in wine-comctl32, it just spread in different parts.
On Thu, Apr 28, 2011 at 09:03:51AM +0200, Alexey Fisher wrote:
Am Donnerstag, den 28.04.2011, 10:49 +0400 schrieb Nikolay Sivov:
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Ouch... bad start. Hmm... but this code is present in wine-comctl32, it just spread in different parts.
We do not need to follow the original comctl32 bytewise.
You will find however functions called "head_strdupA2W" occasionaly
eg. dlls/wininet/internet.h:heap_strdupWtoA() and heap_strdupAtoW()
if you need to factor out such common tasks as string allocation + conversion.
Ciao, Marcus
Am Donnerstag, den 28.04.2011, 09:25 +0200 schrieb Marcus Meissner:
On Thu, Apr 28, 2011 at 09:03:51AM +0200, Alexey Fisher wrote:
Am Donnerstag, den 28.04.2011, 10:49 +0400 schrieb Nikolay Sivov:
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Ouch... bad start. Hmm... but this code is present in wine-comctl32, it just spread in different parts.
We do not need to follow the original comctl32 bytewise.
You will find however functions called "head_strdupA2W" occasionaly
eg. dlls/wininet/internet.h:heap_strdupWtoA() and heap_strdupAtoW()
if you need to factor out such common tasks as string allocation + conversion.
Thank you for the tip, i'll do some clean job in comctl32, if i'm not banned :D
Am Donnerstag, den 28.04.2011, 09:25 +0200 schrieb Marcus Meissner:
On Thu, Apr 28, 2011 at 09:03:51AM +0200, Alexey Fisher wrote:
Am Donnerstag, den 28.04.2011, 10:49 +0400 schrieb Nikolay Sivov:
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Ouch... bad start. Hmm... but this code is present in wine-comctl32, it just spread in different parts.
We do not need to follow the original comctl32 bytewise.
You will find however functions called "head_strdupA2W" occasionaly
eg. dlls/wininet/internet.h:heap_strdupWtoA() and heap_strdupAtoW()
if you need to factor out such common tasks as string allocation + conversion.
May be it make sense to place this function to winebase? Looks like there is some duplicates: dlls/mshtml/mshtml_private.h:static inline char *heap_strdupWtoA(LPCWSTR str) dlls/wininet/internet.h:static inline char *heap_strdupWtoA(LPCWSTR str) dlls/appwiz.cpl/addons.c:static inline char *heap_strdupWtoA(LPCWSTR str)
On Thu, Apr 28, 2011 at 09:54:13AM +0200, Alexey Fisher wrote:
Am Donnerstag, den 28.04.2011, 09:25 +0200 schrieb Marcus Meissner:
On Thu, Apr 28, 2011 at 09:03:51AM +0200, Alexey Fisher wrote:
Am Donnerstag, den 28.04.2011, 10:49 +0400 schrieb Nikolay Sivov:
On 4/28/2011 10:45, Alexey Fisher wrote:
MultiByteToWideChar are called directly only from one function. All other colls in comctl32 go thrue this function.
It was recovered with from dissassambled code.
This is not allowed in Wine development. All you can use is tests, but after this patch you're most likely banned (from comctl32 changes at least).
Ouch... bad start. Hmm... but this code is present in wine-comctl32, it just spread in different parts.
We do not need to follow the original comctl32 bytewise.
You will find however functions called "head_strdupA2W" occasionaly
eg. dlls/wininet/internet.h:heap_strdupWtoA() and heap_strdupAtoW()
if you need to factor out such common tasks as string allocation + conversion.
May be it make sense to place this function to winebase? Looks like there is some duplicates: dlls/mshtml/mshtml_private.h:static inline char *heap_strdupWtoA(LPCWSTR str) dlls/wininet/internet.h:static inline char *heap_strdupWtoA(LPCWSTR str) dlls/appwiz.cpl/addons.c:static inline char *heap_strdupWtoA(LPCWSTR str)
No, as it is not an officially exported API we cannot export it from public headers
Ciao, Marcus