4 * Copied and modified heavily from loader/resource.c
8 #include "wine/winestring.h"
11 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(resource
)
19 const wrc_resource32_t
* const * Resources
; /* NULL-terminated array of pointers */
23 static ResListE
* ResourceList
=NULL
;
25 void LIBRES_RegisterResources(const wrc_resource32_t
* const * Res
)
29 for(Curr
=&ResourceList
; *Curr
; Curr
=&((*Curr
)->next
)) { }
30 n
=xmalloc(sizeof(ResListE
));
36 /**********************************************************************
39 HRSRC
LIBRES_FindResource( HINSTANCE hModule
, LPCWSTR name
, LPCWSTR type
)
43 const wrc_resource32_t
* const * Res
;
49 LPSTR nameA
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
50 nameid
= atoi(nameA
+1);
51 HeapFree( GetProcessHeap(), 0, nameA
);
64 LPSTR typeA
= HEAP_strdupWtoA( GetProcessHeap(), 0, type
);
66 HeapFree( GetProcessHeap(), 0, typeA
);
70 TRACE("(*,*,type=string): Returning 0\n");
77 /* FIXME: types can be strings */
78 for(ResBlock
=ResourceList
; ResBlock
; ResBlock
=ResBlock
->next
)
79 for(Res
=ResBlock
->Resources
; *Res
; Res
++)
82 if((*Res
)->restype
==typeid && !lstrncmpiW((LPCWSTR
)((*Res
)->resname
+1), name
, *((*Res
)->resname
)))
86 if((*Res
)->restype
==typeid && (*Res
)->resid
==nameid
)
92 /**********************************************************************
95 HGLOBAL
LIBRES_LoadResource( HINSTANCE hModule
, HRSRC hRsrc
)
97 return (HGLOBAL
)(((wrc_resource32_t
*)hRsrc
)->data
);
101 /**********************************************************************
102 * LIBRES_SizeofResource
104 DWORD
LIBRES_SizeofResource( HINSTANCE hModule
, HRSRC hRsrc
)
106 return (DWORD
)(((wrc_resource32_t
*)hRsrc
)->datasize
);