DXGL r344 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r343‎ | r344 | r345 >
Date:17:33, 10 March 2013
Author:admin
Status:new
Tags:
Comment:
Create simplified macros for trace functions.
Trace glDirectDraw.cpp
Fix return values for IDirectDraw calls with invalid object.
Fix GetAvailableVidMem
Modified paths:
  • /ddraw/ddraw.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/trace.cpp (modified) (history)
  • /ddraw/trace.h (modified) (history)

Diff [purge]

Index: ddraw/ddraw.cpp
@@ -49,7 +49,7 @@
5050 */
5151 bool IsBadReadPointer(void *ptr)
5252 {
53 - TRACE_ENTER("IsBadReadPointer",1,14,ptr);
 53+ TRACE_ENTER(1,14,ptr);
5454 char a;
5555 try
5656 {
@@ -56,18 +56,18 @@
5757 a = *(char*)ptr;
5858 if(a == *(char*)ptr)
5959 {
60 - TRACE_EXIT("IsBadReadPointer",21,0);
 60+ TRACE_EXIT(21,0);
6161 return false;
6262 }
6363 else
6464 {
65 - TRACE_EXIT("IsBadReadPointer",21,(void*)1);
 65+ TRACE_EXIT(21,1);
6666 return true;
6767 }
6868 }
6969 catch(...)
7070 {
71 - TRACE_EXIT("IsBadReadPointer",21,(void*)1);
 71+ TRACE_EXIT(21,1);
7272 return true;
7373 }
7474 }
@@ -74,69 +74,69 @@
7575
7676 void InitGL(int width, int height, int bpp, bool fullscreen, HWND hWnd, glDirectDraw7 *glDD7)
7777 {
78 - TRACE_ENTER("InitGL",6,11,width,11,height,11,bpp,21,fullscreen,13,hWnd,14,glDD7);
 78+ TRACE_ENTER(6,11,width,11,height,11,bpp,21,fullscreen,13,hWnd,14,glDD7);
7979 if(!renderer) renderer = new glRenderer(width,height,bpp,fullscreen,hWnd,glDD7);
8080 else renderer->SetWnd(width,height,bpp,fullscreen,hWnd);
81 - TRACE_EXIT("InitGL",0,0);
 81+ TRACE_EXIT(0,0);
8282 }
8383
8484 /// Stub for function found in system ddraw.dll
8585 DDRAW_API void WINAPI AcquireDDThreadLock()
8686 {
87 - TRACE_ENTER("AcquireDDThreadLock",0);
 87+ TRACE_ENTER(0);
8888 // FIXME: Add thread lock
8989 FIXME("AcquireDDThreadLock: stub\n");
90 - TRACE_EXIT("AcquireDDThreadLock",0,0);
 90+ TRACE_EXIT(0,0);
9191 }
9292
9393 /// Stub for function found in system ddraw.dll
9494 DDRAW_API void WINAPI CompleteCreateSystemSurface()
9595 {
96 - TRACE_ENTER("CompleteCreateSystemSurface",0);
 96+ TRACE_ENTER(0);
9797 FIXME("CompleteCreateSystemSurface: stub\n");
98 - TRACE_EXIT("CompleteCreateSystemSurface",0,0);
 98+ TRACE_EXIT(0,0);
9999 }
100100
101101 /// Stub for function found in system ddraw.dll
102102 DDRAW_API void WINAPI D3DParseUnknownCommand()
103103 {
104 - TRACE_ENTER("D3DParseUnknownCommand",0);
 104+ TRACE_ENTER(0);
105105 FIXME("D3DParseUnknownCommand: stub\n");
106 - TRACE_EXIT("D3DParseUnknownCommand",0,0);
 106+ TRACE_EXIT(0,0);
107107 }
108108
109109 /// Stub for function found in system ddraw.dll
110110 DDRAW_API void WINAPI DDGetAttachedSurfaceLcl()
111111 {
112 - TRACE_ENTER("DDGetAttachedSurfaceLcl",0);
 112+ TRACE_ENTER(0);
113113 FIXME("DDGetAttachedSurfaceLcl: stub\n");
114 - TRACE_EXIT("DDGetAttachedSurfaceLcl",0,0);
 114+ TRACE_EXIT(0,0);
115115 }
116116
117117 /// Stub for function found in system ddraw.dll
118118 DDRAW_API void WINAPI DDInternalLock()
119119 {
120 - TRACE_ENTER("DDInternalLock",0);
 120+ TRACE_ENTER(0);
121121 //FIXME: Add locking code
122122 FIXME("DDInternalLock: stub\n");
123 - TRACE_EXIT("DDInternalLock",0,0);
 123+ TRACE_EXIT(0,0);
124124 }
125125
126126 /// Stub for function found in system ddraw.dll
127127 DDRAW_API void WINAPI DDInternalUnlock()
128128 {
129 - TRACE_ENTER("DDInternalUnlock",0);
 129+ TRACE_ENTER(0);
130130 //FIXME: Add unlocking code
131131 FIXME("DDInternalUnlock: stub\n");
132 - TRACE_EXIT("DDInternalUnlock",0,0);
 132+ TRACE_EXIT(0,0);
133133 }
134134
135135 /// Stub for function found in system ddraw.dll
136136 DDRAW_API void WINAPI DSoundHelp()
137137 {
138 - TRACE_ENTER("DSoundHelp",0);
 138+ TRACE_ENTER(0);
139139 FIXME("DSoundHelp: stub\n");
140 - TRACE_EXIT("DSoundHelp",0,0);
 140+ TRACE_EXIT(0,0);
141141 }
142142
143143 /**
@@ -152,7 +152,7 @@
153153 */
154154 BOOL IsCallerOpenGL(void *returnaddress)
155155 {
156 - TRACE_ENTER("IsCallerOpenGL",1,14,returnaddress);
 156+ TRACE_ENTER(1,14,returnaddress);
157157 int isgl = 0;
158158 MODULEENTRY32 modentry = {0};
159159 HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,0);
@@ -168,7 +168,7 @@
169169 }
170170 } while(Module32Next(hSnapshot,&modentry));
171171 CloseHandle(hSnapshot);
172 - TRACE_EXIT("IsCallerOpenGL",22,(void*)isgl);
 172+ TRACE_EXIT(22,isgl);
173173 return isgl;
174174 }
175175
@@ -189,7 +189,7 @@
190190 */
191191 HRESULT WINAPI DirectDrawCreate(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter)
192192 {
193 - TRACE_ENTER("DirectDrawCreate",3,24,lpGUID,14,lplpDD,14,pUnkOuter);
 193+ TRACE_ENTER(3,24,lpGUID,14,lplpDD,14,pUnkOuter);
194194 HRESULT ret;
195195 if(gllock || IsCallerOpenGL(_ReturnAddress()))
196196 {
@@ -201,7 +201,7 @@
202202 sysddraw = LoadLibraryA(buffer);
203203 if(!sysddraw)
204204 {
205 - TRACE_EXIT("DirectDrawCreate",23,(void*)DDERR_GENERIC);
 205+ TRACE_EXIT(23,DDERR_GENERIC);
206206 ERR(DDERR_GENERIC);
207207 }
208208 }
@@ -210,18 +210,18 @@
211211 sysddrawcreate = (HRESULT(WINAPI *)(GUID FAR*,LPDIRECTDRAW FAR*, IUnknown FAR*))GetProcAddress(sysddraw,"DirectDrawCreate");
212212 if(!sysddrawcreate)
213213 {
214 - TRACE_EXIT("DirectDrawCreate",23,(void*)DDERR_GENERIC);
 214+ TRACE_EXIT(23,DDERR_GENERIC);
215215 ERR(DDERR_GENERIC);
216216 }
217217 }
218218 ret = sysddrawcreate(lpGUID,lplpDD,pUnkOuter);
219 - TRACE_VAR("DirectDrawCreate","lplpDD",14,*lplpDD);
220 - TRACE_EXIT("DirectDrawCreate",23,(void*)ret);
 219+ TRACE_VAR("*lplpDD",14,*lplpDD);
 220+ TRACE_EXIT(23,ret);
221221 return ret;
222222 }
223223 if(dxglinterface)
224224 {
225 - TRACE_EXIT("DirectDrawCreate",23,(void*)DDERR_DIRECTDRAWALREADYCREATED);
 225+ TRACE_EXIT(23,DDERR_DIRECTDRAWALREADYCREATED);
226226 return DDERR_DIRECTDRAWALREADYCREATED;
227227 }
228228 GetCurrentConfig(&dxglcfg);
@@ -233,14 +233,14 @@
234234 if(error != DD_OK)
235235 {
236236 delete myddraw7;
237 - TRACE_EXIT("DirectDrawCreate",23,(void*)error);
 237+ TRACE_EXIT(23,error);
238238 return error;
239239 }
240240 myddraw7->QueryInterface(IID_IDirectDraw,(VOID**)&myddraw);
241241 myddraw7->Release();
242242 *lplpDD = (LPDIRECTDRAW)myddraw;
243 - TRACE_VAR("DirectDrawCreate","*lplpDD",14,*lplpDD);
244 - TRACE_EXIT("DirectDrawCreate",23,(void*)error);
 243+ TRACE_VAR("*lplpDD",14,*lplpDD);
 244+ TRACE_EXIT(23,error);
