[D3DRM] Sync with Wine Staging 3.3. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 8 Mar 2018 12:17:38 +0000 (13:17 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 8 Mar 2018 12:17:38 +0000 (13:17 +0100)
15 files changed:
dll/directx/wine/d3drm/CMakeLists.txt
dll/directx/wine/d3drm/d3drm.c
dll/directx/wine/d3drm/d3drm_main.c
dll/directx/wine/d3drm/d3drm_private.h
dll/directx/wine/d3drm/device.c
dll/directx/wine/d3drm/face.c
dll/directx/wine/d3drm/frame.c
dll/directx/wine/d3drm/light.c
dll/directx/wine/d3drm/material.c
dll/directx/wine/d3drm/math.c
dll/directx/wine/d3drm/meshbuilder.c
dll/directx/wine/d3drm/precomp.h [new file with mode: 0644]
dll/directx/wine/d3drm/texture.c
dll/directx/wine/d3drm/viewport.c
media/doc/README.WINE

index 7247444..f2ff1f2 100644 (file)
@@ -15,7 +15,7 @@ list(APPEND SOURCE
     meshbuilder.c
     texture.c
     viewport.c
     meshbuilder.c
     texture.c
     viewport.c
-    d3drm_private.h)
+    precomp.h)
 
 add_library(d3drm SHARED
     ${SOURCE}
 
 add_library(d3drm SHARED
     ${SOURCE}
@@ -26,5 +26,5 @@ add_library(d3drm SHARED
 set_module_type(d3drm win32dll UNICODE)
 target_link_libraries(d3drm dxguid uuid wine)
 add_importlibs(d3drm ddraw d3dxof msvcrt kernel32 ntdll)
 set_module_type(d3drm win32dll UNICODE)
 target_link_libraries(d3drm dxguid uuid wine)
 add_importlibs(d3drm ddraw d3dxof msvcrt kernel32 ntdll)
-add_pch(d3drm d3drm_private.h SOURCE)
+add_pch(d3drm precomp.h SOURCE)
 add_cd_file(TARGET d3drm DESTINATION reactos/system32 FOR all)
 add_cd_file(TARGET d3drm DESTINATION reactos/system32 FOR all)
index 8c46751..3ea1632 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static const char* get_IID_string(const GUID* guid)
 {
     if (IsEqualGUID(guid, &IID_IDirect3DRMFrame))
 static const char* get_IID_string(const GUID* guid)
 {
     if (IsEqualGUID(guid, &IID_IDirect3DRMFrame))
@@ -208,7 +213,7 @@ static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
 
 static void d3drm_destroy(struct d3drm *d3drm)
 {
 
 static void d3drm_destroy(struct d3drm *d3drm)
 {
-    HeapFree(GetProcessHeap(), 0, d3drm);
+    heap_free(d3drm);
     TRACE("d3drm object %p is being destroyed.\n", d3drm);
 }
 
     TRACE("d3drm object %p is being destroyed.\n", d3drm);
 }
 
@@ -2303,7 +2308,7 @@ HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
 
     TRACE("d3drm %p.\n", d3drm);
 
 
     TRACE("d3drm %p.\n", d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl;
index 5071671..1abfe6f 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include "initguid.h"
 #include "d3drm_private.h"
 
 /***********************************************************************
 #include "d3drm_private.h"
 
 /***********************************************************************
@@ -58,8 +62,7 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE
     if (!cb)
         return D3DRMERR_BADVALUE;
 
     if (!cb)
         return D3DRMERR_BADVALUE;
 
-    callback = HeapAlloc(GetProcessHeap(), 0, sizeof(*callback));
-    if (!callback)
+    if (!(callback = heap_alloc(sizeof(*callback))))
         return E_OUTOFMEMORY;
 
     callback->cb = cb;
         return E_OUTOFMEMORY;
 
     callback->cb = cb;
@@ -81,7 +84,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO
         if (callback->cb == cb && callback->ctx == ctx)
         {
             list_remove(&callback->entry);
         if (callback->cb == cb && callback->ctx == ctx)
         {
             list_remove(&callback->entry);
-            HeapFree(GetProcessHeap(), 0, callback);
+            heap_free(callback);
             break;
         }
     }
             break;
         }
     }
@@ -136,13 +139,13 @@ HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
 {
     DWORD req_size;
 
 {
     DWORD req_size;
 
-    HeapFree(GetProcessHeap(), 0, object->name);
+    heap_free(object->name);
     object->name = NULL;
 
     if (name)
     {
         req_size = strlen(name) + 1;
     object->name = NULL;
 
     if (name)
     {
         req_size = strlen(name) + 1;
-        if (!(object->name = HeapAlloc(GetProcessHeap(), 0, req_size)))
+        if (!(object->name = heap_alloc(req_size)))
             return E_OUTOFMEMORY;
         memcpy(object->name, name, req_size);
     }
             return E_OUTOFMEMORY;
         memcpy(object->name, name, req_size);
     }
@@ -158,9 +161,9 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
     {
         callback->cb(iface, callback->ctx);
         list_remove(&callback->entry);
     {
         callback->cb(iface, callback->ctx);
         list_remove(&callback->entry);
-        HeapFree(GetProcessHeap(), 0, callback);
+        heap_free(callback);
     }
 
     }
 
-    HeapFree(GetProcessHeap(), 0, object->name);
+    heap_free(object->name);
     object->name = NULL;
 }
     object->name = NULL;
 }
index f6391a9..0f24f80 100644 (file)
 #ifndef __D3DRM_PRIVATE_INCLUDED__
 #define __D3DRM_PRIVATE_INCLUDED__
 
 #ifndef __D3DRM_PRIVATE_INCLUDED__
 #define __D3DRM_PRIVATE_INCLUDED__
 
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
-#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSUNION
-
+#define NONAMELESSSTRUCT
+#define COBJMACROS
 #include <assert.h>
 #include <math.h>
 #include <assert.h>
 #include <math.h>
-
-#include <windef.h>
-#include <winbase.h>
-#include <wingdi.h>
-#include <d3drm.h>
-#include <dxfile.h>
-#include <d3drmwin.h>
-#include <rmxfguid.h>
-
-#include <wine/debug.h>
-WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
-
-#include <wine/list.h>
+#include "dxfile.h"
+#include "d3drmwin.h"
+#include "rmxfguid.h"
+#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/list.h"
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
index 865e372..2aa7e48 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_device *impl_from_IDirect3DRMDevice(IDirect3DRMDevice *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice_iface);
 static inline struct d3drm_device *impl_from_IDirect3DRMDevice(IDirect3DRMDevice *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice_iface);
@@ -56,7 +61,7 @@ void d3drm_device_destroy(struct d3drm_device *device)
         IDirectDraw_Release(device->ddraw);
         IDirect3DRM_Release(device->d3drm);
     }
         IDirectDraw_Release(device->ddraw);
         IDirect3DRM_Release(device->d3drm);
     }
-    HeapFree(GetProcessHeap(), 0, device);
+    heap_free(device);
 }
 
 static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
 }
 
 static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
@@ -1636,7 +1641,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
 
     TRACE("device %p, d3drm %p.\n", device, d3drm);
 
 
     TRACE("device %p, d3drm %p.\n", device, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl;
index ff492d0..324b1de 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
 static inline struct d3drm_face *impl_from_IDirect3DRMFace(IDirect3DRMFace *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_face, IDirect3DRMFace_iface);
@@ -77,7 +82,7 @@ static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
     if (!refcount)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
     if (!refcount)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
-        HeapFree(GetProcessHeap(), 0, face);
+        heap_free(face);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -622,7 +627,7 @@ HRESULT d3drm_face_create(struct d3drm_face **face)
 
     TRACE("face %p.\n", face);
 
 
     TRACE("face %p.\n", face);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
index 1f1fcdb..11105db 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static D3DRMMATRIX4D identity = {
     { 1.0f, 0.0f, 0.0f, 0.0f },
     { 0.0f, 1.0f, 0.0f, 0.0f },
 static D3DRMMATRIX4D identity = {
     { 1.0f, 0.0f, 0.0f, 0.0f },
     { 0.0f, 1.0f, 0.0f, 0.0f },
@@ -136,8 +141,8 @@ static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface)
         {
             IDirect3DRMFrame_Release(array->frames[i]);
         }
         {
             IDirect3DRMFrame_Release(array->frames[i]);
         }
-        HeapFree(GetProcessHeap(), 0, array->frames);
-        HeapFree(GetProcessHeap(), 0, array);
+        heap_free(array->frames);
+        heap_free(array);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -188,7 +193,7 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
     struct d3drm_frame_array *array;
     unsigned int i;
 
     struct d3drm_frame_array *array;
     unsigned int i;
 
-    if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
+    if (!(array = heap_alloc_zero(sizeof(*array))))
         return NULL;
 
     array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
         return NULL;
 
     array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
@@ -197,9 +202,9 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
 
     if (frame_count)
     {
 
     if (frame_count)
     {
-        if (!(array->frames = HeapAlloc(GetProcessHeap(), 0, frame_count * sizeof(*array->frames))))
+        if (!(array->frames = heap_calloc(frame_count, sizeof(*array->frames))))
         {
         {
-            HeapFree(GetProcessHeap(), 0, array);
+            heap_free(array);
             return NULL;
         }
 
             return NULL;
         }
 
@@ -254,8 +259,8 @@ static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
         {
             IDirect3DRMVisual_Release(array->visuals[i]);
         }
         {
             IDirect3DRMVisual_Release(array->visuals[i]);
         }
-        HeapFree(GetProcessHeap(), 0, array->visuals);
-        HeapFree(GetProcessHeap(), 0, array);
+        heap_free(array->visuals);
+        heap_free(array);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -306,7 +311,7 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
     struct d3drm_visual_array *array;
     unsigned int i;
 
     struct d3drm_visual_array *array;
     unsigned int i;
 
-    if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
+    if (!(array = heap_alloc_zero(sizeof(*array))))
         return NULL;
 
     array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
         return NULL;
 
     array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
@@ -315,9 +320,9 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
 
     if (visual_count)
     {
 
     if (visual_count)
     {
-        if (!(array->visuals = HeapAlloc(GetProcessHeap(), 0, visual_count * sizeof(*array->visuals))))
+        if (!(array->visuals = heap_calloc(visual_count, sizeof(*array->visuals))))
         {
         {
-            HeapFree(GetProcessHeap(), 0, array);
+            heap_free(array);
             return NULL;
         }
 
             return NULL;
         }
 
@@ -373,8 +378,8 @@ static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface)
         {
             IDirect3DRMLight_Release(array->lights[i]);
         }
         {
             IDirect3DRMLight_Release(array->lights[i]);
         }
-        HeapFree(GetProcessHeap(), 0, array->lights);
-        HeapFree(GetProcessHeap(), 0, array);
+        heap_free(array->lights);
+        heap_free(array);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -425,7 +430,7 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
     struct d3drm_light_array *array;
     unsigned int i;
 
     struct d3drm_light_array *array;
     unsigned int i;
 
-    if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
+    if (!(array = heap_alloc_zero(sizeof(*array))))
         return NULL;
 
     array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
         return NULL;
 
     array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
@@ -434,9 +439,9 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
 
     if (light_count)
     {
 
     if (light_count)
     {
-        if (!(array->lights = HeapAlloc(GetProcessHeap(), 0, light_count * sizeof(*array->lights))))
+        if (!(array->lights = heap_calloc(light_count, sizeof(*array->lights))))
         {
         {
-            HeapFree(GetProcessHeap(), 0, array);
+            heap_free(array);
             return NULL;
         }
 
             return NULL;
         }
 
@@ -543,19 +548,19 @@ static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface)
         {
             IDirect3DRMFrame3_Release(frame->children[i]);
         }
         {
             IDirect3DRMFrame3_Release(frame->children[i]);
         }
-        HeapFree(GetProcessHeap(), 0, frame->children);
+        heap_free(frame->children);
         for (i = 0; i < frame->nb_visuals; ++i)
         {
             IDirect3DRMVisual_Release(frame->visuals[i]);
         }
         for (i = 0; i < frame->nb_visuals; ++i)
         {
             IDirect3DRMVisual_Release(frame->visuals[i]);
         }
-        HeapFree(GetProcessHeap(), 0, frame->visuals);
+        heap_free(frame->visuals);
         for (i = 0; i < frame->nb_lights; ++i)
         {
             IDirect3DRMLight_Release(frame->lights[i]);
         }
         for (i = 0; i < frame->nb_lights; ++i)
         {
             IDirect3DRMLight_Release(frame->lights[i]);
         }
-        HeapFree(GetProcessHeap(), 0, frame->lights);
+        heap_free(frame->lights);
         IDirect3DRM_Release(frame->d3drm);
         IDirect3DRM_Release(frame->d3drm);
-        HeapFree(GetProcessHeap(), 0, frame);
+        heap_free(frame);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -2935,7 +2940,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
 
     TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm);
 
 
     TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl;
@@ -2956,7 +2961,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
 
         if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p)))
         {
 
         if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p)))
         {
-            HeapFree(GetProcessHeap(), 0, object);
+            heap_free(object);
             return hr;
         }
         IDirect3DRMFrame_Release(parent_frame);
             return hr;
         }
         IDirect3DRMFrame_Release(parent_frame);
@@ -3033,10 +3038,10 @@ static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
         IDirect3DRM_Release(animation->d3drm);
     {
         d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
         IDirect3DRM_Release(animation->d3drm);
-        HeapFree(GetProcessHeap(), 0, animation->rotate.keys);
-        HeapFree(GetProcessHeap(), 0, animation->scale.keys);
-        HeapFree(GetProcessHeap(), 0, animation->position.keys);
-        HeapFree(GetProcessHeap(), 0, animation);
+        heap_free(animation->rotate.keys);
+        heap_free(animation->scale.keys);
+        heap_free(animation->position.keys);
+        heap_free(animation);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -3687,7 +3692,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *
 
     TRACE("animation %p, d3drm %p.\n", animation, d3drm);
 
 
     TRACE("animation %p, d3drm %p.\n", animation, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
index b266956..e31c026 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_light *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_light, IDirect3DRMLight_iface);
 static inline struct d3drm_light *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_light, IDirect3DRMLight_iface);
@@ -65,7 +70,7 @@ static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
         IDirect3DRM_Release(light->d3drm);
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
         IDirect3DRM_Release(light->d3drm);
-        HeapFree(GetProcessHeap(), 0, light);
+        heap_free(light);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -373,7 +378,7 @@ HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
 
     TRACE("light %p.\n", light);
 
 
     TRACE("light %p.\n", light);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
index 4b56148..62acb5a 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_material *impl_from_IDirect3DRMMaterial2(IDirect3DRMMaterial2 *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_material, IDirect3DRMMaterial2_iface);
 static inline struct d3drm_material *impl_from_IDirect3DRMMaterial2(IDirect3DRMMaterial2 *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_material, IDirect3DRMMaterial2_iface);
@@ -66,7 +71,7 @@ static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
         IDirect3DRM_Release(material->d3drm);
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
         IDirect3DRM_Release(material->d3drm);
-        HeapFree(GetProcessHeap(), 0, material);
+        heap_free(material);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -281,7 +286,7 @@ HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3d
 
     TRACE("material %p, d3drm %p.\n", material, d3drm);
 
 
     TRACE("material %p, d3drm %p.\n", material, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
index 94d8771..a6c0c85 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "d3drm_private.h"
+#include "config.h"
+#include "wine/port.h"
 
 
-#include <math.h>
+#include "d3drm_private.h"
 
 /* Create a RGB color from its components */
 D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue)
 
 /* Create a RGB color from its components */
 D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue)
index 962d8f6..0090555 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 struct coords_2d
 {
     D3DVALUE u;
 struct coords_2d
 {
     D3DVALUE u;
@@ -274,12 +279,7 @@ BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count
     if (new_capacity < element_count)
         new_capacity = max_capacity;
 
     if (new_capacity < element_count)
         new_capacity = max_capacity;
 
-    if (*elements)
-        new_elements = HeapReAlloc(GetProcessHeap(), 0, *elements, new_capacity * element_size);
-    else
-        new_elements = HeapAlloc(GetProcessHeap(), 0, new_capacity * element_size);
-
-    if (!new_elements)
+    if (!(new_elements = heap_realloc(*elements, new_capacity * element_size)))
         return FALSE;
 
     *elements = new_elements;
         return FALSE;
 
     *elements = new_elements;
@@ -312,19 +312,19 @@ static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder)
     DWORD i;
 
     IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, NULL);
     DWORD i;
 
     IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, NULL);
-    HeapFree(GetProcessHeap(), 0, mesh_builder->vertices);
+    heap_free(mesh_builder->vertices);
     mesh_builder->vertices = NULL;
     mesh_builder->nb_vertices = 0;
     mesh_builder->vertices_size = 0;
     mesh_builder->vertices = NULL;
     mesh_builder->nb_vertices = 0;
     mesh_builder->vertices_size = 0;
-    HeapFree(GetProcessHeap(), 0, mesh_builder->normals);
+    heap_free(mesh_builder->normals);
     mesh_builder->normals = NULL;
     mesh_builder->nb_normals = 0;
     mesh_builder->normals_size = 0;
     mesh_builder->normals = NULL;
     mesh_builder->nb_normals = 0;
     mesh_builder->normals_size = 0;
-    HeapFree(GetProcessHeap(), 0, mesh_builder->pFaceData);
+    heap_free(mesh_builder->pFaceData);
     mesh_builder->pFaceData = NULL;
     mesh_builder->face_data_size = 0;
     mesh_builder->nb_faces = 0;
     mesh_builder->pFaceData = NULL;
     mesh_builder->face_data_size = 0;
     mesh_builder->nb_faces = 0;
-    HeapFree(GetProcessHeap(), 0, mesh_builder->pCoords2d);
+    heap_free(mesh_builder->pCoords2d);
     mesh_builder->pCoords2d = NULL;
     mesh_builder->nb_coords2d = 0;
     for (i = 0; i < mesh_builder->nb_materials; i++)
     mesh_builder->pCoords2d = NULL;
     mesh_builder->nb_coords2d = 0;
     for (i = 0; i < mesh_builder->nb_materials; i++)
@@ -335,9 +335,9 @@ static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder)
             IDirect3DRMTexture3_Release(mesh_builder->materials[i].texture);
     }
     mesh_builder->nb_materials = 0;
             IDirect3DRMTexture3_Release(mesh_builder->materials[i].texture);
     }
     mesh_builder->nb_materials = 0;
