diff --git a/reactos/dll/directx/ddraw/Surface/createsurface.c b/reactos/dll/directx/ddraw/Surface/createsurface.c index bb290682b15..5dddd5825a7 100644 --- a/reactos/dll/directx/ddraw/Surface/createsurface.c +++ b/reactos/dll/directx/ddraw/Surface/createsurface.c @@ -106,7 +106,7 @@ CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This, DDHAL_CREATESURFACEDATA mDdCreateSurface; - That[0]->lpLcl->lpSurfMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); + DxHeapMemAlloc( That[0]->lpLcl->lpSurfMore, sizeof(DDRAWI_DDRAWSURFACE_MORE)); if (That[0]->lpLcl->lpSurfMore == NULL) { DxHeapMemFree(That); @@ -198,7 +198,7 @@ CreateBackBufferSurface(LPDDRAWI_DIRECTDRAW_INT This, { - That[t]->lpLcl->lpSurfMore = DxHeapMemAlloc(sizeof(DDRAWI_DDRAWSURFACE_MORE)); + DxHeapMemAlloc(That[t]->lpLcl->lpSurfMore, sizeof(DDRAWI_DDRAWSURFACE_MORE)); if (That[t]->lpLcl->lpSurfMore == NULL) { DxHeapMemFree(That); diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index bae1f9f4ecc..da0964b67c2 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -35,9 +35,15 @@ void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src VOID Cleanup(LPDIRECTDRAW7 iface); /* own macro to alloc memmory */ + +/* #define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m) #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p); \ p = NULL; +*/ +#define DxHeapMemAlloc(p, m) p = malloc(m) +#define DxHeapMemFree(p) free(p); \ + p = NULL; /******** Main Object ********/ diff --git a/reactos/dll/directx/ddraw/startup.c b/reactos/dll/directx/ddraw/startup.c index 9c1d5655742..6ce852b89c9 100644 --- a/reactos/dll/directx/ddraw/startup.c +++ b/reactos/dll/directx/ddraw/startup.c @@ -106,7 +106,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, /* FIXME HACK linking does not working we need figout why */ LPDDRAWI_DIRECTDRAW_INT memThis; - memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT)); This = memThis; if (This == NULL) { @@ -118,7 +118,7 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, } /* Fixme release memory alloc if we fail */ - This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); + DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_INT)); if (This->lpLcl == NULL) { DX_STUB_str("DDERR_OUTOFMEMORY"); @@ -194,7 +194,8 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable) This->lpLcl->lpGbl->dwRefCnt++; if (ddgbl.lpDDCBtmp == NULL) { - ddgbl.lpDDCBtmp = (LPDDHAL_CALLBACKS) DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); + // LPDDHAL_CALLBACKS + DxHeapMemAlloc( ddgbl.lpDDCBtmp , sizeof(DDHAL_CALLBACKS)); if (ddgbl.lpDDCBtmp == NULL) { DX_STUB_str("Out of memmory\n"); @@ -403,7 +404,7 @@ StartDirectDrawHel(LPDIRECTDRAW iface, BOOL reenable) HRESULT WINAPI StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) { - LPDWORD mpFourCC; + LPDWORD mpFourCC = NULL; DDHALINFO mHALInfo; BOOL newmode = FALSE; LPDDSURFACEDESC mpTextures; @@ -411,6 +412,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) D3DHAL_GLOBALDRIVERDATA mD3dDriverData; DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks; LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface; + INT count; DX_WINDBG_trace(); @@ -423,7 +425,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) { if (ddgbl.lpDDCBtmp == NULL) { - ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); + DxHeapMemAlloc(ddgbl.lpDDCBtmp, sizeof(DDHAL_CALLBACKS)); if ( ddgbl.lpDDCBtmp == NULL) { return DD_FALSE; @@ -462,7 +464,7 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) &mD3dDriverData, &mD3dBufferCallbacks, NULL, - NULL, + mpFourCC, NULL)) { DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo); @@ -471,24 +473,44 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) return DD_FALSE; } - DX_STUB_str("Here\n"); -#if 0 - /* Alloc mpFourCC */ - mpFourCC = NULL; - if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) + { - mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes); + char buffer[2048]; + sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes); + OutputDebugStringA(buffer); + } + + // count = mHALInfo.ddCaps.dwNumFourCCCodes; + + DX_STUB_str("Here\n"); + + /* Alloc mpFourCC */ + + //if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) + { + //mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21); + // DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21); + + // mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2)); + /* if (mpFourCC == NULL) { DxHeapMemFree(ddgbl.lpDDCBtmp); // FIXME Close DX fristcall and second call return DD_FALSE; } + */ } - DX_STUB_str("Here\n"); -#else - mpFourCC = NULL; -#endif + + DX_STUB_str("Here\n"); + + { + char buffer[2048]; + sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes); + OutputDebugStringA(buffer); + } + + /* Alloc mpTextures */ #if 0 mpTextures = NULL; @@ -529,6 +551,12 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable) return DD_FALSE; } + { + char buffer[2048]; + sprintf ( buffer, "test %d %d\n", mpFourCC, mHALInfo.ddCaps.dwNumFourCCCodes); + OutputDebugStringA(buffer); + } + memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));