245245 return error;
246246 }
247247
@@ -259,15 +259,15 @@
260260 */
261261 HRESULT WINAPI DirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
262262 {
263 - TRACE_ENTER("DirectDrawCreateClipper",3,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
 263+ TRACE_ENTER(3,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
264264 *lplpDDClipper = new glDirectDrawClipper(dwFlags,NULL);
265265 if(!lplpDDClipper)
266266 {
267 - TRACE_EXIT("DirectDrawCreateClipper",23,(void*)DDERR_OUTOFMEMORY);
 267+ TRACE_EXIT(23,DDERR_OUTOFMEMORY);
268268 return DDERR_OUTOFMEMORY;
269269 }
270 - TRACE_VAR("DirectDrawCreateClipper","*lplpDDClipper",14,*lplpDDClipper);
271 - TRACE_EXIT("DirectDrawCreateClipper",23,(void*)DD_OK);
 270+ TRACE_VAR("*lplpDDClipper",14,*lplpDDClipper);
 271+ TRACE_EXIT(23,DD_OK);
272272 return DD_OK;
273273 }
274274
@@ -290,10 +290,10 @@
291291 */
292292 HRESULT WINAPI DirectDrawCreateEx(GUID FAR *lpGUID, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter)
293293 {
294 - TRACE_ENTER("DirectDrawCreateEx",4,24,lpGUID,14,lplpDD,24,&iid,14,pUnkOuter);
 294+ TRACE_ENTER(4,24,lpGUID,14,lplpDD,24,&iid,14,pUnkOuter);
295295 if(dxglinterface)
296296 {
297 - TRACE_EXIT("DirectDrawCreateEx",23,(void*)DDERR_DIRECTDRAWALREADYCREATED);
 297+ TRACE_EXIT(23,DDERR_DIRECTDRAWALREADYCREATED);
298298 return DDERR_DIRECTDRAWALREADYCREATED;
299299 }
300300 GetCurrentConfig(&dxglcfg);
@@ -301,7 +301,7 @@
302302 HRESULT error;
303303 if(iid != IID_IDirectDraw7)
304304 {
305 - TRACE_EXIT("DirectDrawCreateEx",23,(void*)DDERR_INVALIDPARAMS);
 305+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
306306 return DDERR_INVALIDPARAMS;
307307 }
308308 myddraw = new glDirectDraw7(lpGUID,pUnkOuter);
@@ -309,12 +309,12 @@
310310 if(error != DD_OK)
311311 {
312312 delete myddraw;
313 - TRACE_EXIT("DirectDrawCreateEx",23,(void*)error);
 313+ TRACE_EXIT(23,error);
314314 return error;
315315 }
316316 *lplpDD = (LPDIRECTDRAW7)myddraw;
317 - TRACE_VAR("DirectDrawCreateEx","*lplpDD",14,*lplpDD);
318 - TRACE_EXIT("DirectDrawCreateEx",23,(void*)error);
 317+ TRACE_VAR("*lplpDD",14,*lplpDD);
 318+ TRACE_EXIT(23,error);
319319 return error;
320320 }
321321
@@ -321,11 +321,11 @@
322322 /// Callback wrapper for DirectDrawEnumerateA
323323 BOOL WINAPI DDEnumA(GUID FAR *guid, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hMonitor)
324324 {
325 - TRACE_ENTER("DDEnumA",5,24,guid,15,lpDriverDescription,15,lpDriverName,14,lpContext,13,hMonitor);
 325+ TRACE_ENTER(5,24,guid,15,lpDriverDescription,15,lpDriverName,14,lpContext,13,hMonitor);
326326 int *context = (int *)lpContext;
327327 LPDDENUMCALLBACKA callback = (LPDDENUMCALLBACKA)context[0];
328328 BOOL ret = callback(guid,lpDriverDescription,lpDriverName,(LPVOID)context[1]);
329 - TRACE_EXIT("DDEnumA",22,(void*)ret);
 329+ TRACE_EXIT(22,ret);
330330 return ret;
331331 }
332332
@@ -342,10 +342,10 @@
343343 */
344344 HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
345345 {
346 - TRACE_ENTER("DirectDrawEnumerateA",2,14,lpCallback,14,lpContext);
 346+ TRACE_ENTER(2,14,lpCallback,14,lpContext);
347347 if(IsBadReadPointer(lpCallback))
348348 {
349 - TRACE_EXIT("DirectDrawEnumerateA",23,(void*)DDERR_INVALIDPARAMS);
 349+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
350350 return DDERR_INVALIDPARAMS;
351351 }
352352 LPVOID context[2];
@@ -352,7 +352,7 @@
353353 context[0] = (LPVOID) lpCallback;
354354 context[1] = lpContext;
355355 HRESULT ret = DirectDrawEnumerateExA(DDEnumA,&context,0);
356 - TRACE_EXIT("DirectDrawEnumerateA",23,(void*)ret);
 356+ TRACE_EXIT(23,ret);
357357 return ret;
358358 }
359359
@@ -359,11 +359,11 @@
360360 /// Callback wrapper for DirectDrawEnumerateW
361361 BOOL WINAPI DDEnumW(GUID FAR *guid, LPWSTR lpDriverDescription, LPWSTR lpDriverName, LPVOID lpContext, HMONITOR hMonitor)
362362 {
363 - TRACE_ENTER("DDEnumW",5,24,guid,16,lpDriverDescription,16,lpDriverName,14,lpContext,13,hMonitor);
 363+ TRACE_ENTER(5,24,guid,16,lpDriverDescription,16,lpDriverName,14,lpContext,13,hMonitor);
364364 int *context = (int *)lpContext;
365365 LPDDENUMCALLBACKW callback = (LPDDENUMCALLBACKW)context[0];
366366 BOOL ret = callback(guid,lpDriverDescription,lpDriverName,(LPVOID)context[1]);
367 - TRACE_EXIT("DDEnumW",22,(void*)ret);
 367+ TRACE_EXIT(22,ret);
368368 return ret;
369369 }
370370
@@ -380,10 +380,10 @@
381381 */
382382 HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
383383 {
384 - TRACE_ENTER("DirectDrawEnumerateW",2,14,lpCallback,14,lpContext);
 384+ TRACE_ENTER(2,14,lpCallback,14,lpContext);
385385 if(IsBadReadPointer(lpCallback))
386386 {
387 - TRACE_EXIT("DirectDrawEnumerateW",23,(void*)DDERR_INVALIDPARAMS);
 387+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
388388 return DDERR_INVALIDPARAMS;
389389 }
390390 LPVOID context[2];
@@ -390,7 +390,7 @@
391391 context[0] = (LPVOID) lpCallback;
392392 context[1] = lpContext;
393393 HRESULT ret = DirectDrawEnumerateExW(DDEnumW,&context,0);
394 - TRACE_EXIT("DirectDrawEnumerateW",23,(void*)ret);
 394+ TRACE_EXIT(23,ret);
395395 return ret;
396396 }
397397
@@ -398,7 +398,7 @@
399399 /// Converts Unicode strings to ANSI.
400400 BOOL WINAPI DDEnumExA(GUID FAR *guid, LPWSTR lpDriverDescription, LPWSTR lpDriverName, LPVOID lpContext, HMONITOR hMonitor)
401401 {
402 - TRACE_ENTER("DDEnumExA",5,24,guid,16,lpDriverDescription,16,lpDriverName,14,lpContext,13,hMonitor);
 402+ TRACE_ENTER(5,24,guid,16,lpDriverDescription,16,lpDriverName,14,lpContext,13,hMonitor);
403403 int *context = (int *)lpContext;
404404 LPDDENUMCALLBACKEXA callback = (LPDDENUMCALLBACKEXA)context[0];
405405 CHAR desc[MAX_PATH];
@@ -406,7 +406,7 @@
407407 WideCharToMultiByte(CP_ACP,0,lpDriverDescription,-1,desc,MAX_PATH,NULL,NULL);
408408 WideCharToMultiByte(CP_ACP,0,lpDriverName,-1,driver,MAX_PATH,NULL,NULL);
409409 BOOL ret = callback(guid,desc,driver,(LPVOID)context[1],hMonitor);
410 - TRACE_EXIT("DDEnumExA",22,(void*)ret);
 410+ TRACE_EXIT(22,ret);
411411 return ret;
412412 }
413413
@@ -426,10 +426,10 @@
427427 */
428428 HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags)
429429 {
430 - TRACE_ENTER("DirectDrawEnumerateExA",3,14,lpCallback,14,lpContext,9,dwFlags);
 430+ TRACE_ENTER(3,14,lpCallback,14,lpContext,9,dwFlags);
431431 if(IsBadReadPointer(lpCallback))
432432 {
433 - TRACE_EXIT("DirectDrawEnumerateExA",23,(void*)DDERR_INVALIDPARAMS);
 433+ TRACE_EXIT(23,DDERR_INVALIDPARAMS);
434434 return DDERR_INVALIDPARAMS;
435435 }
436436 LPVOID context[2];
@@ -436,7 +436,7 @@
437437 context[0] = (LPVOID) lpCallback;
438438 context[1] = lpContext;
439439 HRESULT ret = DirectDrawEnumerateExW(DDEnumExA,&context,dwFlags);
440 - TRACE_EXIT("DirectDrawEnumerateExA",23,(void*)ret);
 440+ TRACE_EXIT(23,ret);
441441 return ret;
442442 }
443443
@@ -450,7 +450,7 @@
451451 */
452452 BOOL CALLBACK MonitorEnum(HMONITOR hMonitor, HDC unused, LPRECT unused2, LPARAM ptr)
453453 {
454 - TRACE_ENTER("MonitorEnum",4,13,hMonitor,13,unused,26,unused2,13,ptr);
 454+ TRACE_ENTER(4,13,hMonitor,13,unused,26,unused2,13,ptr);
455455 int * monitors = *(int**)ptr;
456456 if(!monitors)
457457 {
@@ -457,7 +457,7 @@
458458 monitors = (int*)malloc(256*sizeof(int));
459459 if(!monitors)
460460 {
461 - TRACE_EXIT("MonitorEnum",22,(void*)FALSE);
 461+ TRACE_EXIT(22,FALSE);
462462 return FALSE;
463463 }
464464 monitors[0] = 1;
@@ -468,7 +468,8 @@
469469 BOOL ret;
470470 if(monitors[0] == 255) ret = FALSE;
471471 else ret = TRUE;
472 - TRACE_EXIT("MonitorEnum",22,(void*)ret);
 472+ TRACE_EXIT(22,ret);
 473+ return ret;
473474 }
474475
475476 /**
@@ -486,10 +487,10 @@
487488 */
488489 HRESULT WINAPI DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags)
489490 {
490 - TRACE_ENTER("DirectDrawEnumerateExW",3,14,lpCallback,14,lpContext,9,dwFlags);
 491+ TRACE_ENTER(3,14,lpCallback,14,lpContext,9,dwFlags);
491492 if(IsBadReadPointer(lpCallback))
492493 {
493 - TRACE_EXIT("DirectDrawEnumerateExW",23,(void*)DDERR_GENERIC);
 494+ TRACE_EXIT(23,DDERR_GENERIC);
494495 return DDERR_INVALIDPARAMS;
495496 }
496497 int *monitors = NULL;
@@ -504,7 +505,7 @@
505506 EnumDisplayMonitors(NULL,NULL,MonitorEnum,(LPARAM)&monitors);
506507 if(!monitors)
507508 {
508 - TRACE_EXIT("DirectDrawEnumerateExW",23,(void*)DDERR_OUTOFMEMORY);
 509+ TRACE_EXIT(23,DDERR_OUTOFMEMORY);
509510 return DDERR_OUTOFMEMORY;
510511 }
511512 for(int i = 1; i < monitors[0]; i++)
@@ -517,7 +518,7 @@
518519 }
519520 free(monitors);
520521 }
521 - TRACE_EXIT("DirectDrawEnumerateExW",23,(void*)DDERR_OUTOFMEMORY);
 522+ TRACE_EXIT(23,DD_OK);