-    HeapFree(GetProcessHeap(), 0, mesh_builder->materials);
+    heap_free(mesh_builder->materials);
     mesh_builder->materials = NULL;
     mesh_builder->materials = NULL;
-    HeapFree(GetProcessHeap(), 0, mesh_builder->material_indices);
+    heap_free(mesh_builder->material_indices);
     mesh_builder->material_indices = NULL;
 }
 
     mesh_builder->material_indices = NULL;
 }
 
@@ -396,7 +396,7 @@ static ULONG WINAPI d3drm_mesh_builder2_Release(IDirect3DRMMeshBuilder2 *iface)
         if (mesh_builder->texture)
             IDirect3DRMTexture3_Release(mesh_builder->texture);
         IDirect3DRM_Release(mesh_builder->d3drm);
         if (mesh_builder->texture)
             IDirect3DRMTexture3_Release(mesh_builder->texture);
         IDirect3DRM_Release(mesh_builder->d3drm);
-        HeapFree(GetProcessHeap(), 0, mesh_builder);
+        heap_free(mesh_builder);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -1045,13 +1045,14 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
         return hr;
     if (size)
     {
         return hr;
     if (size)
     {
-        char *name = HeapAlloc(GetProcessHeap(), 0, size);
-        if (!name)
+        char *name;
+
+        if (!(name = heap_alloc(size)))
             return E_OUTOFMEMORY;
 
         if (SUCCEEDED(hr = IDirectXFileData_GetName(pData, name, &size)))
             IDirect3DRMMeshBuilder3_SetName(iface, name);
             return E_OUTOFMEMORY;
 
         if (SUCCEEDED(hr = IDirectXFileData_GetName(pData, name, &size)))
             IDirect3DRMMeshBuilder3_SetName(iface, name);
-        HeapFree(GetProcessHeap(), 0, name);
+        heap_free(name);
         if (hr != DXFILE_OK)
             return hr;
     }
         if (hr != DXFILE_OK)
             return hr;
     }
