Release 951124
[wine/multimedia.git] / toolkit / libres.c
blobc983ff665cc2e0748c1d290bf994b1b4cd2b62a2
1 /*
2 * WINElib-Resources
4 * Copied and modified heavily from loader/resource.c
5 */
7 #include <stdio.h>
8 #include "windows.h"
10 struct resource /* This needs to coincide with what winerc generates. */
11 { /* It should really only appear in one place. */
12 int id, type;
13 char *name;
14 unsigned char *bytes;
15 unsigned int size;
18 typedef struct RLE
20 struct resource** Resources /* NULL-terminated array of pointers */
21 struct RLE* next;
22 } ResListE;
24 static ResListE* ResourceList=NULL;
26 void LIBRES_RegisterResources(struct resource** Res)
28 ResListE** Curr;
29 ResListE* n;
30 for(Curr=&ResourceList; *Curr; Curr=&((*Curr)->next)) { }
31 n=malloc(sizeof(ResListE));
32 if(n)
34 n.Resources=Res;
35 n.next=NULL;
36 *Curr=n;
38 else
39 fprintf(stderr,"LIBRES_RegisterResources(): Out of memory.\n");
42 /**********************************************************************
43 * LIBRES_FindResource
45 HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
47 WINELIB_UNIMP("LIBRES_FindResource()");
48 return 0;
52 /**********************************************************************
53 * LIBRES_LoadResource
55 HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc )
57 return (HGLOBAL)(((struct resource*)hRsrc)->bytes);
61 /**********************************************************************
62 * LIBRES_LockResource
64 LPVOID LIBRES_LockResource( HMODULE hModule, HGLOBAL handle )
66 return handle;
70 /**********************************************************************
71 * LIBRES_FreeResource
73 BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle )
75 return 0;
79 /**********************************************************************
80 * LIBRES_AccessResource
82 INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
84 WINELIB_UNIMP("LIBRES_AccessResource()");
85 return -1;
89 /**********************************************************************
90 * LIBRES_SizeofResource
92 DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc )
94 return (HGLOBAL)(((struct resource*)hRsrc)->size);
98 /**********************************************************************
99 * LIBRES_AllocResource
101 HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
103 WINELIB_UNIMP("LIBRES_AllocResource()");
104 return 0;