522523 return DD_OK;
523524 }
524525
@@ -529,8 +530,8 @@
530531 */
531532 HRESULT WINAPI DllCanUnloadNow()
532533 {
533 - TRACE_ENTER("DllCanUnloadNow",0);
534 - TRACE_EXIT("DllCanUnloadNow",23,(void*)S_FALSE);
 534+ TRACE_ENTER(0);
 535+ TRACE_EXIT(23,S_FALSE);
535536 return S_FALSE;
536537 }
537538
@@ -548,11 +549,11 @@
549550 */
550551 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
551552 {
552 - TRACE_ENTER("DllGetClassObject",3,24,&rclsid,24,&riid,14,ppv);
 553+ TRACE_ENTER(3,24,&rclsid,24,&riid,14,ppv);
553554 if((rclsid != CLSID_DirectDraw) && (rclsid != CLSID_DirectDraw7) &&
554555 (rclsid != CLSID_DirectDrawClipper))
555556 {
556 - TRACE_EXIT("DllGetClassObject",23,(void*)CLASS_E_CLASSNOTAVAILABLE);
 557+ TRACE_EXIT(23,CLASS_E_CLASSNOTAVAILABLE);
557558 return CLASS_E_CLASSNOTAVAILABLE;
558559 }
559560 GetCurrentConfig(&dxglcfg);
@@ -559,13 +560,13 @@
560561 glClassFactory *factory = new glClassFactory;
561562 if(factory == NULL)
562563 {
563 - TRACE_EXIT("DllGetClassObject",23,(void*)E_OUTOFMEMORY);
 564+ TRACE_EXIT(23,E_OUTOFMEMORY);
564565 return E_OUTOFMEMORY;
565566 }
566567 HRESULT result = factory->QueryInterface(riid,ppv);
567 - TRACE_VAR("DllGetClassObject","*ppv",14,*ppv);
 568+ TRACE_VAR("*ppv",14,*ppv);
568569 factory->Release();
569 - TRACE_EXIT("DllGetClassObject",23,(void*)result);
 570+ TRACE_EXIT(23,result);
570571 return result;
571572 }
572573
@@ -572,8 +573,8 @@
573574 /// Stub for function found in system ddraw.dll
574575 DDRAW_API void WINAPI GetDDSurfaceLocal()
575576 {
576 - TRACE_ENTER("GetDDSurfaceLocal",0);
577 - TRACE_EXIT("GetDDSurfaceLocal",0,0);
 577+ TRACE_ENTER(0);
 578+ TRACE_EXIT(0,0);
578579 FIXME("GetDDSurfaceLocal: stub\n");
579580 }
580581
@@ -581,8 +582,8 @@
582583 /// This function gets called by the fnddraw.exe test application.
583584 DDRAW_API HANDLE WINAPI GetOLEThunkData(int i1)
584585 {
585 - TRACE_ENTER("GetOLEThunkData",1,9,i1);
586 - TRACE_EXIT("GetOleThunkData",14,NULL);
 586+ TRACE_ENTER(1,9,i1);
 587+ TRACE_EXIT(14,NULL);
587588 DEBUG("GetOleThunkData: stub\n");
588589 return 0;
589590 }
@@ -591,11 +592,11 @@
592593 /// Function import is GetSurfaceFromDC
593594 DDRAW_API HRESULT WINAPI GlobalGetSurfaceFromDC(LPDIRECTDRAW7 lpDD, HDC hdc, LPDIRECTDRAWSURFACE7 *lpDDS)
594595 {
595 - TRACE_ENTER("GetSurfaceFromDC",3,14,lpDD,9,hdc,14,lpDDS);
 596+ TRACE_ENTER(3,14,lpDD,9,hdc,14,lpDDS);
596597 FIXME("GetSurfaceFromDC: Verify proper referencing for LPDIRECTDRAW7\n");
597598 HRESULT ret = lpDD->GetSurfaceFromDC(hdc,lpDDS);
598 - TRACE_VAR("GetSurfaceFromDC","*lpDDS",14,*lpDDS);
599 - TRACE_EXIT("GetSurfaceFromDC",23,(void*)ret);
 599+ TRACE_VAR("*lpDDS",14,*lpDDS);
 600+ TRACE_EXIT(23,ret);
600601 return ret;
601602 }
602603
@@ -602,25 +603,25 @@
603604 /// Stub for function found in system ddraw.dll
604605 DDRAW_API void WINAPI RegisterSpecialCase()
605606 {
606 - TRACE_ENTER("RegisterSpecialCase",0);
 607+ TRACE_ENTER(0);
607608 FIXME("RegisterSpecialCase: stub\n");
608 - TRACE_EXIT("RegisterSpecialCase",0,0);
 609+ TRACE_EXIT(0,0);
609610 }
610611
611612 /// Stub for function found in system ddraw.dll
612613 DDRAW_API void WINAPI ReleaseDDThreadLock()
613614 {
614 - TRACE_ENTER("ReleaseDDThreadLock",0);
 615+ TRACE_ENTER(0);
615616 FIXME("ReleaseDDThreadLock: stub\n");
616 - TRACE_EXIT("ReleaseDDThreadLock",0,0);
 617+ TRACE_EXIT(0,0);
617618 }
618619
619620 /// Stub for function found in system ddraw.dll
620621 DDRAW_API void WINAPI SetAppCompatData()
621622 {
622 - TRACE_ENTER("SetAppCompatData",0);
 623+ TRACE_ENTER(0);
623624 FIXME("SetAppCompatData: stub\n");
624 - TRACE_EXIT("SetAppCompatData",0,0);
 625+ TRACE_EXIT(0,0);
625626 }
626627
627628 /**
@@ -636,7 +637,7 @@
637638
638639 DDRAW_API BOOL IsDXGLDDraw()
639640 {
640 - TRACE_ENTER("IsDXGLDDraw",0);
641 - TRACE_EXIT("IsDXGLDDraw",0,0);
 641+ TRACE_ENTER(0);
 642+ TRACE_EXIT(0,0);
642643 return TRUE;
643644 }
Index: ddraw/glDirectDraw.cpp
@@ -551,6 +551,7 @@
552552
553553 glDirectDraw7::glDirectDraw7()
554554 {
 555+ TRACE_ENTER(1,14,this);
555556 glDD1 = NULL;
556557 glDD2 = NULL;
557558 glDD4 = NULL;
@@ -560,24 +561,29 @@
561562 initialized = false;
562563 devid.liDriverVersion.QuadPart = DXGLVERQWORD;
563564 refcount = 1;
 565+ TRACE_EXIT(-1,0);
564566 }
565567
566568 glDirectDraw7::glDirectDraw7(GUID FAR* lpGUID, IUnknown FAR* pUnkOuter)
567569 {
 570+ TRACE_ENTER(3,14,this,24,lpGUID,14,pUnkOuter);
568571 dxglinterface = this;
569572 initialized = false;
570573 if(pUnkOuter)
571574 {
572575 error = DDERR_INVALIDPARAMS ;
 576+ TRACE_EXIT(-1,0);
573577 return;
574578 }
575579 devid.liDriverVersion.QuadPart = DXGLVERQWORD;
576580 error = glDirectDraw7::Initialize(lpGUID);
577581 refcount = 1;
 582+ TRACE_EXIT(-1,0);
578583 }
579584
580585 glDirectDraw7::~glDirectDraw7()
581586 {
 587+ TRACE_ENTER(1,14,this);
582588 dxglinterface = NULL;
583589 if(glD3D7) glD3D7->Release();
584590 RestoreDisplayMode();
@@ -601,16 +607,20 @@
602608 }
603609 if(renderer) delete renderer;
604610 renderer = NULL;
 611+ TRACE_EXIT(-1,0);
605612 }
606613
607614 HRESULT WINAPI glDirectDraw7::QueryInterface(REFIID riid, void** ppvObj)
608615 {
609 - if(!this) return DDERR_INVALIDPARAMS;
610 - if(!ppvObj) return DDERR_INVALIDPARAMS;
 616+ TRACE_ENTER(3,this,24,riid,14,ppvObj);
 617+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 618+ if(!ppvObj) TRACE_RET(23,DDERR_INVALIDPARAMS);
611619 if(riid == IID_IUnknown)
612620 {
613621 this->AddRef();
614622 *ppvObj = this;
 623+ TRACE_VAR("*ppvObj",14,*ppvObj);
 624+ TRACE_EXIT(23,DD_OK);
615625 return DD_OK;
616626 }
617627 if(riid == IID_IDirectDraw)
@@ -619,6 +629,8 @@
620630 {
621631 *ppvObj = glDD1;
622632 glDD1->AddRef();
 633+ TRACE_VAR("*ppvObj",14,*ppvObj);
 634+ TRACE_EXIT(23,DD_OK);
623635 return DD_OK;
624636 }
625637 else
@@ -627,6 +639,8 @@
628640 this->AddRef();
629641 *ppvObj = new glDirectDraw1(this);
630642 glDD1 = (glDirectDraw1*)*ppvObj;
 643+ TRACE_VAR("*ppvObj",14,*ppvObj);
 644+ TRACE_EXIT(23,DD_OK);
631645 return DD_OK;
632646 }
633647 }
@@ -636,6 +650,8 @@
637651 {
638652 *ppvObj = glDD2;
639653 glDD2->AddRef();
 654+ TRACE_VAR("*ppvObj",14,*ppvObj);
 655+ TRACE_EXIT(23,DD_OK);
640656 return DD_OK;
641657 }
642658 else
@@ -644,6 +660,8 @@
645661 this->AddRef();
646662 *ppvObj = new glDirectDraw2(this);
647663 glDD2 = (glDirectDraw2*)*ppvObj;
 664+ TRACE_VAR("*ppvObj",14,*ppvObj);
 665+ TRACE_EXIT(23,DD_OK);
648666 return DD_OK;
649667 }
650668 }
@@ -653,6 +671,8 @@
654672 {
655673 *ppvObj = glDD4;
656674 glDD4->AddRef();
 675+ TRACE_VAR("*ppvObj",14,*ppvObj);
 676+ TRACE_EXIT(23,DD_OK);
657677 return DD_OK;
658678 }
659679 else
@@ -661,6 +681,8 @@
662682 this->AddRef();
663683 *ppvObj = new glDirectDraw4(this);
664684 glDD4 = (glDirectDraw4*)*ppvObj;
 685+ TRACE_VAR("*ppvObj",14,*ppvObj);
 686+ TRACE_EXIT(23,DD_OK);
665687 return DD_OK;
666688 }
667689 }
@@ -669,6 +691,8 @@
670692 // Probably non-DX compliant, but give a copy of the IDirectDraw7 interface
671693 this->AddRef();
672694 *ppvObj = this;
 695+ TRACE_VAR("*ppvObj",14,*ppvObj);
 696+ TRACE_EXIT(23,DD_OK);
673697 return DD_OK;
674698 }
675699 if(riid == IID_IDirect3D)
@@ -676,6 +700,8 @@
677701 glDirect3D7 *tmp = new glDirect3D7(this);
678702 tmp->QueryInterface(IID_IDirect3D,ppvObj);
679703 tmp->Release();
 704+ TRACE_VAR("*ppvObj",14,*ppvObj);
 705+ TRACE_EXIT(23,DD_OK);
680706 return DD_OK;
681707 }
682708 if(riid == IID_IDirect3D2)
@@ -683,6 +709,8 @@
684710 glDirect3D7 *tmp = new glDirect3D7(this);
685711 tmp->QueryInterface(IID_IDirect3D2,ppvObj);
686712 tmp->Release();
 713+ TRACE_VAR("*ppvObj",14,*ppvObj);
 714+ TRACE_EXIT(23,DD_OK);
687715 return DD_OK;
688716 }
689717 if(riid == IID_IDirect3D3)
@@ -690,16 +718,21 @@
691719 glDirect3D7 *tmp = new glDirect3D7(this);
692720 tmp->QueryInterface(IID_IDirect3D3,ppvObj);
693721 tmp->Release();
 722+ TRACE_VAR("*ppvObj",14,*ppvObj);
 723+ TRACE_EXIT(23,DD_OK);
694724 return DD_OK;
695725 }
696726 if(riid == IID_IDirect3D7)
697727 {
698728 *ppvObj = new glDirect3D7(this);
 729+ TRACE_VAR("*ppvObj",14,*ppvObj);
 730+ TRACE_EXIT(23,DD_OK);
699731 return DD_OK;
700732 }
701733 if(riid == IID_IDirectDrawGammaControl)
702734 {
703735 FIXME("Add gamma control\n");
 736+ TRACE_EXIT(23,DDERR_GENERIC);
704737 ERR(DDERR_GENERIC);
705738 }
706739 /*if(riid == IID_IDDVideoPortContainer)
@@ -706,39 +739,48 @@
707740 {
708741 ERR(DDERR_GENERIC);
709742 }*/
 743+ TRACE_EXIT(23,E_NOINTERFACE);
710744 ERR(E_NOINTERFACE);
711745 }
712746 ULONG WINAPI glDirectDraw7::AddRef()
713747 {
714 - if(!this) return 0;
 748+ TRACE_ENTER(1,14,this);
 749+ if(!this) TRACE_RET(8,0);
715750 refcount++;
 751+ TRACE_EXIT(8,refcount);
716752 return refcount;
717753 }
718754 ULONG WINAPI glDirectDraw7::Release()
719755 {
720 - if(!this) return 0;
 756+ TRACE_ENTER(1,14,this);
 757+ if(!this) TRACE_RET(8,0);
721758 ULONG ret;
722759 refcount--;
723760 ret = refcount;
724761 if(refcount == 0)
725762 delete this;
 763+ TRACE_EXIT(8,ret);
726764 return ret;
727765 }
728766 HRESULT WINAPI glDirectDraw7::Compact()
729767 {
730 - if(!this) return DDERR_INVALIDPARAMS;
 768+ TRACE_ENTER(1,14,this);
 769+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 770+ TRACE_EXIT(23,DD_OK);
731771 return DD_OK;
732772 }
733773 HRESULT WINAPI glDirectDraw7::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
734774 {
735 - if(!this) return DDERR_INVALIDPARAMS;
 775+ TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
 776+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 777+ if(!lplpDDClipper) TRACE_RET(23,DDERR_INVALIDPARAMS);
 778+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
736779 clippercount++;
737780 if(clippercount > clippercountmax)
738781 {
739782 glDirectDrawClipper **clippers2;
740783 clippers2 = (glDirectDrawClipper **)realloc(clippers,(clippercountmax+1024)*sizeof(glDirectDrawClipper *));
741 - if(!clippers2)
742 - ERR(DDERR_OUTOFMEMORY);
 784+ if(!clippers2) TRACE_RET(23,DDERR_OUTOFMEMORY);
743785 clippers = clippers2;
744786 ZeroMemory(&clippers[clippercountmax],1024*sizeof(glDirectDrawClipper *));
745787 clippercountmax += 1024;
@@ -745,18 +787,27 @@
746788 }
747789 clippers[clippercount-1] = new glDirectDrawClipper(dwFlags,this);
748790 *lplpDDClipper = clippers[clippercount-1];
 791+ TRACE_VAR("*lplpDDClipper",14,*lplpDDClipper);
 792+ TRACE_EXIT(23,DD_OK);
749793 return DD_OK;
750794 }
751795 HRESULT WINAPI glDirectDraw7::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
752796 {
753 - if(!this) return DDERR_INVALIDPARAMS;
 797+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette,14,pUnkOuter);
 798+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 799+ if(!lplpDDPalette) TRACE_RET(23,DDERR_INVALIDPARAMS);
 800+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
754801 glDirectDrawPalette *pal = new glDirectDrawPalette(dwFlags,lpDDColorArray,lplpDDPalette);
 802+ TRACE_VAR("*lplpDDPalette",14,*lplpDDPalette);
 803+ TRACE_EXIT(23,DD_OK);
755804 return DD_OK;
756805 }
757806 HRESULT WINAPI glDirectDraw7::CreateSurface(LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 FAR *lplpDDSurface, IUnknown FAR *pUnkOuter)
758807 {
759 - if(!this) return DDERR_INVALIDPARAMS;
760 - if(!lpDDSurfaceDesc2) return DDERR_INVALIDPARAMS;
 808+ TRACE_ENTER(4,14,this,14,lpDDSurfaceDesc2,14,lplpDDSurface,14,pUnkOuter);
 809+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 810+ if(!lpDDSurfaceDesc2) TRACE_RET(23,DDERR_INVALIDPARAMS);
 811+ if(pUnkOuter) TRACE_RET(23,DDERR_INVALIDPARAMS);
761812 if(primary && (lpDDSurfaceDesc2->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && (renderer->hRC == primary->hRC) )
762813 {
763814 if(primarylost)
@@ -764,9 +815,10 @@
765816 primary->Restore();
766817 *lplpDDSurface = primary;
767818 primarylost = false;
 819+ TRACE_EXIT(23,DD_OK);
768820 return DD_OK;
769821 }
770 - else return DDERR_PRIMARYSURFACEALREADYEXISTS;
 822+ else TRACE_RET(23,DDERR_PRIMARYSURFACEALREADYEXISTS);
771823 }
772824 surfacecount++;
773825 if(surfacecount > surfacecountmax)
@@ -773,8 +825,7 @@
774826 {
775827 glDirectDrawSurface7 **surfaces2;
776828 surfaces2 = (glDirectDrawSurface7 **)realloc(surfaces,(surfacecountmax+1024)*sizeof(glDirectDrawSurface7 *));
777 - if(!surfaces2)
778 - ERR(DDERR_OUTOFMEMORY);
 829+ if(!surfaces2) TRACE_RET(23,DDERR_OUTOFMEMORY);
779830 surfaces = surfaces2;
780831 ZeroMemory(&surfaces[surfacecountmax],1024*sizeof(glDirectDrawSurface7 *));
781832 surfacecountmax += 1024;
@@ -787,28 +838,44 @@
788839 primarylost = false;
789840 }
790841 *lplpDDSurface = surfaces[surfacecount-1];
 842+ TRACE_VAR("*lplpDDSurface",14,*lplpDDSurface);
 843+ TRACE_EXIT(23,error);
791844 return error;
792845 }
793846 HRESULT WINAPI glDirectDraw7::DuplicateSurface(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDIRECTDRAWSURFACE7 FAR *lplpDupDDSurface)
794847 {
795 - if(!this) return DDERR_INVALIDPARAMS;
 848+ TRACE_ENTER(3,14,this,14,lpDDSurface,14,lplpDupDDSurface);
 849+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 850+ if(!lpDDSurface) TRACE_RET(23,DDERR_INVALIDPARAMS);
 851+ if(!lplpDupDDSurface) TRACE_RET(23,DDERR_INVALIDPARAMS);
796852 FIXME("IDirectDraw::DuplicateSurface: stub\n");
 853+ TRACE_EXIT(23,DDERR_GENERIC);
797854 ERR(DDERR_GENERIC);
798855 }
799856 HRESULT WINAPI glDirectDraw7::EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback)
800857 {
801 - if(!this) return DDERR_INVALIDPARAMS;
802 - return ::EnumDisplayModes(dwFlags,lpDDSurfaceDesc2,lpContext,lpEnumModesCallback);
 858+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSurfaceDesc2,14,lpContext,14,lpEnumModesCallback);
 859+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 860+ if(!lpDDSurfaceDesc2) TRACE_RET(23,DDERR_INVALIDPARAMS);
 861+ if(!lpEnumModesCallback) TRACE_RET(23,DDERR_INVALIDPARAMS);
 862+ HRESULT ret = ::EnumDisplayModes(dwFlags,lpDDSurfaceDesc2,lpContext,lpEnumModesCallback);
 863+ TRACE_EXIT(23,ret);
 864+ return ret;
