ReactOS 0.4.15-dev-5666-gc548b97
d3drm_main.c File Reference
#include "initguid.h"
#include "d3drm_private.h"
Include dependency graph for d3drm_main.c:

Go to the source code of this file.

Classes

struct  destroy_callback
 

Functions

BOOL WINAPI DllMain (HINSTANCE inst, DWORD reason, void *reserved)
 
void d3drm_object_init (struct d3drm_object *object, const char *classname)
 
HRESULT d3drm_object_add_destroy_callback (struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
 
HRESULT d3drm_object_delete_destroy_callback (struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx)
 
HRESULT d3drm_object_get_class_name (struct d3drm_object *object, DWORD *size, char *name)
 
HRESULT d3drm_object_get_name (struct d3drm_object *object, DWORD *size, char *name)
 
HRESULT d3drm_object_set_name (struct d3drm_object *object, const char *name)
 
void d3drm_object_cleanup (IDirect3DRMObject *iface, struct d3drm_object *object)
 

Function Documentation

◆ d3drm_object_add_destroy_callback()

HRESULT d3drm_object_add_destroy_callback ( struct d3drm_object object,
D3DRMOBJECTCALLBACK  cb,
void ctx 
)

Definition at line 55 of file d3drm_main.c.

56{
58
59 if (!cb)
60 return D3DRMERR_BADVALUE;
61
62 if (!(callback = heap_alloc(sizeof(*callback))))
63 return E_OUTOFMEMORY;
64
65 callback->cb = cb;
66 callback->ctx = ctx;
67
68 list_add_head(&object->destroy_callbacks, &callback->entry);
69 return D3DRM_OK;
70}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define D3DRM_OK
Definition: d3drm.h:486
#define D3DRMERR_BADVALUE
Definition: d3drm.h:496
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static IPrintDialogCallback callback
Definition: printdlg.c:326
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

Referenced by d3drm_animation2_AddDestroyCallback(), d3drm_device3_AddDestroyCallback(), d3drm_face2_AddDestroyCallback(), d3drm_frame3_AddDestroyCallback(), d3drm_light_AddDestroyCallback(), d3drm_material_AddDestroyCallback(), d3drm_mesh_AddDestroyCallback(), d3drm_mesh_builder3_AddDestroyCallback(), d3drm_texture3_AddDestroyCallback(), d3drm_viewport2_AddDestroyCallback(), and d3drm_wrap_AddDestroyCallback().

◆ d3drm_object_cleanup()

void d3drm_object_cleanup ( IDirect3DRMObject *  iface,
struct d3drm_object object 
)

Definition at line 153 of file d3drm_main.c.

154{
155 struct destroy_callback *callback, *callback2;
156
157 LIST_FOR_EACH_ENTRY_SAFE(callback, callback2, &object->destroy_callbacks, struct destroy_callback, entry)
158 {
159 callback->cb(iface, callback->ctx);
160 list_remove(&callback->entry);
162 }
163
164 heap_free(object->name);
165 object->name = NULL;
166}
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define NULL
Definition: types.h:112
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by d3drm_animation2_Release(), d3drm_device_destroy(), d3drm_face1_Release(), d3drm_frame3_Release(), d3drm_light_Release(), d3drm_material_Release(), d3drm_mesh_builder2_Release(), d3drm_mesh_Release(), d3drm_texture_destroy(), d3drm_viewport_destroy(), and d3drm_wrap_Release().

◆ d3drm_object_delete_destroy_callback()

◆ d3drm_object_get_class_name()

HRESULT d3drm_object_get_class_name ( struct d3drm_object object,
DWORD size,
char name 
)

Definition at line 92 of file d3drm_main.c.

93{
94 DWORD req_size;
95
96 if (!size)
97 return E_INVALIDARG;
98
99 req_size = strlen(object->classname) + 1;
100 if (name && *size < req_size)
101 return E_INVALIDARG;
102
103 *size = req_size;
104
105 if (name)
106 memcpy(name, object->classname, req_size);
107
108 return D3DRM_OK;
109}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define E_INVALIDARG
Definition: ddrawi.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: name.c:39

Referenced by d3drm_animation2_GetClassName(), d3drm_device3_GetClassName(), d3drm_face2_GetClassName(), d3drm_frame3_GetClassName(), d3drm_light_GetClassName(), d3drm_material_GetClassName(), d3drm_mesh_builder3_GetClassName(), d3drm_mesh_GetClassName(), d3drm_texture3_GetClassName(), d3drm_viewport2_GetClassName(), and d3drm_wrap_GetClassName().

◆ d3drm_object_get_name()

HRESULT d3drm_object_get_name ( struct d3drm_object object,
DWORD size,
char name 
)

Definition at line 111 of file d3drm_main.c.

112{
113 DWORD req_size;
114
115 if (!size)
116 return E_INVALIDARG;
117
118 req_size = object->name ? strlen(object->name) + 1 : 0;
119 if (name && *size < req_size)
120 return E_INVALIDARG;
121
122 if (name)
123 {
124 if (object->name)
125 memcpy(name, object->name, req_size);
126 else if (*size)
127 *name = 0;
128 }
129
130 *size = req_size;
131
132 return D3DRM_OK;
133}
char * name
Definition: compiler.c:66

Referenced by d3drm_animation2_GetName(), d3drm_device3_GetName(), d3drm_face2_GetName(), d3drm_frame3_GetName(), d3drm_light_GetName(), d3drm_material_GetName(), d3drm_mesh_builder3_GetName(), d3drm_mesh_GetName(), d3drm_texture3_GetName(), d3drm_viewport2_GetName(), and d3drm_wrap_GetName().

◆ d3drm_object_init()

void d3drm_object_init ( struct d3drm_object object,
const char classname 
)

Definition at line 39 of file d3drm_main.c.

40{
41 object->ref = 1;
42 object->appdata = 0;
43 list_init(&object->destroy_callbacks);
44 object->classname = classname;
45 object->name = NULL;
46}
static void list_init(struct list_entry *head)
Definition: list.h:51
WCHAR classname[128]
Definition: startup.c:15

Referenced by d3drm_animation_create(), d3drm_device_create(), d3drm_face_create(), d3drm_frame_create(), d3drm_light_create(), d3drm_material_create(), d3drm_mesh_builder_create(), d3drm_mesh_create(), d3drm_texture_create(), d3drm_viewport_create(), and d3drm_wrap_create().

◆ d3drm_object_set_name()

HRESULT d3drm_object_set_name ( struct d3drm_object object,
const char name 
)

Definition at line 135 of file d3drm_main.c.

136{
137 DWORD req_size;
138
139 heap_free(object->name);
140 object->name = NULL;
141
142 if (name)
143 {
144 req_size = strlen(name) + 1;
145 if (!(object->name = heap_alloc(req_size)))
146 return E_OUTOFMEMORY;
147 memcpy(object->name, name, req_size);
148 }
149
150 return D3DRM_OK;
151}

Referenced by d3drm_animation2_SetName(), d3drm_device3_SetName(), d3drm_face2_SetName(), d3drm_frame3_SetName(), d3drm_light_SetName(), d3drm_material_SetName(), d3drm_mesh_builder3_SetName(), d3drm_mesh_SetName(), d3drm_texture3_SetName(), d3drm_viewport2_SetName(), and d3drm_wrap_SetName().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  inst,
DWORD  reason,
void reserved 
)

Definition at line 26 of file d3drm_main.c.

27{
28 switch(reason)
29 {
30 case DLL_WINE_PREATTACH:
31 return FALSE; /* prefer native version */
34 break;
35 }
36 return TRUE;
37}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85