@@ -1079,12 +1080,12 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
     }
     memcpy(mesh_builder->vertices, ptr + sizeof(DWORD), mesh_builder->nb_vertices * sizeof(D3DVECTOR));
 
     }
     memcpy(mesh_builder->vertices, ptr + sizeof(DWORD), mesh_builder->nb_vertices * sizeof(D3DVECTOR));
 
-    faces_vertex_idx_ptr = faces_vertex_idx_data = HeapAlloc(GetProcessHeap(), 0, faces_vertex_idx_size);
+    faces_vertex_idx_ptr = faces_vertex_idx_data = heap_alloc(faces_vertex_idx_size);
     memcpy(faces_vertex_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD),
             faces_vertex_idx_size);
 
     /* Each vertex index will have its normal index counterpart so just allocate twice the size */
     memcpy(faces_vertex_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD),
             faces_vertex_idx_size);
 
     /* Each vertex index will have its normal index counterpart so just allocate twice the size */
-    mesh_builder->pFaceData = HeapAlloc(GetProcessHeap(), 0, faces_vertex_idx_size * 2);
+    mesh_builder->pFaceData = heap_alloc(faces_vertex_idx_size * 2);
     faces_data_ptr = (DWORD*)mesh_builder->pFaceData;
 
     while (1)
     faces_data_ptr = (DWORD*)mesh_builder->pFaceData;
 
     while (1)