803865 }
804866 HRESULT WINAPI glDirectDraw7::EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD2, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback)
805867 {
806 - if(!this) return DDERR_INVALIDPARAMS;
 868+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD2,14,lpContext,14,lpEnumSurfacesCallback);
 869+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 870+ if(!lpDDSD2) TRACE_RET(23,DDERR_INVALIDPARAMS);
 871+ if(!lpEnumSurfacesCallback) TRACE_RET(23,DDERR_INVALIDPARAMS);
807872 FIXME("IDirectDraw::EnumSurfaces: stub\n");
 873+ TRACE_EXIT(23,DDERR_GENERIC);
808874 ERR(DDERR_GENERIC);
809875 }
810876 HRESULT WINAPI glDirectDraw7::FlipToGDISurface()
811877 {
812 - if(!this) return DDERR_INVALIDPARAMS;
 878+ TRACE_ENTER(1,14,this);
 879+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
813880 HRESULT error = DD_OK;
814881 if(primary)
815882 {
@@ -820,19 +887,21 @@
821888 if(error != DD_OK) break;
822889 }
823890 }
 891+ TRACE_EXIT(23,error);
824892 return(error);
825893 }
826 - else ERR(DDERR_NOTFOUND);
 894+ else TRACE_RET(23,DDERR_NOTFOUND);
827895 }
828896 HRESULT WINAPI glDirectDraw7::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
829897 {
830 - if(!this) return DDERR_INVALIDPARAMS;
 898+ TRACE_ENTER(3,14,this,14,lpDDDriverCaps,14,lpDDHELCaps);
 899+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
831900 //TODO: Fill in as implemented.
832901 DDCAPS_DX7 ddCaps;
833902 ZeroMemory(&ddCaps,sizeof(DDCAPS_DX7));
834903 if(lpDDDriverCaps) ddCaps.dwSize = lpDDDriverCaps->dwSize;
835904 else if(lpDDHELCaps) ddCaps.dwSize = lpDDHELCaps->dwSize;
836 - else return DDERR_INVALIDPARAMS;
 905+ else TRACE_RET(23,DDERR_INVALIDPARAMS);
837906 if(ddCaps.dwSize > sizeof(DDCAPS_DX7)) ddCaps.dwSize = sizeof(DDCAPS_DX7);
838907 ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
839908 DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM |
@@ -857,12 +926,14 @@
858927 if(lpDDHELCaps->dwSize > sizeof(DDCAPS_DX7)) lpDDHELCaps->dwSize = sizeof(DDCAPS_DX7);
859928 memcpy(lpDDHELCaps,&ddCaps,lpDDHELCaps->dwSize);
860929 }
 930+ TRACE_EXIT(23,DD_OK);
861931 return DD_OK;
862932 }
863933 HRESULT WINAPI glDirectDraw7::GetDisplayMode(LPDDSURFACEDESC2 lpDDSurfaceDesc2)
864934 {
865 - if(!this) return DDERR_INVALIDPARAMS;
866 - if(!lpDDSurfaceDesc2) return DDERR_INVALIDPARAMS;
 935+ TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc2);
 936+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 937+ if(!lpDDSurfaceDesc2) TRACE_RET(23,DDERR_INVALIDPARAMS);
867938 DDSURFACEDESC2 ddsdMode;
868939 ZeroMemory(&ddsdMode, sizeof(DDSURFACEDESC2));
869940 ddsdMode.dwSize = sizeof(DDSURFACEDESC2);
@@ -909,6 +980,7 @@
910981 if(lpDDSurfaceDesc2->dwSize > sizeof(DDSURFACEDESC2))
911982 lpDDSurfaceDesc2->dwSize = sizeof(DDSURFACEDESC2);
912983 memcpy(lpDDSurfaceDesc2,&ddsdMode,lpDDSurfaceDesc2->dwSize);
 984+ TRACE_EXIT(23,DD_OK);
913985 return DD_OK;
914986 }
915987 EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&currmode);
@@ -945,53 +1017,69 @@
9461018 if(currmode.dmBitsPerPel == 15) ddsdMode.lPitch = currmode.dmPelsWidth * 2;
9471019 else if(currmode.dmBitsPerPel == 4) ddsdMode.lPitch = currmode.dmPelsWidth / 2;
9481020 else ddsdMode.lPitch = currmode.dmPelsWidth * (currmode.dmBitsPerPel / 8);
949 - if(lpDDSurfaceDesc2->dwSize < sizeof(DDSURFACEDESC)) ERR(DDERR_INVALIDPARAMS);
 1021+ if(lpDDSurfaceDesc2->dwSize < sizeof(DDSURFACEDESC)) TRACE_RET(23,DDERR_INVALIDPARAMS);
9501022 if(lpDDSurfaceDesc2->dwSize > sizeof(DDSURFACEDESC2))
9511023 lpDDSurfaceDesc2->dwSize = sizeof(DDSURFACEDESC2);
9521024 memcpy(lpDDSurfaceDesc2,&ddsdMode,lpDDSurfaceDesc2->dwSize);
 1025+ TRACE_EXIT(23,DD_OK);
9531026 return DD_OK;
9541027 }
9551028 HRESULT WINAPI glDirectDraw7::GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes)
9561029 {
957 - if(!this) return DDERR_INVALIDPARAMS;
958 - if(!lpNumCodes) return DDERR_INVALIDPARAMS;
959 - if(!lpCodes) return DDERR_INVALIDPARAMS;
 1030+ TRACE_ENTER(3,14,this,14,lpNumCodes,14,lpCodes);
 1031+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1032+ if(!lpNumCodes) TRACE_RET(23,DDERR_INVALIDPARAMS);
 1033+ if(!lpCodes) TRACE_RET(23,DDERR_INVALIDPARAMS);
9601034 FIXME("IDirectDraw::GetFourCCCodes: stub\n");
 1035+ TRACE_EXIT(23,DDERR_GENERIC);
9611036 ERR(DDERR_GENERIC);
9621037 }
9631038 HRESULT WINAPI glDirectDraw7::GetGDISurface(LPDIRECTDRAWSURFACE7 FAR *lplpGDIDDSurface)
9641039 {
965 - if(!this) return DDERR_INVALIDPARAMS;
 1040+ TRACE_ENTER(2,14,this,14,lplpGDIDDSurface);
 1041+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1042+ if(!lplpGDIDDSurface) TRACE_RET(23,DDERR_INVALIDPARAMS);
9661043 FIXME("IDirectDraw::GetGDISurface: stub\n");
 1044+ TRACE_EXIT(23,DDERR_GENERIC);
9671045 ERR(DDERR_GENERIC);
9681046 }
9691047 HRESULT WINAPI glDirectDraw7::GetMonitorFrequency(LPDWORD lpdwFrequency)
9701048 {
971 - if(!this) return DDERR_INVALIDPARAMS;
972 - if(!lpdwFrequency) return DDERR_INVALIDPARAMS;
 1049+ TRACE_ENTER(2,14,this,14,lpdwFrequency);
 1050+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1051+ if(!lpdwFrequency) TRACE_RET(23,DDERR_INVALIDPARAMS);
9731052 DEBUG("IDirectDraw::GetMonitorFrequency: support multi-monitor\n");
9741053 DEVMODE devmode;
9751054 devmode.dmSize = sizeof(DEVMODE);
9761055 EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
9771056 *lpdwFrequency = devmode.dmDisplayFrequency;
 1057+ TRACE_VAR("*lpdwFrequency",8,*lpdwFrequency);
 1058+ TRACE_EXIT(23,DD_OK);
9781059 return DD_OK;
9791060 }
9801061 HRESULT WINAPI glDirectDraw7::GetScanLine(LPDWORD lpdwScanLine)
9811062 {
982 - if(!this) return DDERR_INVALIDPARAMS;
 1063+ TRACE_ENTER(2,14,this,14,lpdwScanLine);
 1064+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1065+ if(!lpdwScanLine) TRACE_RET(23,DDERR_INVALIDPARAMS);
9831066 FIXME("IDirectDraw::GetScanLine: stub\n");
 1067+ TRACE_EXIT(23,DDERR_GENERIC);
9841068 ERR(DDERR_GENERIC);
9851069 }
9861070 HRESULT WINAPI glDirectDraw7::GetVerticalBlankStatus(LPBOOL lpbIsInVB)
9871071 {
988 - if(!this) return DDERR_INVALIDPARAMS;
 1072+ TRACE_ENTER(2,14,this,14,lpbIsInVB);
 1073+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1074+ if(!lpbIsInVB) TRACE_RET(23,DDERR_INVALIDPARAMS);
9891075 FIXME("IDirectDraw::GetVerticalBlankStatus: stub\n");
 1076+ TRACE_EXIT(23,DDERR_GENERIC);
9901077 ERR(DDERR_GENERIC);
9911078 }
9921079 HRESULT WINAPI glDirectDraw7::Initialize(GUID FAR *lpGUID)
9931080 {
994 - if(!this) return DDERR_INVALIDPARAMS;
995 - if(initialized) return DDERR_ALREADYINITIALIZED;
 1081+ TRACE_ENTER(2,14,this,24,lpGUID);
 1082+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1083+ if(initialized) TRACE_RET(23,DDERR_ALREADYINITIALIZED);
9961084 primarylost = true;
9971085 glD3D7 = NULL;
9981086 glDD1 = NULL;
@@ -1007,12 +1095,12 @@
10081096 timer = timeGetTime();
10091097 ZeroMemory(&oldmode,sizeof(DEVMODE));
10101098 surfaces = (glDirectDrawSurface7 **)malloc(1024*sizeof(glDirectDrawSurface7 *));
1011 - if(!surfaces) return DDERR_OUTOFMEMORY;
 1099+ if(!surfaces) TRACE_RET(23,DDERR_OUTOFMEMORY);
10121100 ZeroMemory(surfaces,1024*sizeof(glDirectDrawSurface7 *));
10131101 surfacecount = 0;
10141102 surfacecountmax = 1024;
10151103 clippers = (glDirectDrawClipper **)malloc(1024*sizeof(glDirectDrawClipper *));
1016 - if(!clippers) return DDERR_OUTOFMEMORY;
 1104+ if(!clippers) TRACE_RET(23,DDERR_OUTOFMEMORY);
10171105 ZeroMemory(clippers,1024*sizeof(glDirectDrawClipper *));
10181106 clippercount = 0;
10191107 clippercountmax = 1024;
@@ -1032,20 +1120,24 @@
10331121 DEBUG("Display GUIDs not yet supported, using primary.\n");
10341122 }
10351123 initialized = true;
 1124+ TRACE_EXIT(23,DD_OK);
10361125 return DD_OK;
10371126 }
10381127 HRESULT WINAPI glDirectDraw7::RestoreDisplayMode()
10391128 {
1040 - if(!this) return DDERR_INVALIDPARAMS;
 1129+ TRACE_ENTER(1,14,this);
 1130+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10411131 if(oldmode.dmSize != 0)
10421132 {
10431133 ChangeDisplaySettingsEx(NULL,&oldmode,NULL,0,NULL);
10441134 }
 1135+ TRACE_EXIT(23,DD_OK);
10451136 return DD_OK;
10461137 }
10471138 HRESULT WINAPI glDirectDraw7::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
10481139 {
1049 - if(!this) return DDERR_INVALIDPARAMS;
 1140+ TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
 1141+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
10501142 this->hWnd = hWnd;
10511143 winstyle = GetWindowLongPtrA(hWnd,GWL_STYLE);
10521144 winstyleex = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
@@ -1070,7 +1162,7 @@
10711163 fullscreen = true;
10721164 else fullscreen = false;
10731165 if(exclusive)
1074 - if(!fullscreen) ERR(DDERR_INVALIDPARAMS);
 1166+ if(!fullscreen) TRACE_RET(23,DDERR_INVALIDPARAMS);
10751167 if(dwFlags & DDSCL_FPUPRESERVE)
10761168 fpupreserve = true;
10771169 else fpupreserve = false;
@@ -1081,7 +1173,7 @@
10821174 threadsafe = true;
10831175 else threadsafe = false;
10841176 if(dwFlags & DDSCL_NORMAL)
1085 - if(exclusive) ERR(DDERR_INVALIDPARAMS);
 1177+ if(exclusive) TRACE_RET(23,DDERR_INVALIDPARAMS);
10861178 if(dwFlags & DDSCL_NOWINDOWCHANGES)
10871179 nowindowchanges = true;
10881180 else nowindowchanges = false;
@@ -1113,6 +1205,7 @@
11141206 bpp = devmode.dmBitsPerPel;
11151207 primarybpp = bpp;
11161208 InitGL(x,y,bpp,fullscreen,hWnd,this);
 1209+ TRACE_EXIT(23,DD_OK);
11171210 return DD_OK;
11181211 }
11191212
@@ -1181,7 +1274,8 @@
11821275
11831276 HRESULT WINAPI glDirectDraw7::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
11841277 {
1185 - if(!this) return DDERR_INVALIDPARAMS;
 1278+ TRACE_ENTER(6,14,this,8,dwWidth,8,dwHeight,8,dwBPP,8,dwRefreshRate,9,dwFlags);
 1279+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
11861280 DEBUG("IDirectDraw::SetDisplayMode: implement multiple monitors\n");
11871281 DEVMODE newmode,newmode2;
11881282 DEVMODE currmode;
@@ -1223,25 +1317,26 @@
12241318 else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
12251319 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
12261320 primarylost = true;
 1321+ TRACE_EXIT(23,DD_OK);
12271322 return DD_OK;
12281323 case DISP_CHANGE_BADMODE:
1229 - ERR(DDERR_INVALIDMODE);
 1324+ TRACE_RET(23,DDERR_INVALIDMODE);
12301325 case DISP_CHANGE_BADFLAGS:
1231 - ERR(DDERR_INVALIDPARAMS);
 1326+ TRACE_RET(23,DDERR_INVALIDPARAMS);
12321327 case DISP_CHANGE_BADDUALVIEW:
1233 - ERR(DDERR_GENERIC);
 1328+ TRACE_RET(23,DDERR_GENERIC);
12341329 case DISP_CHANGE_BADPARAM:
1235 - ERR(DDERR_INVALIDPARAMS);
 1330+ TRACE_RET(23,DDERR_INVALIDPARAMS);
12361331 case DISP_CHANGE_FAILED:
1237 - ERR(DDERR_GENERIC);
 1332+ TRACE_RET(23,DDERR_GENERIC);
12381333 case DISP_CHANGE_NOTUPDATED:
1239 - ERR(DDERR_GENERIC);
 1334+ TRACE_RET(23,DDERR_GENERIC);
12401335 case DISP_CHANGE_RESTART:
1241 - ERR(DDERR_UNSUPPORTEDMODE);
 1336+ TRACE_RET(23,DDERR_UNSUPPORTEDMODE);
12421337 default:
1243 - ERR(DDERR_GENERIC);
 1338+ TRACE_RET(23,DDERR_GENERIC);
12441339 }
1245 - ERR(DDERR_GENERIC);
 1340+ TRACE_RET(23,DDERR_GENERIC);
