Here are the implementations of those functions I did for ReactOS. (and no,
I didnt use disassembler on them this time :)
I am licencing them under whatever licence I need to in order for them to
go into WINE (if the WINE team wants them that is)
They compile on ReactOS just fine. Not sure if they work or not, tests
would be usefull :)
typedef struct _PATRECT {
RECT r;
HBRUSH hBrush;
} PATRECT, * PPATRECT;
/*
* @implemented
*/
DWORD STDCALL WCSToMBEx(WORD CodePage,LPWSTR UnicodeString,LONG
UnicodeSize,LPSTR *MBString,LONG MBSize,BOOL Allocate)
{
DWORD Size;
if (UnicodeSize == -1)
{
UnicodeSize = wcslen(UnicodeString)+1;
}
if (MBSize == -1)
{
if (!Allocate)
{
return 0;
}
MBSize = UnicodeSize * 2;
}
if (Allocate)
{
*MBString = HEAP_alloc(MBSize);
}
if ((CodePage == 0) || (CodePage == NlsAnsiCodePage))
{
RtlUnicodeToMultiByteN(*MBString,MBSize,&Size,UnicodeString,UnicodeSize);
}
else
{
WideCharToMultiByte(CodePage,0,UnicodeString,UnicodeSize,*MBString,MBSize,0,0);
}
return UnicodeSize;
}
/*
* @implemented
*/
DWORD STDCALL MBToWCSEx(WORD CodePage,LPSTR MBString,LONG MBSize,LPWSTR
*UnicodeString,LONG UnicodeSize,BOOL Allocate)
{
DWORD Size;
if (MBSize == -1)
{
MBSize = strlen(MBString)+1;
}
if (UnicodeSize == -1)
{
if (!Allocate)
{
return 0;
}
UnicodeSize = MBSize;
}
if (Allocate)
{
*UnicodeString = HEAP_alloc(UnicodeSize);
}
UnicodeSize *= sizeof(WCHAR);
if ((CodePage == 0) || (CodePage == NlsAnsiCodePage))
{
RtlMultiByteToUnicodeN(*UnicodeString,UnicodeSize,&Size,MBString,MBSize);
}
else
{
Size =
MultiByteToWideChar(CodePage,0,MBString,MBSize,*UnicodeString,UnicodeSize);
}
return Size;
}
/*
* @implemented
*/
WINBOOL
STDCALL
PolyPatBlt(HDC hDC,DWORD dwRop,PPATRECT pRects,int cRects,ULONG Reserved)
{
int i;
PATRECT r;
HBRUSH hBrOld;
for (i = 0;i<cRects;i++)
{
hBrOld = SelectObject(hDC,r.hBrush);
r = *pRects;
PatBlt(hDC,r.r.top,r.r.left,r.r.bottom-r.r.top,r.r.right-r.r.left,dwRop);
pRects+=sizeof(PATRECT);
SelectObject(hDC,hBrOld);
}
return TRUE;
}
BTW, I can also share some of the info I have on other user32 functions I
was able to figure out/find info on if there is a need for it.