@@ -1136,8 +1137,9 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
             memcpy(mesh_builder->normals, ptr + sizeof(DWORD), mesh_builder->nb_normals * sizeof(D3DVECTOR));
 
             faces_normal_idx_size = size - (2 * sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR));
             memcpy(mesh_builder->normals, ptr + sizeof(DWORD), mesh_builder->nb_normals * sizeof(D3DVECTOR));
 
             faces_normal_idx_size = size - (2 * sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR));
-            faces_normal_idx_ptr = faces_normal_idx_data = HeapAlloc(GetProcessHeap(), 0, faces_normal_idx_size);
-            memcpy(faces_normal_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR) + sizeof(DWORD), faces_normal_idx_size);
+            faces_normal_idx_ptr = faces_normal_idx_data = heap_alloc(faces_normal_idx_size);
+            memcpy(faces_normal_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR)
+                    + sizeof(DWORD), faces_normal_idx_size);
         }
         else if (IsEqualGUID(guid, &TID_D3DRMMeshTextureCoords))
         {
         }
         else if (IsEqualGUID(guid, &TID_D3DRMMeshTextureCoords))
         {
@@ -1149,7 +1151,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
 
             TRACE("MeshTextureCoords: nb_coords2d = %d\n", mesh_builder->nb_coords2d);
 
 
             TRACE("MeshTextureCoords: nb_coords2d = %d\n", mesh_builder->nb_coords2d);
 
-            mesh_builder->pCoords2d = HeapAlloc(GetProcessHeap(), 0, mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d));
+            mesh_builder->pCoords2d = heap_calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d));
             memcpy(mesh_builder->pCoords2d, ptr + sizeof(DWORD), mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d));
         }
         else if (IsEqualGUID(guid, &TID_D3DRMMeshMaterialList))
             memcpy(mesh_builder->pCoords2d, ptr + sizeof(DWORD), mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d));
         }
         else if (IsEqualGUID(guid, &TID_D3DRMMeshMaterialList))