12461341 break;
12471342 case 1: // Stretch to screen
12481343 primaryx = dwWidth;
@@ -1253,6 +1348,7 @@
12541349 primarybpp = dwBPP;
12551350 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
12561351 primarylost = true;
 1352+ TRACE_EXIT(23,DD_OK);
12571353 return DD_OK;
12581354 break;
12591355 case 2: // Scale to screen
@@ -1278,6 +1374,7 @@
12791375 primarybpp = dwBPP;
12801376 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
12811377 primarylost = true;
 1378+ TRACE_EXIT(23,DD_OK);
12821379 return DD_OK;
12831380 break;
12841381 case 3: // Center image
@@ -1289,6 +1386,8 @@
12901387 if(dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
12911388 else internalbpp = screenbpp = currmode.dmBitsPerPel;
12921389 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
 1390+ TRACE_EXIT(23,DD_OK);
 1391+ return DD_OK;
12931392 break;
12941393 case 4: // Switch then stretch
12951394 case 5: // Switch then scale
@@ -1324,6 +1423,7 @@
13251424 primarybpp = dwBPP;
13261425 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
13271426 primarylost = true;
 1427+ TRACE_EXIT(23,DD_OK);
13281428 return DD_OK;
13291429 break;
13301430 case 5:
@@ -1349,6 +1449,7 @@
13501450 primarybpp = dwBPP;
13511451 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
13521452 primarylost = true;
 1453+ TRACE_EXIT(23,DD_OK);
13531454 return DD_OK;
13541455 break;
13551456 case 6:
@@ -1362,29 +1463,38 @@
13631464 else internalbpp = screenbpp = newmode2.dmBitsPerPel;
13641465 InitGL(screenx,screeny,screenbpp,true,hWnd,this);
13651466 primarylost = true;
 1467+ TRACE_EXIT(23,DD_OK);
13661468 return DD_OK;
13671469 break;
13681470 }
13691471 break;
13701472 }
 1473+ TRACE_EXIT(23,DDERR_GENERIC);
13711474 ERR(DDERR_GENERIC);
13721475 }
13731476 HRESULT WINAPI glDirectDraw7::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
13741477 {
1375 - if(!this) return DDERR_INVALIDPARAMS;
1376 - if(dwFlags & DDWAITVB_BLOCKBEGINEVENT) return DDERR_UNSUPPORTED;
 1478+ TRACE_ENTER(3,14,this,9,dwFlags,14,hEvent);
 1479+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1480+ if(dwFlags & DDWAITVB_BLOCKBEGINEVENT)
 1481+ TRACE_RET(23,DDERR_UNSUPPORTED);
13771482 swapinterval=1;
13781483 primary->RenderScreen(primary->texture,primary);
13791484 swapinterval=0;
 1485+ TRACE_EXIT(23,DD_OK);
13801486 return DD_OK;
13811487 }
13821488 HRESULT WINAPI glDirectDraw7::GetAvailableVidMem(LPDDSCAPS2 lpDDSCaps2, LPDWORD lpdwTotal, LPDWORD lpdwFree)
13831489 {
1384 - if(!this) return DDERR_INVALIDPARAMS;
 1490+ TRACE_ENTER(4,14,this,14,lpDDSCaps2,14,lpdwTotal,14,lpdwFree);
 1491+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
13851492 if(GLEXT_NVX_gpu_memory_info)
13861493 {
13871494 if(lpdwTotal) glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX,(GLint*)lpdwTotal);
13881495 if(lpdwFree) glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX,(GLint*)lpdwFree);
 1496+ TRACE_VAR("*lpdwTotal",8,*lpdwTotal);
 1497+ TRACE_VAR("*lpdwFree",8,*lpdwFree);
 1498+ TRACE_EXIT(23,DD_OK);
13891499 return DD_OK;
13901500 }
13911501 else
@@ -1393,46 +1503,59 @@
13941504 GlobalMemoryStatus(&memstat);
13951505 if(lpdwTotal) *lpdwTotal = memstat.dwTotalVirtual;
13961506 if(lpdwFree) *lpdwFree = memstat.dwAvailVirtual;
 1507+ TRACE_VAR("*lpdwTotal",8,*lpdwTotal);
 1508+ TRACE_VAR("*lpdwFree",8,*lpdwFree);
 1509+ TRACE_EXIT(23,DD_OK);
13971510 return DD_OK;
13981511 }
13991512 }
14001513 HRESULT WINAPI glDirectDraw7::GetSurfaceFromDC(HDC hdc, LPDIRECTDRAWSURFACE7 *lpDDS)
14011514 {
1402 - if(!this) return DDERR_INVALIDPARAMS;
 1515+ TRACE_ENTER(3,14,this,13,hdc,14,lpDDS);
 1516+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14031517 FIXME("IDirectDraw::GetSurfaceFromDC: stub\n");
 1518+ TRACE_EXIT(23,DDERR_GENERIC);
14041519 ERR(DDERR_GENERIC);
14051520 }
14061521 HRESULT WINAPI glDirectDraw7::RestoreAllSurfaces()
14071522 {
1408 - if(!this) return DDERR_INVALIDPARAMS;
 1523+ TRACE_ENTER(1,14,this);
 1524+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14091525 FIXME("IDirectDraw::RestoreAllSurfaces: stub\n");
 1526+ TRACE_EXIT(23,DDERR_GENERIC);
14101527 ERR(DDERR_GENERIC);
14111528 }
14121529 HRESULT WINAPI glDirectDraw7::TestCooperativeLevel()
14131530 {
 1531+ TRACE_ENTER(1,14,this);
 1532+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1533+ TRACE_EXIT(23,DD_OK);
14141534 return DD_OK;
1415 - /*if(!this) return DDERR_INVALIDOBJECT;
1416 - if(fullscreen) return DDERR_EXCLUSIVEMODEALREADYSET;
1417 - return DDERR_NOEXCLUSIVEMODE;*/
14181535 }
14191536 HRESULT WINAPI glDirectDraw7::GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2 lpdddi, DWORD dwFlags)
14201537 {
1421 - if(!this) return DDERR_INVALIDPARAMS;
1422 - if(!lpdddi) return DDERR_INVALIDPARAMS;
 1538+ TRACE_ENTER(3,14,this,14,lpdddi,9,dwFlags);
 1539+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1540+ if(!lpdddi) TRACE_RET(23,DDERR_INVALIDPARAMS);
14231541 devid.guidDeviceIdentifier = device_template;
14241542 memcpy(lpdddi,&devid,sizeof(DDDEVICEIDENTIFIER2));
 1543+ TRACE_EXIT(23,DD_OK);
14251544 return DD_OK;
14261545 }
14271546 HRESULT WINAPI glDirectDraw7::StartModeTest(LPSIZE lpModesToTest, DWORD dwNumEntries, DWORD dwFlags)
14281547 {
1429 - if(!this) return DDERR_INVALIDPARAMS;
 1548+ TRACE_ENTER(4,14,this,25,lpModesToTest,8,dwNumEntries,9,dwFlags);
 1549+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14301550 FIXME("IDirectDraw::StartModeTest: stub\n");
 1551+ TRACE_EXIT(23,DDERR_GENERIC);
14311552 ERR(DDERR_GENERIC);
14321553 }
14331554 HRESULT WINAPI glDirectDraw7::EvaluateMode(DWORD dwFlags, DWORD *pSecondsUntilTimeout)
14341555 {
1435 - if(!this) return DDERR_INVALIDPARAMS;
 1556+ TRACE_ENTER(3,14,this,9,dwFlags,14,pSecondsUntilTimeout);
 1557+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14361558 FIXME("IDirectDraw::EvaluateMode: stub\n");
 1559+ TRACE_EXIT(23,DDERR_GENERIC);
14371560 ERR(DDERR_GENERIC);
14381561 }
14391562
@@ -1448,72 +1571,93 @@
14491572
14501573 void glDirectDraw7::DeleteSurface(glDirectDrawSurface7 *surface)
14511574 {
 1575+ TRACE_ENTER(2,14,this,14,surface);
14521576 for(int i = 0; i < surfacecount; i++)
14531577 if(surfaces[i] == surface) surfaces[i] = NULL;
14541578 if(surface == primary) primary = NULL;
 1579+ TRACE_EXIT(0,0);
14551580 }
14561581
14571582 void glDirectDraw7::DeleteClipper(glDirectDrawClipper *clipper)
14581583 {
 1584+ TRACE_ENTER(2,14,this,clipper);
14591585 for(int i = 0; i < clippercount; i++)
14601586 if(clippers[i] == clipper) clippers[i] = NULL;
 1587+ TRACE_EXIT(0,0);
14611588 }
14621589
14631590 // DDRAW1 wrapper
14641591 glDirectDraw1::glDirectDraw1(glDirectDraw7 *gl_DD7)
14651592 {
 1593+ TRACE_ENTER(2,14,this,14,gl_DD7);
14661594 glDD7 = gl_DD7;
14671595 refcount = 1;
 1596+ TRACE_EXIT(-1,0);
14681597 }
14691598 glDirectDraw1::~glDirectDraw1()
14701599 {
 1600+ TRACE_ENTER(1,14,this);
14711601 glDD7->glDD1 = NULL;
14721602 glDD7->Release();
 1603+ TRACE_EXIT(-1,0);
14731604 }
14741605 HRESULT WINAPI glDirectDraw1::QueryInterface(REFIID riid, void** ppvObj)
14751606 {
1476 - if(!this) return DDERR_INVALIDPARAMS;
 1607+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 1608+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
14771609 if(riid == IID_IUnknown)
14781610 {
14791611 this->AddRef();
14801612 *ppvObj = this;
 1613+ TRACE_VAR("*ppvObj",14,*ppvObj);
14811614 return DD_OK;
14821615 }
1483 - return glDD7->QueryInterface(riid,ppvObj);
 1616+ HRESULT ret = glDD7->QueryInterface(riid,ppvObj);
 1617+ TRACE_VAR("*ppvObj",14,*ppvObj);
 1618+ TRACE_EXIT(23,ret);
 1619+ return ret;
14841620 }
14851621 ULONG WINAPI glDirectDraw1::AddRef()
14861622 {
1487 - if(!this) return 0;
 1623+ TRACE_ENTER(1,14,this);
 1624+ if(!this) TRACE_RET(8,0);
14881625 refcount++;
 1626+ TRACE_EXIT(8,refcount);
14891627 return refcount;
14901628 }
14911629 ULONG WINAPI glDirectDraw1::Release()
14921630 {
1493 - if(!this) return 0;
 1631+ TRACE_ENTER(1,14,this);
 1632+ if(!this) TRACE_RET(8,0);
14941633 ULONG ret;
14951634 refcount--;
14961635 ret = refcount;
14971636 if(refcount == 0) delete this;
 1637+ TRACE_EXIT(8,ret);
14981638 return ret;
14991639 }
15001640 HRESULT WINAPI glDirectDraw1::Compact()
15011641 {
1502 - if(!this) return DDERR_INVALIDPARAMS;
1503 - return glDD7->Compact();
 1642+ TRACE_ENTER(1,14,this);
 1643+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1644+ TRACE_RET(23,glDD7->Compact());
15041645 }
15051646 HRESULT WINAPI glDirectDraw1::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
15061647 {
1507 - if(!this) return DDERR_INVALIDPARAMS;
1508 - return glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
 1648+ TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
 1649+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1650+ TRACE_RET(23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
15091651 }
15101652 HRESULT WINAPI glDirectDraw1::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
15111653 {
1512 - if(!this) return DDERR_INVALIDPARAMS;
1513 - return glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
 1654+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette,14,pUnkOuter);
 1655+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1656+ TRACE_RET(23,glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter));
