4 * Copied and modified heavily from loader/resource.c
16 const struct resource
* const * Resources
; /* NULL-terminated array of pointers */
20 static ResListE
* ResourceList
=NULL
;
22 void LIBRES_RegisterResources(const struct resource
* const * Res
)
26 for(Curr
=&ResourceList
; *Curr
; Curr
=&((*Curr
)->next
)) { }
27 n
=xmalloc(sizeof(ResListE
));
33 /**********************************************************************
34 * LIBRES_FindResource16
36 HRSRC32
LIBRES_FindResource16( HINSTANCE32 hModule
, LPCSTR name
, LPCSTR type
)
40 const struct resource
* const * Res
;
61 fprintf(stderr
,"LIBRES_FindResource16(*,*,type=string)");
68 for(ResBlock
=ResourceList
; ResBlock
; ResBlock
=ResBlock
->next
)
69 for(Res
=ResBlock
->Resources
; *Res
; Res
++)
72 if((*Res
)->type
==typeid && !lstrcmpi32A((*Res
)->name
,name
))
76 if((*Res
)->type
==typeid && (*Res
)->id
==nameid
)
81 /**********************************************************************
82 * LIBRES_FindResource32
84 HRSRC32
LIBRES_FindResource32( HINSTANCE32 hModule
, LPCWSTR name
, LPCWSTR type
)
88 const struct resource
* const * Res
;
94 LPSTR nameA
= HEAP_strdupWtoA( GetProcessHeap(), 0, name
);
95 nameid
= atoi(nameA
+1);
96 HeapFree( GetProcessHeap(), 0, nameA
);
109 LPSTR typeA
= HEAP_strdupWtoA( GetProcessHeap(), 0, type
);
110 typeid=atoi(typeA
+1);
111 HeapFree( GetProcessHeap(), 0, typeA
);
115 fprintf(stderr
,"LIBRES_FindResource32(*,*,type=string)");
122 for(ResBlock
=ResourceList
; ResBlock
; ResBlock
=ResBlock
->next
)
123 for(Res
=ResBlock
->Resources
; *Res
; Res
++)
126 if((*Res
)->type
==typeid && !lstrcmpi32W((*Res
)->name
,name
))
127 return (HRSRC32
)*Res
;
130 if((*Res
)->type
==typeid && (*Res
)->id
==nameid
)
131 return (HRSRC32
)*Res
;
136 /**********************************************************************
137 * LIBRES_LoadResource
139 HGLOBAL32
LIBRES_LoadResource( HINSTANCE32 hModule
, HRSRC32 hRsrc
)
141 return (HGLOBAL32
)(((struct resource
*)hRsrc
)->bytes
);
145 /**********************************************************************
146 * LIBRES_LockResource
148 LPVOID
LIBRES_LockResource( HGLOBAL32 handle
)
150 return (LPVOID
)handle
;
154 /**********************************************************************
155 * LIBRES_FreeResource
157 BOOL32
LIBRES_FreeResource( HGLOBAL32 handle
)
159 return 0; /* Obsolete in Win32 */
163 /**********************************************************************
164 * LIBRES_AccessResource
166 INT32
LIBRES_AccessResource( HINSTANCE32 hModule
, HRSRC32 hRsrc
)
168 fprintf(stderr
,"LIBRES_AccessResource()");
169 return -1; /* Obsolete in Win32 */
173 /**********************************************************************
174 * LIBRES_SizeofResource
176 DWORD
LIBRES_SizeofResource( HINSTANCE32 hModule
, HRSRC32 hRsrc
)
178 return (DWORD
)(((struct resource
*)hRsrc
)->size
);
182 /**********************************************************************
183 * LIBRES_AllocResource
185 HGLOBAL32
LIBRES_AllocResource( HINSTANCE32 hModule
, HRSRC32 hRsrc
, DWORD size
)
187 fprintf(stderr
,"LIBRES_AllocResource()");
188 return 0; /* Obsolete in Win32 */