@@ -1177,15 +1179,15 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
             if (size != data_size)
                 WARN("Returned size %u does not match expected one %u\n", size, data_size);
 
             if (size != data_size)
                 WARN("Returned size %u does not match expected one %u\n", size, data_size);
 
-            mesh_builder->material_indices = HeapAlloc(GetProcessHeap(), 0, sizeof(*mesh_builder->material_indices) * nb_face_indices);
-            if (!mesh_builder->material_indices)
+            if (!(mesh_builder->material_indices = heap_calloc(nb_face_indices,
+                    sizeof(*mesh_builder->material_indices))))
                 goto end;
                 goto end;
-            memcpy(mesh_builder->material_indices, ptr + 2 * sizeof(DWORD), sizeof(*mesh_builder->material_indices) * nb_face_indices),
+            memcpy(mesh_builder->material_indices, ptr + 2 * sizeof(DWORD),
+                    nb_face_indices * sizeof(*mesh_builder->material_indices));
 
 
-            mesh_builder->materials = HeapAlloc(GetProcessHeap(), 0, sizeof(*mesh_builder->materials) * nb_materials);
-            if (!mesh_builder->materials)
+            if (!(mesh_builder->materials = heap_calloc(nb_materials, sizeof(*mesh_builder->materials))))
             {
             {
-                HeapFree(GetProcessHeap(), 0, mesh_builder->material_indices);
+                heap_free(mesh_builder->material_indices);
                 goto end;
             }
             mesh_builder->nb_materials = nb_materials;
                 goto end;
             }
             mesh_builder->nb_materials = nb_materials;