15141657 }
15151658 HRESULT WINAPI glDirectDraw1::CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, IUnknown FAR *pUnkOuter)
15161659 {
1517 - if(!this) return DDERR_INVALIDPARAMS;
 1660+ TRACE_ENTER(4,14,this,14,lpDDSurfaceDesc,14,lplpDDSurface,14,pUnkOuter);
 1661+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
15181662 LPDIRECTDRAWSURFACE7 lpDDS7;
15191663 HRESULT err = glDD7->CreateSurface((LPDDSURFACEDESC2)lpDDSurfaceDesc,&lpDDS7,pUnkOuter);
15201664 if(err == DD_OK)
@@ -1520,149 +1664,186 @@
15211665 {
15221666 lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
15231667 lpDDS7->Release();
 1668+ TRACE_VAR("*lplpDDSurface",14,lplpDDSurface);
 1669+ TRACE_EXIT(23,DD_OK);
15241670 return DD_OK;
15251671 }
 1672+ TRACE_EXIT(23,err);
15261673 return err;
15271674 }
15281675 HRESULT WINAPI glDirectDraw1::DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE FAR *lplpDupDDSurface)
15291676 {
1530 - if(!this) return DDERR_INVALIDPARAMS;
 1677+ TRACE_ENTER(3,14,this,14,lpDDSurface,14,lplpDupDDSurface);
 1678+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
15311679 FIXME("glDirectDraw1::DuplicateSurface: stub\n");
 1680+ TRACE_EXIT(23,DDERR_GENERIC);
15321681 ERR(DDERR_GENERIC);
15331682 }
15341683 HRESULT WINAPI glDirectDraw1::EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback)
15351684 {
1536 - if(!this) return DDERR_INVALIDPARAMS;
1537 - return ::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback);
 1685+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSurfaceDesc,14,lpContext,14,lpEnumModesCallback);
 1686+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1687+ TRACE_RET(23,::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback));
15381688 }
15391689 HRESULT WINAPI glDirectDraw1::EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
15401690 {
1541 - if(!this) return DDERR_INVALIDPARAMS;
 1691+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
 1692+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
15421693 FIXME("glDirectDraw1::EnumSurfaces: stub\n");
 1694+ TRACE_EXIT(23,DDERR_GENERIC);
15431695 ERR(DDERR_GENERIC);
15441696 }
15451697 HRESULT WINAPI glDirectDraw1::FlipToGDISurface()
15461698 {
1547 - if(!this) return DDERR_INVALIDPARAMS;
1548 - return glDD7->FlipToGDISurface();
 1699+ TRACE_ENTER(1,14,this);
 1700+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1701+ TRACE_RET(23,glDD7->FlipToGDISurface());
15491702 }
15501703 HRESULT WINAPI glDirectDraw1::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
15511704 {
1552 - if(!this) return DDERR_INVALIDPARAMS;
1553 - return glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps);
 1705+ TRACE_ENTER(3,14,this,14,lpDDDriverCaps,14,lpDDHELCaps);
 1706+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1707+ TRACE_RET(23,glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps));
15541708 }
15551709 HRESULT WINAPI glDirectDraw1::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
15561710 {
1557 - if(!this) return DDERR_INVALIDPARAMS;
1558 - return glDD7->GetDisplayMode((LPDDSURFACEDESC2)lpDDSurfaceDesc);
 1711+ TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc);
 1712+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1713+ TRACE_RET(23,glDD7->GetDisplayMode((LPDDSURFACEDESC2)lpDDSurfaceDesc));
15591714 }
15601715 HRESULT WINAPI glDirectDraw1::GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes)
15611716 {
1562 - if(!this) return DDERR_INVALIDPARAMS;
1563 - return glDD7->GetFourCCCodes(lpNumCodes,lpCodes);
 1717+ TRACE_ENTER(3,14,this,14,lpNumCodes,14,lpCodes);
 1718+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1719+ TRACE_RET(23,glDD7->GetFourCCCodes(lpNumCodes,lpCodes));
15641720 }
15651721 HRESULT WINAPI glDirectDraw1::GetGDISurface(LPDIRECTDRAWSURFACE FAR *lplpGDIDDSurface)
15661722 {
1567 - if(!this) return DDERR_INVALIDPARAMS;
 1723+ TRACE_ENTER(2,14,this,14,lplpGDIDDSurface);
 1724+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
15681725 FIXME("glDirectDraw1::GetGDISurface: stub\n");
 1726+ TRACE_EXIT(23,DDERR_GENERIC);
15691727 ERR(DDERR_GENERIC);
15701728 }
15711729 HRESULT WINAPI glDirectDraw1::GetMonitorFrequency(LPDWORD lpdwFrequency)
15721730 {
1573 - if(!this) return DDERR_INVALIDPARAMS;
1574 - return glDD7->GetMonitorFrequency(lpdwFrequency);
 1731+ TRACE_ENTER(2,14,this,14,lpdwFrequency);
 1732+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1733+ TRACE_RET(23,glDD7->GetMonitorFrequency(lpdwFrequency));
15751734 }
15761735 HRESULT WINAPI glDirectDraw1::GetScanLine(LPDWORD lpdwScanLine)
15771736 {
1578 - if(!this) return DDERR_INVALIDPARAMS;
1579 - return glDD7->GetScanLine(lpdwScanLine);
 1737+ TRACE_ENTER(2,14,this,14,lpdwScanLine);
 1738+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1739+ TRACE_RET(23,glDD7->GetScanLine(lpdwScanLine));
15801740 }
15811741 HRESULT WINAPI glDirectDraw1::GetVerticalBlankStatus(LPBOOL lpbIsInVB)
15821742 {
1583 - if(!this) return DDERR_INVALIDPARAMS;
1584 - return glDD7->GetVerticalBlankStatus(lpbIsInVB);
 1743+ TRACE_ENTER(2,14,this,14,lpbIsInVB);
 1744+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1745+ TRACE_RET(23,glDD7->GetVerticalBlankStatus(lpbIsInVB));
15851746 }
15861747 HRESULT WINAPI glDirectDraw1::Initialize(GUID FAR *lpGUID)
15871748 {
1588 - if(!this) return DDERR_INVALIDPARAMS;
1589 - return glDD7->Initialize(lpGUID);
 1749+ TRACE_ENTER(2,14,this,24,lpGUID);
 1750+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1751+ TRACE_RET(23,glDD7->Initialize(lpGUID));
15901752 }
15911753 HRESULT WINAPI glDirectDraw1::RestoreDisplayMode()
15921754 {
1593 - if(!this) return DDERR_INVALIDPARAMS;
1594 - return glDD7->RestoreDisplayMode();
 1755+ TRACE_ENTER(1,14,this);
 1756+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1757+ TRACE_RET(23,glDD7->RestoreDisplayMode());
15951758 }
15961759 HRESULT WINAPI glDirectDraw1::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
15971760 {
1598 - if(!this) return DDERR_INVALIDPARAMS;
1599 - return glDD7->SetCooperativeLevel(hWnd,dwFlags);
 1761+ TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
 1762+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1763+ TRACE_RET(23,glDD7->SetCooperativeLevel(hWnd,dwFlags));
16001764 }
16011765 HRESULT WINAPI glDirectDraw1::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP)
16021766 {
1603 - if(!this) return DDERR_INVALIDPARAMS;
1604 - return glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,0,0);
 1767+ TRACE_ENTER(4,14,this,8,dwWidth,8,dwHeight,8,dwBPP);
 1768+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1769+ TRACE_RET(23,glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,0,0));
16051770 }
16061771 HRESULT WINAPI glDirectDraw1::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
16071772 {
1608 - if(!this) return DDERR_INVALIDPARAMS;
1609 - return glDD7->WaitForVerticalBlank(dwFlags,hEvent);
 1773+ TRACE_ENTER(3,14,this,9,dwFlags,14,hEvent);
 1774+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1775+ TRACE_RET(23,glDD7->WaitForVerticalBlank(dwFlags,hEvent));
16101776 }
16111777 // DDRAW2 wrapper
16121778 glDirectDraw2::glDirectDraw2(glDirectDraw7 *gl_DD7)
16131779 {
 1780+ TRACE_ENTER(2,14,this,14,gl_DD7);
16141781 glDD7 = gl_DD7;
16151782 refcount = 1;
 1783+ TRACE_EXIT(-1,0);
16161784 }
16171785 glDirectDraw2::~glDirectDraw2()
16181786 {
 1787+ TRACE_ENTER(1,14,this);
16191788 glDD7->glDD2 = NULL;
16201789 glDD7->Release();
 1790+ TRACE_EXIT(-1,0);
16211791 }
16221792 HRESULT WINAPI glDirectDraw2::QueryInterface(REFIID riid, void** ppvObj)
16231793 {
1624 - if(!this) return DDERR_INVALIDPARAMS;
 1794+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 1795+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
16251796 if(riid == IID_IUnknown)
16261797 {
16271798 this->AddRef();
16281799 *ppvObj = this;
 1800+ TRACE_VAR("*ppvObject",14,*ppvObj);
 1801+ TRACE_EXIT(23,DD_OK);
16291802 return DD_OK;
16301803 }
1631 - return glDD7->QueryInterface(riid,ppvObj);
 1804+ TRACE_RET(23,glDD7->QueryInterface(riid,ppvObj));
16321805 }
16331806 ULONG WINAPI glDirectDraw2::AddRef()
16341807 {
1635 - if(!this) return 0;
 1808+ TRACE_ENTER(1,14,this);
 1809+ if(!this) TRACE_RET(8,0);
16361810 refcount++;
 1811+ TRACE_EXIT(8,refcount);
16371812 return refcount;
16381813 }
16391814 ULONG WINAPI glDirectDraw2::Release()
16401815 {
1641 - if(!this) return 0;
 1816+ TRACE_ENTER(1,14,this);
 1817+ if(!this) TRACE_RET(8,0);
16421818 ULONG ret;
16431819 refcount--;
16441820 ret = refcount;
16451821 if(refcount == 0) delete this;
 1822+ TRACE_EXIT(8,ret);
16461823 return ret;
16471824 }
16481825 HRESULT WINAPI glDirectDraw2::Compact()
16491826 {
1650 - if(!this) return DDERR_INVALIDPARAMS;
1651 - return glDD7->Compact();
 1827+ TRACE_ENTER(1,14,this);
 1828+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1829+ TRACE_RET(23,glDD7->Compact());
16521830 }
16531831 HRESULT WINAPI glDirectDraw2::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
16541832 {
1655 - if(!this) return DDERR_INVALIDPARAMS;
1656 - return glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
 1833+ TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
 1834+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1835+ TRACE_RET(23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
16571836 }
16581837 HRESULT WINAPI glDirectDraw2::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
16591838 {
1660 - if(!this) return DDERR_INVALIDPARAMS;
1661 - return glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
 1839+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette,14,pUnkOuter);
 1840+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1841+ TRACE_RET(23,glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter));
16621842 }
16631843 HRESULT WINAPI glDirectDraw2::CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, IUnknown FAR *pUnkOuter)
16641844 {
1665 - if(!this) return DDERR_INVALIDPARAMS;
1666 - if(!lplpDDSurface) return DDERR_INVALIDPARAMS;
 1845+ TRACE_ENTER(4,14,this,14,lpDDSurfaceDesc,14,lplpDDSurface,14,pUnkOuter);
 1846+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1847+ if(!lplpDDSurface) TRACE_RET(23,DDERR_INVALIDPARAMS);
16671848 LPDIRECTDRAWSURFACE7 lpDDS7;
16681849 HRESULT err = glDD7->CreateSurface((LPDDSURFACEDESC2)lpDDSurfaceDesc,&lpDDS7,pUnkOuter);
16691850 if(err == DD_OK)
@@ -1669,158 +1850,209 @@
16701851 {
16711852 lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
16721853 lpDDS7->Release();
 1854+ TRACE_EXIT(23,DD_OK);
16731855 return DD_OK;
16741856 }
 1857+ TRACE_EXIT(23,err);
16751858 return err;
16761859 }
16771860 HRESULT WINAPI glDirectDraw2::DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE FAR *lplpDupDDSurface)
16781861 {
1679 - if(!this) return DDERR_INVALIDPARAMS;
 1862+ TRACE_ENTER(3,14,this,14,lpDDSurface,14,lplpDupDDSurface);
 1863+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
16801864 FIXME("glDirectDraw2::DuplicateSurface: stub\n");
 1865+ TRACE_EXIT(23,DDERR_GENERIC);
16811866 ERR(DDERR_GENERIC);
16821867 }
16831868 HRESULT WINAPI glDirectDraw2::EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback)
16841869 {
1685 - if(!this) return DDERR_INVALIDPARAMS;
1686 - return ::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback);
 1870+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSurfaceDesc,14,lpContext,14,lpEnumModesCallback);
 1871+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1872+ TRACE_RET(23,::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback));
16871873 }
16881874 HRESULT WINAPI glDirectDraw2::EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
16891875 {
1690 - if(!this) return DDERR_INVALIDPARAMS;
 1876+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
 1877+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
16911878 FIXME("glDirectDraw2::EnumSurfaces: stub\n");
 1879+ TRACE_EXIT(23,DDERR_GENERIC);
16921880 ERR(DDERR_GENERIC);
16931881 }
16941882 HRESULT WINAPI glDirectDraw2::FlipToGDISurface()
16951883 {
1696 - if(!this) return DDERR_INVALIDPARAMS;
1697 - return glDD7->FlipToGDISurface();
 1884+ TRACE_ENTER(1,14,this);
 1885+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1886+ TRACE_RET(23,glDD7->FlipToGDISurface());
16981887 }
16991888 HRESULT WINAPI glDirectDraw2::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
17001889 {
1701 - if(!this) return DDERR_INVALIDPARAMS;
1702 - return glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps);
 1890+ TRACE_ENTER(3,14,this,14,lpDDDriverCaps,14,lpDDHELCaps);
 1891+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1892+ TRACE_RET(23,glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps));
