Get rid of W->A calls

Vincent Béron vberon at mecano.gme.usherb.ca
Fri Sep 5 08:57:31 CDT 2003


Le ven 05/09/2003 à 09:41, hatky a écrit :
> Janitorial reporting ;-)
> 
> In the Get rid of W->A calls task,
> Say I try
> dlls/ddraw/main.c: ddraw: DirectDrawEnumerateExW:
> illegal call to DirectDrawEnumerateExA
> 
> The misbheaving function is :
> 
> HRESULT WINAPI DirectDrawEnumerateExW(
>   LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext,
> DWORD dwFlags)
> {
>     DirectDrawEnumerateProcData epd;
>     epd.lpCallback = (LPVOID) lpCallback;
>     epd.lpContext = lpContext;
> 
>     return
> DirectDrawEnumerateExA(DirectDrawEnumerateExProcW,
> (LPVOID) &epd, 0);
> }
> 
> What sould I do?
> 1. copy the entire DirectDrawEnumerateExA into it
Not exactly.
> 2. create a 3rd function DirectDrawEnumerateEx that
> both of them will call
Sometimes it's the way to go, usually not.
> 3. somthing else (you tell me)
Usually, it should be the other way around: A calls W, translating the
parameters on the way in (before calling W) and the way out (before
returning).

I'm not sure about the exact function(s) to use to do the translation,
but I've seen MultiByteToWideChar (or it's reciproqual) used for that a
couple of times. There are other functions too (don't know all the
details).

Vincent




More information about the wine-devel mailing list