@@ -1437,8 +1439,8 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
     if (!mesh_builder->pCoords2d)
     {
         mesh_builder->nb_coords2d = mesh_builder->nb_vertices;
     if (!mesh_builder->pCoords2d)
     {
         mesh_builder->nb_coords2d = mesh_builder->nb_vertices;
-        mesh_builder->pCoords2d = HeapAlloc(GetProcessHeap(), 0, mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d));
-        for (i = 0; i < mesh_builder->nb_coords2d; i++)
+        mesh_builder->pCoords2d = heap_calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d));
+        for (i = 0; i < mesh_builder->nb_coords2d; ++i)
         {
             mesh_builder->pCoords2d[i].u = 0.0f;
             mesh_builder->pCoords2d[i].v = 0.0f;
         {
             mesh_builder->pCoords2d[i].u = 0.0f;
             mesh_builder->pCoords2d[i].v = 0.0f;
@@ -1451,8 +1453,8 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
 
 end:
 
 
 end:
 
-    HeapFree(GetProcessHeap(), 0, faces_normal_idx_data);
-    HeapFree(GetProcessHeap(), 0, faces_vertex_idx_data);
+    heap_free(faces_normal_idx_data);
+    heap_free(faces_vertex_idx_data);
 
     return ret;
 }
 
     return ret;
 }
@@ -1965,8 +1967,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if
         int k;
         D3DRMVERTEX* vertices;
 
         int k;
         D3DRMVERTEX* vertices;
 