17031893 }
17041894 HRESULT WINAPI glDirectDraw2::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc)
17051895 {
1706 - if(!this) return DDERR_INVALIDPARAMS;
1707 - return glDD7->GetDisplayMode((LPDDSURFACEDESC2)lpDDSurfaceDesc);
 1896+ TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc);
 1897+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1898+ TRACE_RET(23,glDD7->GetDisplayMode((LPDDSURFACEDESC2)lpDDSurfaceDesc));
17081899 }
17091900 HRESULT WINAPI glDirectDraw2::GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes)
17101901 {
1711 - if(!this) return DDERR_INVALIDPARAMS;
1712 - return glDD7->GetFourCCCodes(lpNumCodes,lpCodes);
 1902+ TRACE_ENTER(3,14,this,14,lpNumCodes,14,lpCodes);
 1903+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1904+ TRACE_RET(23,glDD7->GetFourCCCodes(lpNumCodes,lpCodes));
17131905 }
17141906 HRESULT WINAPI glDirectDraw2::GetGDISurface(LPDIRECTDRAWSURFACE FAR *lplpGDIDDSurface)
17151907 {
1716 - if(!this) return DDERR_INVALIDPARAMS;
 1908+ TRACE_ENTER(2,14,this,14,lplpGDIDDSurface);
 1909+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17171910 FIXME("glDirectDraw2::GetGDISurface: stub\n");
 1911+ TRACE_EXIT(23,DDERR_GENERIC);
17181912 ERR(DDERR_GENERIC);
17191913 }
17201914 HRESULT WINAPI glDirectDraw2::GetMonitorFrequency(LPDWORD lpdwFrequency)
17211915 {
1722 - if(!this) return DDERR_INVALIDPARAMS;
1723 - return glDD7->GetMonitorFrequency(lpdwFrequency);
 1916+ TRACE_ENTER(2,14,this,14,lpdwFrequency);
 1917+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1918+ TRACE_RET(23,glDD7->GetMonitorFrequency(lpdwFrequency));
17241919 }
17251920 HRESULT WINAPI glDirectDraw2::GetScanLine(LPDWORD lpdwScanLine)
17261921 {
1727 - if(!this) return DDERR_INVALIDPARAMS;
1728 - return glDD7->GetScanLine(lpdwScanLine);
 1922+ TRACE_ENTER(2,14,this,14,lpdwScanLine);
 1923+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1924+ TRACE_RET(23,glDD7->GetScanLine(lpdwScanLine));
17291925 }
17301926 HRESULT WINAPI glDirectDraw2::GetVerticalBlankStatus(LPBOOL lpbIsInVB)
17311927 {
1732 - if(!this) return DDERR_INVALIDPARAMS;
1733 - return glDD7->GetVerticalBlankStatus(lpbIsInVB);
 1928+ TRACE_ENTER(2,14,this,14,lpbIsInVB);
 1929+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1930+ TRACE_RET(23,glDD7->GetVerticalBlankStatus(lpbIsInVB));
17341931 }
17351932 HRESULT WINAPI glDirectDraw2::Initialize(GUID FAR *lpGUID)
17361933 {
1737 - if(!this) return DDERR_INVALIDPARAMS;
1738 - return glDD7->Initialize(lpGUID);
 1934+ TRACE_ENTER(2,14,this,24,lpGUID);
 1935+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1936+ TRACE_RET(23,glDD7->Initialize(lpGUID));
17391937 }
17401938 HRESULT WINAPI glDirectDraw2::RestoreDisplayMode()
17411939 {
1742 - if(!this) return DDERR_INVALIDPARAMS;
1743 - return glDD7->RestoreDisplayMode();
 1940+ TRACE_ENTER(1,14,this);
 1941+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1942+ TRACE_RET(23,glDD7->RestoreDisplayMode());
17441943 }
17451944 HRESULT WINAPI glDirectDraw2::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
17461945 {
1747 - if(!this) return DDERR_INVALIDPARAMS;
1748 - return glDD7->SetCooperativeLevel(hWnd,dwFlags);
 1946+ TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
 1947+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1948+ TRACE_RET(23,glDD7->SetCooperativeLevel(hWnd,dwFlags));
17491949 }
17501950 HRESULT WINAPI glDirectDraw2::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
17511951 {
1752 - if(!this) return DDERR_INVALIDPARAMS;
1753 - return glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
 1952+ TRACE_ENTER(6,14,this,8,dwWidth,8,dwHeight,8,dwBPP,8,dwRefreshRate,9,dwFlags);
 1953+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1954+ TRACE_RET(23,glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags));
17541955 }
17551956 HRESULT WINAPI glDirectDraw2::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
17561957 {
1757 - if(!this) return DDERR_INVALIDPARAMS;
1758 - return glDD7->WaitForVerticalBlank(dwFlags,hEvent);
 1958+ TRACE_ENTER(3,14,this,9,dwFlags,14,hEvent);
 1959+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1960+ TRACE_RET(23,glDD7->WaitForVerticalBlank(dwFlags,hEvent));
17591961 }
17601962 HRESULT WINAPI glDirectDraw2::GetAvailableVidMem(LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree)
17611963 {
1762 - if(!this) return DDERR_INVALIDPARAMS;
1763 - MEMORYSTATUS memstatus;
1764 - memstatus.dwLength = sizeof(MEMORYSTATUS);
1765 - GlobalMemoryStatus(&memstatus);
1766 - if(lpdwTotal) *lpdwTotal = memstatus.dwTotalVirtual;
1767 - if(lpdwFree) *lpdwFree = memstatus.dwAvailVirtual;
1768 - return DD_OK;
 1964+ TRACE_ENTER(4,14,this,14,lpDDSCaps,14,lpdwTotal,14,lpdwFree);
 1965+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 1966+ if(GLEXT_NVX_gpu_memory_info)
 1967+ {
 1968+ if(lpdwTotal) glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX,(GLint*)lpdwTotal);
 1969+ if(lpdwFree) glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX,(GLint*)lpdwFree);
 1970+ TRACE_VAR("*lpdwTotal",8,*lpdwTotal);
 1971+ TRACE_VAR("*lpdwFree",8,*lpdwFree);
 1972+ TRACE_EXIT(23,DD_OK);
 1973+ return DD_OK;
 1974+ }
 1975+ else
 1976+ {
 1977+ MEMORYSTATUS memstat;
 1978+ GlobalMemoryStatus(&memstat);
 1979+ if(lpdwTotal) *lpdwTotal = memstat.dwTotalVirtual;
 1980+ if(lpdwFree) *lpdwFree = memstat.dwAvailVirtual;
 1981+ TRACE_VAR("*lpdwTotal",8,*lpdwTotal);
 1982+ TRACE_VAR("*lpdwFree",8,*lpdwFree);
 1983+ TRACE_EXIT(23,DD_OK);
 1984+ return DD_OK;
 1985+ }
17691986 }
17701987 // DDRAW4 wrapper
17711988 glDirectDraw4::glDirectDraw4(glDirectDraw7 *gl_DD7)
17721989 {
 1990+ TRACE_ENTER(2,14,this,14,gl_DD7);
17731991 glDD7 = gl_DD7;
17741992 refcount = 1;
 1993+ TRACE_EXIT(-1,0);
17751994 }
17761995 glDirectDraw4::~glDirectDraw4()
17771996 {
 1997+ TRACE_ENTER(1,14,this);
17781998 glDD7->glDD4 = NULL;
17791999 glDD7->Release();
 2000+ TRACE_EXIT(-1,0);
17802001 }
17812002 HRESULT WINAPI glDirectDraw4::QueryInterface(REFIID riid, void** ppvObj)
17822003 {
1783 - if(!this) return DDERR_INVALIDPARAMS;
 2004+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 2005+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
17842006 if(riid == IID_IUnknown)
17852007 {
17862008 this->AddRef();
17872009 *ppvObj = this;
 2010+ TRACE_EXIT(23,DD_OK);
17882011 return DD_OK;
17892012 }
1790 - return glDD7->QueryInterface(riid,ppvObj);
 2013+ TRACE_RET(23,glDD7->QueryInterface(riid,ppvObj));
17912014 }
17922015 ULONG WINAPI glDirectDraw4::AddRef()
17932016 {
1794 - if(!this) return 0;
 2017+ TRACE_ENTER(1,14,this);
 2018+ if(!this) TRACE_RET(8,0);
17952019 refcount++;
 2020+ TRACE_EXIT(8,refcount);
17962021 return refcount;
17972022 }
17982023 ULONG WINAPI glDirectDraw4::Release()
17992024 {
1800 - if(!this) return 0;
 2025+ TRACE_ENTER(1,14,this);
 2026+ if(!this) TRACE_RET(8,0);
18012027 ULONG ret;
18022028 refcount--;
18032029 ret = refcount;
18042030 if(refcount == 0) delete this;
 2031+ TRACE_RET(8,ret);
18052032 return ret;
18062033 }
18072034 HRESULT WINAPI glDirectDraw4::Compact()
18082035 {
1809 - if(!this) return DDERR_INVALIDPARAMS;
1810 - return glDD7->Compact();
 2036+ TRACE_ENTER(1,14,this);
 2037+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2038+ TRACE_RET(23,glDD7->Compact());
18112039 }
18122040 HRESULT WINAPI glDirectDraw4::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
18132041 {
1814 - if(!this) return DDERR_INVALIDPARAMS;
1815 - return glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
 2042+ TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
 2043+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2044+ TRACE_RET(23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
18162045 }
18172046 HRESULT WINAPI glDirectDraw4::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
18182047 {
1819 - if(!this) return DDERR_INVALIDPARAMS;
1820 - return glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
 2048+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette,14,pUnkOuter);
 2049+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2050+ TRACE_RET(23,glDD7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter));
18212051 }
18222052 HRESULT WINAPI glDirectDraw4::CreateSurface(LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE4 FAR *lplpDDSurface, IUnknown FAR *pUnkOuter)
18232053 {
1824 - if(!this) return DDERR_INVALIDPARAMS;
 2054+ TRACE_ENTER(4,14,this,14,lpDDSurfaceDesc,14,lplpDDSurface,14,pUnkOuter);
 2055+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2056+ if(!lplpDDSurface) TRACE_RET(23,DDERR_INVALIDPARAMS);
18252057 LPDIRECTDRAWSURFACE7 lpDDS7;
18262058 HRESULT err = glDD7->CreateSurface((LPDDSURFACEDESC2)lpDDSurfaceDesc,&lpDDS7,pUnkOuter);
18272059 if(err == DD_OK)
@@ -1827,119 +2059,147 @@
18282060 {
18292061 lpDDS7->QueryInterface(IID_IDirectDrawSurface4,(LPVOID*) lplpDDSurface);
18302062 lpDDS7->Release();
 2063+ TRACE_EXIT(23,DD_OK);
18312064 return DD_OK;
18322065 }
1833 - return err;}
 2066+ TRACE_EXIT(23,err);
 2067+ return err;
 2068+}
18342069 HRESULT WINAPI glDirectDraw4::DuplicateSurface(LPDIRECTDRAWSURFACE4 lpDDSurface, LPDIRECTDRAWSURFACE4 FAR *lplpDupDDSurface)
18352070 {
1836 - if(!this) return DDERR_INVALIDPARAMS;
 2071+ TRACE_ENTER(3,14,this,14,lpDDSurface,14,lplpDupDDSurface);
 2072+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
18372073 FIXME("glDirectDraw4::DuplicateSurface: stub\n");
 2074+ TRACE_EXIT(23,DDERR_GENERIC);
18382075 ERR(DDERR_GENERIC);
18392076 }
18402077 HRESULT WINAPI glDirectDraw4::EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback)
18412078 {
1842 - if(!this) return DDERR_INVALIDPARAMS;
1843 - return ::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback);
 2079+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSurfaceDesc,14,lpContext,14,lpEnumModesCallback);
 2080+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2081+ TRACE_RET(23,::EnumDisplayModes(dwFlags,lpDDSurfaceDesc,lpContext,lpEnumModesCallback));
18442082 }
18452083 HRESULT WINAPI glDirectDraw4::EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback)
18462084 {
1847 - if(!this) return DDERR_INVALIDPARAMS;
 2085+ TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDSD,14,lpContext,14,lpEnumSurfacesCallback);
 2086+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
18482087 FIXME("glDirectDraw4::EnumSurfaces: stub\n");
 2088+ TRACE_EXIT(23,DDERR_GENERIC);
18492089 ERR(DDERR_GENERIC);
18502090 }
18512091 HRESULT WINAPI glDirectDraw4::FlipToGDISurface()
18522092 {
1853 - if(!this) return DDERR_INVALIDPARAMS;
1854 - return glDD7->FlipToGDISurface();
 2093+ TRACE_ENTER(1,14,this);
 2094+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2095+ TRACE_RET(23,glDD7->FlipToGDISurface());
18552096 }
18562097 HRESULT WINAPI glDirectDraw4::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
18572098 {
1858 - if(!this) return DDERR_INVALIDPARAMS;
1859 - return glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps);
 2099+ TRACE_ENTER(3,14,this,14,lpDDDriverCaps,14,lpDDHELCaps);
 2100+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2101+ TRACE_RET(23,glDD7->GetCaps(lpDDDriverCaps,lpDDHELCaps));
