4 * Copied and modified heavily from loader/resource.c
8 #include "wine/winestring.h"
11 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(resource
)
20 const wrc_resource32_t
* const * Resources
; /* NULL-terminated array of pointers */
24 static ResListE
* ResourceList
=NULL
;
26 void LIBRES_RegisterResources(const wrc_resource32_t
* const * Res
)
30 for(Curr
=&ResourceList
; *Curr
; Curr
=&((*Curr
)->next
)) { }
31 n
=xmalloc(sizeof(ResListE
));
37 /**********************************************************************
40 HRSRC
LIBRES_FindResource( HINSTANCE hModule
, LPCWSTR name
, LPCWSTR type
)
44 const wrc_resource32_t
* const * Res
;
50 LPSTR nameA
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
51 nameid
= atoi(nameA
+1);
52 HeapFree( GetProcessHeap(), 0, nameA
);
65 LPSTR typeA
= HEAP_strdupWtoA( GetProcessHeap(), 0, type
);
67 HeapFree( GetProcessHeap(), 0, typeA
);
71 TRACE("(*,*,type=string): Returning 0\n");
78 /* FIXME: types can be strings */
79 for(ResBlock
=ResourceList
; ResBlock
; ResBlock
=ResBlock
->next
)
80 for(Res
=ResBlock
->Resources
; *Res
; Res
++)
83 if((*Res
)->restype
==typeid &&
84 !CRTDLL__wcsnicmp((LPCWSTR
)((*Res
)->resname
+1), name
, *((*Res
)->resname
)))
88 if((*Res
)->restype
==typeid && (*Res
)->resid
==nameid
)
94 /**********************************************************************
97 HGLOBAL
LIBRES_LoadResource( HINSTANCE hModule
, HRSRC hRsrc
)
99 return (HGLOBAL
)(((wrc_resource32_t
*)hRsrc
)->data
);
103 /**********************************************************************
104 * LIBRES_SizeofResource
106 DWORD
LIBRES_SizeofResource( HINSTANCE hModule
, HRSRC hRsrc
)
108 return (DWORD
)(((wrc_resource32_t
*)hRsrc
)->datasize
);