-        vertices = HeapAlloc(GetProcessHeap(), 0, mesh_builder->nb_vertices * sizeof(D3DRMVERTEX));
-        if (!vertices)
+        if (!(vertices = heap_calloc(mesh_builder->nb_vertices, sizeof(*vertices))))
         {
             IDirect3DRMMesh_Release(*mesh);
             return E_OUTOFMEMORY;
         {
             IDirect3DRMMesh_Release(*mesh);
             return E_OUTOFMEMORY;
@@ -1974,7 +1975,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if
         for (i = 0; i < mesh_builder->nb_vertices; i++)
             vertices[i].position = mesh_builder->vertices[i];
         hr = IDirect3DRMMesh_SetVertices(*mesh, 0, 0, mesh_builder->nb_vertices, vertices);
         for (i = 0; i < mesh_builder->nb_vertices; i++)
             vertices[i].position = mesh_builder->vertices[i];
         hr = IDirect3DRMMesh_SetVertices(*mesh, 0, 0, mesh_builder->nb_vertices, vertices);
-        HeapFree(GetProcessHeap(), 0, vertices);
+        heap_free(vertices);
 
         /* Groups are in reverse order compared to materials list in X file */
         for (k = mesh_builder->nb_materials - 1; k >= 0; k--)
 
         /* Groups are in reverse order compared to materials list in X file */
         for (k = mesh_builder->nb_materials - 1; k >= 0; k--)
@@ -1987,17 +1988,15 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if
             unsigned nb_vertices = 0;
             unsigned nb_faces = 0;
 
             unsigned nb_vertices = 0;
             unsigned nb_faces = 0;
 
-            used_vertices = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mesh_builder->face_data_size * sizeof(*used_vertices));
-            if (!used_vertices)
+            if (!(used_vertices = heap_calloc(mesh_builder->face_data_size, sizeof(*used_vertices))))
             {
                 IDirect3DRMMesh_Release(*mesh);
                 return E_OUTOFMEMORY;
             }
 
             {
                 IDirect3DRMMesh_Release(*mesh);
                 return E_OUTOFMEMORY;
             }
 
-            face_data = HeapAlloc(GetProcessHeap(), 0, mesh_builder->face_data_size * sizeof(*face_data));
-            if (!face_data)
+            if (!(face_data = heap_calloc(mesh_builder->face_data_size, sizeof(*face_data))))
             {
             {
-                HeapFree(GetProcessHeap(), 0, used_vertices);
+                heap_free(used_vertices);
                 IDirect3DRMMesh_Release(*mesh);
                 return E_OUTOFMEMORY;
             }
                 IDirect3DRMMesh_Release(*mesh);
                 return E_OUTOFMEMORY;
             }
@@ -2051,8 +2050,8 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if
                     nb_vertices++;
 
             hr = IDirect3DRMMesh_AddGroup(*mesh, nb_vertices, nb_faces, vertex_per_face, face_data, &group);
                     nb_vertices++;
 
             hr = IDirect3DRMMesh_AddGroup(*mesh, nb_vertices, nb_faces, vertex_per_face, face_data, &group);
-            HeapFree(GetProcessHeap(), 0, used_vertices);
-            HeapFree(GetProcessHeap(), 0, face_data);
+            heap_free(used_vertices);
+            heap_free(face_data);
             if (SUCCEEDED(hr))
                 hr = IDirect3DRMMesh_SetGroupColor(*mesh, group, mesh_builder->materials[k].color);
             if (SUCCEEDED(hr))
             if (SUCCEEDED(hr))
                 hr = IDirect3DRMMesh_SetGroupColor(*mesh, group, mesh_builder->materials[k].color);
             if (SUCCEEDED(hr))
@@ -2342,7 +2341,7 @@ HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDir
 
     TRACE("mesh_builder %p.\n", mesh_builder);
 
 
     TRACE("mesh_builder %p.\n", mesh_builder);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMeshBuilder2_iface.lpVtbl = &d3drm_mesh_builder2_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMeshBuilder2_iface.lpVtbl = &d3drm_mesh_builder2_vtbl;
@@ -2403,15 +2402,15 @@ static ULONG WINAPI d3drm_mesh_Release(IDirect3DRMMesh *iface)
         IDirect3DRM_Release(mesh->d3drm);
         for (i = 0; i < mesh->nb_groups; ++i)
         {
         IDirect3DRM_Release(mesh->d3drm);
         for (i = 0; i < mesh->nb_groups; ++i)
         {
-            HeapFree(GetProcessHeap(), 0, mesh->groups[i].vertices);
-            HeapFree(GetProcessHeap(), 0, mesh->groups[i].face_data);
+            heap_free(mesh->groups[i].vertices);
+            heap_free(mesh->groups[i].face_data);
             if (mesh->groups[i].material)
                 IDirect3DRMMaterial2_Release(mesh->groups[i].material);
             if (mesh->groups[i].texture)
                 IDirect3DRMTexture3_Release(mesh->groups[i].texture);
         }
             if (mesh->groups[i].material)
                 IDirect3DRMMaterial2_Release(mesh->groups[i].material);
             if (mesh->groups[i].texture)
                 IDirect3DRMTexture3_Release(mesh->groups[i].texture);
         }
-        HeapFree(GetProcessHeap(), 0, mesh->groups);
-        HeapFree(GetProcessHeap(), 0, mesh);
+        heap_free(mesh->groups);
+        heap_free(mesh);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -2532,8 +2531,7 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte
 
     group = mesh->groups + mesh->nb_groups;
 
 
     group = mesh->groups + mesh->nb_groups;
 
-    group->vertices = HeapAlloc(GetProcessHeap(), 0, vertex_count * sizeof(D3DRMVERTEX));
-    if (!group->vertices)
+    if (!(group->vertices = heap_calloc(vertex_count, sizeof(*group->vertices))))
         return E_OUTOFMEMORY;
     group->nb_vertices = vertex_count;
     group->nb_faces = face_count;
         return E_OUTOFMEMORY;
     group->nb_vertices = vertex_count;
     group->nb_faces = face_count;
@@ -2558,14 +2556,12 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte
         }
     }
 
         }
     }
 