18602102 }
18612103 HRESULT WINAPI glDirectDraw4::GetDisplayMode(LPDDSURFACEDESC2 lpDDSurfaceDesc2)
18622104 {
1863 - if(!this) return DDERR_INVALIDPARAMS;
1864 - return glDD7->GetDisplayMode(lpDDSurfaceDesc2);
 2105+ TRACE_ENTER(2,14,this,14,lpDDSurfaceDesc2);
 2106+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2107+ TRACE_RET(23,glDD7->GetDisplayMode(lpDDSurfaceDesc2));
18652108 }
18662109 HRESULT WINAPI glDirectDraw4::GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes)
18672110 {
1868 - if(!this) return DDERR_INVALIDPARAMS;
1869 - return glDD7->GetFourCCCodes(lpNumCodes,lpCodes);
 2111+ TRACE_ENTER(3,14,this,14,lpNumCodes,14,lpCodes);
 2112+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2113+ TRACE_RET(23,glDD7->GetFourCCCodes(lpNumCodes,lpCodes));
18702114 }
18712115 HRESULT WINAPI glDirectDraw4::GetGDISurface(LPDIRECTDRAWSURFACE4 FAR *lplpGDIDDSurface)
18722116 {
1873 - if(!this) return DDERR_INVALIDPARAMS;
 2117+ TRACE_ENTER(2,14,this,14,lplpGDIDDSurface);
 2118+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
18742119 FIXME("glDirectDraw4::GetGDISurface: stub\n");
 2120+ TRACE_EXIT(23,DDERR_GENERIC);
18752121 ERR(DDERR_GENERIC);
18762122 }
18772123 HRESULT WINAPI glDirectDraw4::GetMonitorFrequency(LPDWORD lpdwFrequency)
18782124 {
1879 - if(!this) return DDERR_INVALIDPARAMS;
1880 - return glDD7->GetMonitorFrequency(lpdwFrequency);
 2125+ TRACE_ENTER(2,14,this,14,lpdwFrequency);
 2126+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2127+ TRACE_RET(23,glDD7->GetMonitorFrequency(lpdwFrequency));
18812128 }
18822129 HRESULT WINAPI glDirectDraw4::GetScanLine(LPDWORD lpdwScanLine)
18832130 {
1884 - if(!this) return DDERR_INVALIDPARAMS;
1885 - return glDD7->GetScanLine(lpdwScanLine);
 2131+ TRACE_ENTER(2,14,this,14,lpdwScanLine);
 2132+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2133+ TRACE_RET(23,glDD7->GetScanLine(lpdwScanLine));
18862134 }
18872135 HRESULT WINAPI glDirectDraw4::GetVerticalBlankStatus(LPBOOL lpbIsInVB)
18882136 {
1889 - if(!this) return DDERR_INVALIDPARAMS;
1890 - return glDD7->GetVerticalBlankStatus(lpbIsInVB);
 2137+ TRACE_ENTER(2,14,this,14,lpbIsInVB);
 2138+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2139+ TRACE_RET(23,glDD7->GetVerticalBlankStatus(lpbIsInVB));
18912140 }
18922141 HRESULT WINAPI glDirectDraw4::Initialize(GUID FAR *lpGUID)
18932142 {
1894 - if(!this) return DDERR_INVALIDPARAMS;
1895 - return glDD7->Initialize(lpGUID);
 2143+ TRACE_ENTER(2,14,this,24,lpGUID);
 2144+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2145+ TRACE_RET(23,glDD7->Initialize(lpGUID));
18962146 }
18972147 HRESULT WINAPI glDirectDraw4::RestoreDisplayMode()
18982148 {
1899 - if(!this) return DDERR_INVALIDPARAMS;
1900 - return glDD7->RestoreDisplayMode();
 2149+ TRACE_ENTER(1,14,this);
 2150+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2151+ TRACE_RET(23,glDD7->RestoreDisplayMode());
19012152 }
19022153 HRESULT WINAPI glDirectDraw4::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
19032154 {
1904 - if(!this) return DDERR_INVALIDPARAMS;
1905 - return glDD7->SetCooperativeLevel(hWnd,dwFlags);
 2155+ TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
 2156+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2157+ TRACE_RET(23,glDD7->SetCooperativeLevel(hWnd,dwFlags));
19062158 }
19072159 HRESULT WINAPI glDirectDraw4::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
19082160 {
1909 - if(!this) return DDERR_INVALIDPARAMS;
1910 - return glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
 2161+ TRACE_ENTER(6,14,this,8,dwWidth,8,dwHeight,8,dwBPP,8,dwRefreshRate,9,dwFlags);
 2162+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2163+ TRACE_RET(23,glDD7->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags));
19112164 }
19122165 HRESULT WINAPI glDirectDraw4::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
19132166 {
1914 - if(!this) return DDERR_INVALIDPARAMS;
1915 - return glDD7->WaitForVerticalBlank(dwFlags,hEvent);
 2167+ TRACE_ENTER(3,14,this,9,dwFlags,14,hEvent);
 2168+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2169+ TRACE_RET(23,glDD7->WaitForVerticalBlank(dwFlags,hEvent));
19162170 }
19172171 HRESULT WINAPI glDirectDraw4::GetAvailableVidMem(LPDDSCAPS2 lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree)
19182172 {
1919 - if(!this) return DDERR_INVALIDPARAMS;
1920 - FIXME("IDirectDraw4::GetAvailableVidMem: stub\n");
1921 - ERR(DDERR_GENERIC);
 2173+ TRACE_ENTER(4,14,this,14,lpDDSCaps,14,lpdwTotal,14,lpdwFree);
 2174+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2175+ TRACE_RET(23,glDD7->GetAvailableVidMem(lpDDSCaps,lpdwTotal,lpdwFree));
19222176 }
19232177 HRESULT WINAPI glDirectDraw4::GetSurfaceFromDC(HDC hdc, LPDIRECTDRAWSURFACE4 *lpDDS)
19242178 {
1925 - if(!this) return DDERR_INVALIDPARAMS;
 2179+ TRACE_ENTER(3,14,this,13,hdc,14,lpDDS);
 2180+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
19262181 FIXME("IDirectDraw4::GetSurfaceFromDC: stub\n");
 2182+ TRACE_EXIT(23,DDERR_GENERIC);
19272183 ERR(DDERR_GENERIC);
19282184 }
19292185 HRESULT WINAPI glDirectDraw4::RestoreAllSurfaces()
19302186 {
1931 - if(!this) return DDERR_INVALIDPARAMS;
1932 - return glDD7->RestoreAllSurfaces();
 2187+ TRACE_ENTER(1,14,this);
 2188+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2189+ TRACE_RET(23,glDD7->RestoreAllSurfaces());
19332190 }
19342191 HRESULT WINAPI glDirectDraw4::TestCooperativeLevel()
19352192 {
1936 - if(!this) return DDERR_INVALIDPARAMS;
1937 - return glDD7->TestCooperativeLevel();
 2193+ TRACE_ENTER(1,14,this);
 2194+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2195+ TRACE_RET(23,glDD7->TestCooperativeLevel());
19382196 }
19392197 HRESULT WINAPI glDirectDraw4::GetDeviceIdentifier(LPDDDEVICEIDENTIFIER lpdddi, DWORD dwFlags)
19402198 {
1941 - if(!this) return DDERR_INVALIDPARAMS;
1942 - if(!lpdddi) return DDERR_INVALIDPARAMS;
 2199+ TRACE_ENTER(3,14,this,14,lpdddi,9,dwFlags);
 2200+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 2201+ if(!lpdddi) TRACE_RET(23,DDERR_INVALIDPARAMS);
19432202 devid.guidDeviceIdentifier = device_template;
19442203 memcpy(lpdddi,&devid,sizeof(DDDEVICEIDENTIFIER));
 2204+ TRACE_EXIT(23,DD_OK);
19452205 return DD_OK;
19462206 }
\ No newline at end of file
Index: ddraw/trace.cpp
@@ -18,6 +18,7 @@
1919 #include "common.h"
2020
2121 /* Data types:
 22+-1 - C++ constructor/destructor
2223 0 - void
2324 1 - 8-bit signed
2425 2 - 8-bit unsigned
@@ -43,7 +44,7 @@
4445 22 - int BOOL
4546 23 - HRESULT
4647 24 - GUID pointer
47 -25 -
 48+25 - SIZE pointer
4849 26 - RECT pointer
4950 */
5051
@@ -277,6 +278,13 @@
278279 }
279280 WriteFile(outfile,str,strlen(str),&byteswritten,NULL);
280281 }
 282+static void trace_decode_size(SIZE *size)
 283+{
 284+ DWORD byteswritten;
 285+ char str[64];
 286+ sprintf(str,"{%d,%d}",size->cx,size->cy);
 287+ WriteFile(outfile,str,strlen(str),&byteswritten,NULL);
 288+}
281289 static void trace_decode_rect(RECT *rect)
282290 {
283291 DWORD byteswritten;
@@ -309,6 +317,9 @@
310318 str[0] = 0;
311319 switch(type)
312320 {
 321+ case -1: // C++ constructor/destructor
 322+ // No return type in a constructor or destructor.
 323+ break;
313324 case 0: // void
314325 WriteFile(outfile,"void",4,&byteswritten,NULL);
315326 break;
@@ -368,8 +379,13 @@
369380 if(!arg) WriteFile(outfile,"NULL",4,&byteswritten,NULL);
370381 else
371382 {
 383+#ifdef _M_X64
 384+ sprintf(str,"0x%016I64X",arg);
 385+ WriteFile(outfile,str,strlen(str),&byteswritten,NULL);
 386+#else
372387 sprintf(str,"0x%08X",arg);
373388 WriteFile(outfile,str,strlen(str),&byteswritten,NULL);
 389+#endif
374390 }
375391 break;
376392 case 15: // ASCII string
@@ -455,10 +471,13 @@
456472 break;
457473 case 24: // GUID pointer
458474 if(!arg) WriteFile(outfile,"NULL",4,&byteswritten,NULL);
 475+ else if(arg == (void*)DDCREATE_HARDWAREONLY) WriteFile(outfile,"DDCREATE_HARDWAREONLY",21,&byteswritten,NULL);
 476+ else if(arg == (void*)DDCREATE_EMULATIONONLY) WriteFile(outfile,"DDCREATE_EMULATIONONLY",22,&byteswritten,NULL);
459477 else trace_decode_guid((GUID*)arg);
460478 break;
461 - case 25: // reserved
462 - WriteFile(outfile,"Unknown type",12,&byteswritten,NULL);
 479+ case 25: // SIZE pointer
 480+ if(!arg) WriteFile(outfile,"NULL",4,&byteswritten,NULL);
 481+ else trace_decode_size((SIZE*)arg);
463482 break;
464483 case 26: // RECT pointer
465484 if(!arg) WriteFile(outfile,"NULL",4,&byteswritten,NULL);
@@ -469,7 +488,7 @@
470489 break;
471490 }
472491 }
473 -void TRACE_ENTER(const char *function, int paramcount, ...)
 492+void trace_enter(const char *function, int paramcount, ...)
474493 {
475494 if(trace_fail) return;
476495 if(!trace_ready) init_trace();
@@ -491,7 +510,7 @@
492511 trace_depth++;
493512 LeaveCriticalSection(&trace_cs);
494513 }
495 -void TRACE_EXIT(const char *function, int argtype, void *arg)
 514+void trace_exit(const char *function, int argtype, void *arg)
496515 {
497516 if(trace_fail) return;
498517 if(!trace_ready) init_trace();
@@ -506,7 +525,7 @@
507526 WriteFile(outfile,"\r\n",2,&byteswritten,NULL);
508527 LeaveCriticalSection(&trace_cs);
509528 }
510 -void TRACE_VAR(const char *function, const char *var, int argtype, void *arg)
 529+void trace_var(const char *function, const char *var, int argtype, void *arg)
511530 {
512531 if(trace_fail) return;
513532 if(!trace_ready) init_trace();
Index: ddraw/trace.h
@@ -21,12 +21,22 @@
2222
2323
2424 #ifdef _TRACE
25 -void TRACE_ENTER(const char *function, int paramcount, ...);
26 -void TRACE_EXIT(const char *function, int argtype, void *arg);
27 -void TRACE_VAR(const char *function, const char *var, int argtype, void *arg);
 25+#define TRACE_ENTER(paramcount,...) trace_enter(__FUNCTION__,paramcount,__VA_ARGS__)
 26+#define TRACE_EXIT(argtype,arg) trace_exit(__FUNCTION__,argtype,(void*)arg);
 27+#define TRACE_VAR(var,argtype,arg) trace_var(__FUNCTION__,var,argtype,(void*)arg);
 28+void trace_enter(const char *function, int paramcount, ...);
 29+void trace_exit(const char *function, int argtype, void *arg);
 30+void trace_var(const char *function, const char *var, int argtype, void *arg);
 31+#define TRACE_RET(argtype, arg) \
 32+{\
 33+ trace_exit(__FUNCTION__,argtype,(void*)arg);\
 34+ return arg;\
 35+}
2836 #else
2937 #define TRACE_ENTER(a,...)
30 -#define TRACE_EXIT(a,b,c)
 38+#define TRACE_EXIT(a,b)
 39+#define TRACE_VAR(a,b,c)
 40+#define TRACE_RET(argtype, arg) return arg;
3141 #endif
3242
3343 #endif //_TRACE_H
\ No newline at end of file