-    group->face_data = HeapAlloc(GetProcessHeap(), 0, group->face_data_size * sizeof(unsigned));
-    if (!group->face_data)
+    if (!(group->face_data = heap_calloc(group->face_data_size, sizeof(*group->face_data))))
     {
     {
-        HeapFree(GetProcessHeap(), 0 , group->vertices);
+        heap_free(group->vertices);
         return E_OUTOFMEMORY;
     }
         return E_OUTOFMEMORY;
     }
-
-    memcpy(group->face_data, face_data, group->face_data_size * sizeof(unsigned));
+    memcpy(group->face_data, face_data, group->face_data_size * sizeof(*face_data));
 
     group->material = NULL;
     group->texture = NULL;
 
     group->material = NULL;
     group->texture = NULL;
@@ -2844,7 +2840,7 @@ HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm)
 
     TRACE("mesh %p, d3drm %p.\n", mesh, d3drm);
 
 
     TRACE("mesh %p, d3drm %p.\n", mesh, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl;
@@ -2898,7 +2894,7 @@ static ULONG WINAPI d3drm_wrap_Release(IDirect3DRMWrap *iface)
     if (!refcount)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &wrap->obj);
     if (!refcount)
     {
         d3drm_object_cleanup((IDirect3DRMObject *)iface, &wrap->obj);
-        HeapFree(GetProcessHeap(), 0, wrap);
+        heap_free(wrap);
     }
 
     return refcount;
     }
 
     return refcount;
@@ -3030,7 +3026,7 @@ HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm)
 
     TRACE("wrap %p, d3drm %p.\n", wrap, d3drm);
 
 
     TRACE("wrap %p, d3drm %p.\n", wrap, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMWrap_iface.lpVtbl = &d3drm_wrap_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMWrap_iface.lpVtbl = &d3drm_wrap_vtbl;
diff --git a/dll/directx/wine/d3drm/precomp.h b/dll/directx/wine/d3drm/precomp.h
new file mode 100644 (file)
index 0000000..7b48c5c
--- /dev/null
@@ -0,0 +1,19 @@
+
+#ifndef _D3DRM_PRECOMP_H_
+#define _D3DRM_PRECOMP_H_
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#define COBJMACROS
+
+#include <windef.h>
+#include <winbase.h>
+#include <wingdi.h>
+
+#include "d3drm_private.h"
+
+#endif /* _D3DRM_PRECOMP_H_ */
index 8631320..fd56e76 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface);
 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface);
@@ -44,7 +49,7 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture)
         IDirect3DRM_Release(texture->d3drm);
     if (texture->surface)
         IDirectDrawSurface_Release(texture->surface);
         IDirect3DRM_Release(texture->d3drm);
     if (texture->surface)
         IDirectDrawSurface_Release(texture->surface);
-    HeapFree(GetProcessHeap(), 0, texture);
+    heap_free(texture);
 }
 
 static BOOL d3drm_validate_image(D3DRMIMAGE *image)
 }
 
 static BOOL d3drm_validate_image(D3DRMIMAGE *image)
@@ -1114,7 +1119,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
 
     TRACE("texture %p.\n", texture);
 
 
     TRACE("texture %p.\n", texture);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
index 247e077..37c70c8 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+
 #include "d3drm_private.h"
 
 #include "d3drm_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
 static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport_iface);
 static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface)
 {
     return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport_iface);
@@ -70,7 +75,7 @@ static void d3drm_viewport_destroy(struct d3drm_viewport *viewport)
         IDirect3DRM_Release(viewport->d3drm);
     }
 
         IDirect3DRM_Release(viewport->d3drm);
     }
 
-    HeapFree(GetProcessHeap(), 0, viewport);
+    heap_free(viewport);
 }
 
 static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out)
 }
 
 static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out)
@@ -1017,7 +1022,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d
 
     TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
 
 
     TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
         return E_OUTOFMEMORY;
 
     object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
index 083be5f..5e78991 100644 (file)
@@ -25,7 +25,7 @@ reactos/dll/directx/wine/amstream       # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3d8           # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3d9           # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3d8           # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3d9           # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3
-reactos/dll/directx/wine/d3drm          # Synced to WineStaging-2.16
+reactos/dll/directx/wine/d3drm          # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-3.0
 reactos/dll/directx/wine/d3dxof         # Synced to WineStaging-2.9
 reactos/dll/directx/wine/ddraw          # Synced to WineStaging-3.3
 reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-3.0
 reactos/dll/directx/wine/d3dxof         # Synced to WineStaging-2.9
 reactos/dll/directx/wine/ddraw          # Synced to WineStaging-3.3