Release 971012
[wine/multimedia.git] / loader / resource.c
blob69cefc24f6888ef4a0fa413e2ddde757b8499810
1 /*
2 * Resources
4 * Copyright 1993 Robert J. Amstadt
5 * Copyright 1995 Alexandre Julliard
6 */
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <sys/types.h>
12 #include <sys/stat.h>
13 #include <fcntl.h>
14 #include <unistd.h>
15 #include "windows.h"
16 #include "gdi.h"
17 #include "global.h"
18 #include "heap.h"
19 #include "neexe.h"
20 #include "task.h"
21 #include "accel.h"
22 #include "module.h"
23 #include "resource.h"
24 #include "stddebug.h"
25 #include "debug.h"
26 #include "libres.h"
28 #define PrintId(name) \
29 if (HIWORD((DWORD)name)) \
30 dprintf_resource( stddeb, "'%s'", (char *)PTR_SEG_TO_LIN(name)); \
31 else \
32 dprintf_resource( stddeb, "#%04x", LOWORD(name));
34 extern WORD WINE_LanguageId;
36 /* error message when 16-bit resource function is called for Win32 module */
37 static const char* NEWin32FailureString = "fails with Win32 module\n";
38 /* error message when 32-bit resource function is called for Win16 module */
39 static const char* PEWin16FailureString = "fails with Win16 module\n";
41 /**********************************************************************
42 * FindResource16 (KERNEL.60)
44 HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
46 NE_MODULE *pModule;
48 hModule = MODULE_HANDLEtoHMODULE16( hModule );
49 dprintf_resource(stddeb, "FindResource16: module=%04x type=", hModule );
50 PrintId( type );
52 if (HIWORD(name)) /* Check for '#xxx' name */
54 char *ptr = PTR_SEG_TO_LIN( name );
55 if (ptr[0] == '#') {
56 if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
60 dprintf_resource( stddeb, " name=" );
61 PrintId( name );
62 dprintf_resource( stddeb, "\n" );
64 if ((pModule = MODULE_GetPtr( hModule )))
66 #ifndef WINELIB
67 if (pModule->flags & NE_FFLAGS_WIN32)
68 fprintf(stderr,"FindResource16: %s", NEWin32FailureString);
69 else
70 return NE_FindResource( hModule, type, name );
71 #else
72 return LIBRES_FindResource16( hModule, name, type );
73 #endif
75 return 0;
79 /**********************************************************************
80 * FindResource32A (KERNEL32.128)
82 HANDLE32 WINAPI FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type)
84 return FindResourceEx32A(hModule,name,type,WINE_LanguageId);
87 /**********************************************************************
88 * FindResourceEx32A (KERNEL32.129)
90 HANDLE32 WINAPI FindResourceEx32A( HINSTANCE32 hModule, LPCSTR name,
91 LPCSTR type, WORD lang )
93 LPWSTR xname,xtype;
94 HANDLE32 ret;
96 if (HIWORD((DWORD)name))
97 xname = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
98 else
99 xname = (LPWSTR)name;
100 if (HIWORD((DWORD)type))
101 xtype = HEAP_strdupAtoW( GetProcessHeap(), 0, type);
102 else
103 xtype = (LPWSTR)type;
104 ret = FindResourceEx32W( hModule, xname, xtype, lang );
105 if (HIWORD((DWORD)name)) HeapFree( GetProcessHeap(), 0, xname );
106 if (HIWORD((DWORD)type)) HeapFree( GetProcessHeap(), 0, xtype );
107 return ret;
111 /**********************************************************************
112 * FindResourceEx32W (KERNEL32.130)
114 HRSRC32 WINAPI FindResourceEx32W( HINSTANCE32 hModule, LPCWSTR name,
115 LPCWSTR type, WORD lang )
117 #ifndef WINELIB
118 NE_MODULE *pModule;
120 if (!hModule) hModule = GetTaskDS();
121 hModule = MODULE_HANDLEtoHMODULE32( hModule );
122 dprintf_resource(stddeb, "FindResource32W: module=%08x type=", hModule );
123 if (HIWORD(type))
124 dprintf_resource(stddeb,"%p",type);
125 else
126 dprintf_resource(stddeb,"#%p",type);
127 dprintf_resource( stddeb, " name=" );
128 if (HIWORD(name))
129 dprintf_resource(stddeb,"%p",name);
130 else
131 dprintf_resource(stddeb,"#%p",name);
132 dprintf_resource( stddeb, "\n" );
133 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
134 if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
135 return PE_FindResourceEx32W(hModule,name,type,lang);
136 #else
137 return LIBRES_FindResource32( hModule, name, type );
138 #endif
141 /**********************************************************************
142 * FindResource32W (KERNEL32.131)
144 HRSRC32 WINAPI FindResource32W(HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type)
146 return FindResourceEx32W(hModule,name,type,WINE_LanguageId);
150 /**********************************************************************
151 * LoadResource16 (KERNEL.61)
153 HGLOBAL16 WINAPI LoadResource16( HMODULE16 hModule, HRSRC16 hRsrc )
155 NE_MODULE *pModule;
157 hModule = MODULE_HANDLEtoHMODULE16( hModule );
158 dprintf_resource(stddeb, "LoadResource16: module=%04x res=%04x\n",
159 hModule, hRsrc );
160 if (!hRsrc) return 0;
161 if ((pModule = MODULE_GetPtr( hModule )))
163 #ifndef WINELIB
164 if (pModule->flags & NE_FFLAGS_WIN32)
165 fprintf(stderr,"LoadResource16: %s", NEWin32FailureString);
166 else
167 return NE_LoadResource( hModule, hRsrc );
168 #else
169 return LIBRES_LoadResource( hModule, hRsrc );
170 #endif
172 return 0;
175 /**********************************************************************
176 * LoadResource32 (KERNEL32.370)
178 HGLOBAL32 WINAPI LoadResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
180 #ifndef WINELIB
181 NE_MODULE *pModule;
183 if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
184 hModule = MODULE_HANDLEtoHMODULE32( hModule );
185 dprintf_resource(stddeb, "LoadResource32: module=%04x res=%04x\n",
186 hModule, hRsrc );
187 if (!hRsrc) return 0;
189 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
190 if (!(pModule->flags & NE_FFLAGS_WIN32))
192 fprintf(stderr,"LoadResource32: %s", PEWin16FailureString );
193 return 0; /* FIXME? */
195 return PE_LoadResource32(hModule,hRsrc);
196 #else
197 return LIBRES_LoadResource( hModule, hRsrc );
198 #endif
202 /**********************************************************************
203 * LockResource (KERNEL.62)
205 /* 16-bit version */
206 SEGPTR WINAPI WIN16_LockResource16(HGLOBAL16 handle)
208 #ifndef WINELIB
209 HMODULE16 hModule;
210 NE_MODULE *pModule;
212 dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
213 if (!handle) return (SEGPTR)0;
214 hModule = MODULE_HANDLEtoHMODULE16( handle );
215 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
216 if (pModule->flags & NE_FFLAGS_WIN32)
218 fprintf(stderr,"LockResource16: %s", NEWin32FailureString);
219 return 0;
221 return NE_LockResource( hModule, handle );
222 #else
223 return LIBRES_LockResource( handle );
224 #endif
227 /* WINELIB 16-bit version */
228 LPVOID WINAPI LockResource16( HGLOBAL16 handle )
230 #ifndef WINELIB
231 HMODULE16 hModule;
232 NE_MODULE *pModule;
234 dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
235 if (!handle) return NULL;
236 hModule = MODULE_HANDLEtoHMODULE16( handle );
237 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
238 if (pModule->flags & NE_FFLAGS_WIN32)
240 fprintf(stderr,"LockResource16: %s", NEWin32FailureString);
241 return 0;
243 return (LPSTR)PTR_SEG_TO_LIN( NE_LockResource( hModule, handle ) );
244 #else
245 return LIBRES_LockResource( handle );
246 #endif
250 /**********************************************************************
251 * LockResource32 (KERNEL32.384)
253 LPVOID WINAPI LockResource32( HGLOBAL32 handle )
255 return (LPVOID)handle;
259 /**********************************************************************
260 * FreeResource16 (KERNEL.63)
262 BOOL16 WINAPI FreeResource16( HGLOBAL16 handle )
264 #ifndef WINELIB
265 HMODULE16 hModule;
266 NE_MODULE *pModule;
268 dprintf_resource(stddeb, "FreeResource16: handle=%04x\n", handle );
269 if (!handle) return FALSE;
270 hModule = MODULE_HANDLEtoHMODULE16( handle );
271 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
272 if (pModule->flags & NE_FFLAGS_WIN32)
274 fprintf(stderr,"FreeResource16: %s", NEWin32FailureString);
275 return 0;
277 return NE_FreeResource( hModule, handle );
278 #else
279 return LIBRES_FreeResource( handle );
280 #endif
283 /**********************************************************************
284 * FreeResource32 (KERNEL32.145)
286 BOOL32 WINAPI FreeResource32( HGLOBAL32 handle )
288 /* no longer used in Win32 */
289 return TRUE;
293 /**********************************************************************
294 * AccessResource16 (KERNEL.64)
296 INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
298 NE_MODULE *pModule;
300 hModule = MODULE_HANDLEtoHMODULE16( hModule );
301 dprintf_resource(stddeb, "AccessResource16: module=%04x res=%04x\n",
302 hModule, hRsrc );
303 if (!hRsrc) return 0;
304 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
305 #ifndef WINELIB
306 if (pModule->flags & NE_FFLAGS_WIN32)
308 fprintf(stderr,"AccessResource16: %s", NEWin32FailureString);
309 return 0;
311 return NE_AccessResource( hModule, hRsrc );
312 #else
313 return LIBRES_AccessResource( hModule, hRsrc );
314 #endif
318 /**********************************************************************
319 * AccessResource32 (KERNEL32.64)
321 INT32 WINAPI AccessResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
323 hModule = MODULE_HANDLEtoHMODULE32( hModule );
324 dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
325 hModule, hRsrc );
326 if (!hRsrc) return 0;
327 fprintf(stderr,"AccessResource32: not implemented\n");
328 return 0;
332 /**********************************************************************
333 * SizeofResource16 (KERNEL.65)
335 DWORD WINAPI SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc )
337 NE_MODULE *pModule;
339 hModule = MODULE_HANDLEtoHMODULE16( hModule );
340 dprintf_resource(stddeb, "SizeofResource16: module=%04x res=%04x\n",
341 hModule, hRsrc );
342 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
343 #ifndef WINELIB
344 if (pModule->flags & NE_FFLAGS_WIN32)
346 fprintf(stderr,"SizeOfResource16: %s", NEWin32FailureString);
347 return 0;
349 return NE_SizeofResource( hModule, hRsrc );
350 #else
351 return LIBRES_SizeofResource( hModule, hRsrc );
352 #endif
356 /**********************************************************************
357 * SizeofResource32 (KERNEL32.522)
359 DWORD WINAPI SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
361 hModule = MODULE_HANDLEtoHMODULE32( hModule );
362 dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n",
363 hModule, hRsrc );
364 #ifndef WINELIB
365 return PE_SizeofResource32(hModule,hRsrc);
366 #else
367 fprintf(stderr,"SizeofResource32: not implemented\n");
368 return 0;
369 #endif
373 /**********************************************************************
374 * AllocResource16 (KERNEL.66)
376 HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
378 NE_MODULE *pModule;
380 hModule = MODULE_HANDLEtoHMODULE16( hModule );
381 dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n",
382 hModule, hRsrc, size );
383 if (!hRsrc) return 0;
384 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
385 #ifndef WINELIB
386 if (pModule->flags & NE_FFLAGS_WIN32)
388 fprintf(stderr,"AllocResource16: %s", NEWin32FailureString);
389 return 0;
391 return NE_AllocResource( hModule, hRsrc, size );
392 #else
393 return LIBRES_AllocResource( hModule, hRsrc, size );
394 #endif
397 /**********************************************************************
398 * DirectResAlloc (KERNEL.168)
400 * Check Schulman, p. 232 for details
402 HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType,
403 UINT16 wSize )
405 dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n",
406 hInstance, wType, wSize );
407 hInstance = MODULE_HANDLEtoHMODULE16(hInstance);
408 if(!hInstance)return 0;
409 if(wType != 0x10) /* 0x10 is the only observed value, passed from
410 CreateCursorIndirect. */
411 fprintf(stderr, "DirectResAlloc: wType = %x\n", wType);
412 return GLOBAL_Alloc(GMEM_MOVEABLE, wSize, hInstance, FALSE, FALSE, FALSE);
416 /**********************************************************************
417 * LoadAccelerators16 [USER.177]
419 HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, SEGPTR lpTableName)
421 HRSRC16 hRsrc;
423 if (HIWORD(lpTableName))
424 dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
425 instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
426 else
427 dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
428 instance, LOWORD(lpTableName) );
430 if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATOR )))
431 return 0;
432 return LoadResource16(instance,hRsrc);
435 /**********************************************************************
436 * LoadAccelerators32W [USER.177]
437 * The image layout seems to look like this (not 100% sure):
438 * 00: BYTE type type of accelerator
439 * 01: BYTE pad (to WORD boundary)
440 * 02: WORD event
441 * 04: WORD IDval
442 * 06: WORD pad (to DWORD boundary)
444 HACCEL32 WINAPI LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
446 HRSRC32 hRsrc;
448 if (HIWORD(lpTableName))
449 dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
450 instance, (char *)( lpTableName ) );
451 else
452 dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
453 instance, LOWORD(lpTableName) );
455 if (!(hRsrc = FindResource32W( instance, lpTableName,
456 (LPCWSTR)RT_ACCELERATOR )))
457 return 0;
458 return LoadResource32( instance, hRsrc );
461 HACCEL32 WINAPI LoadAccelerators32A(HINSTANCE32 instance,LPCSTR lpTableName)
463 LPWSTR uni;
464 HACCEL32 result;
465 if (HIWORD(lpTableName))
466 uni = HEAP_strdupAtoW( GetProcessHeap(), 0, lpTableName );
467 else
468 uni = (LPWSTR)lpTableName;
469 result = LoadAccelerators32W(instance,uni);
470 if (HIWORD(uni)) HeapFree( GetProcessHeap(), 0, uni);
471 return result;
475 /**********************************************************************
476 * LoadString16
478 INT16 WINAPI LoadString16( HINSTANCE16 instance, UINT16 resource_id,
479 LPSTR buffer, INT16 buflen )
481 HGLOBAL16 hmem;
482 HRSRC16 hrsrc;
483 unsigned char *p;
484 int string_num;
485 int i;
487 dprintf_resource(stddeb,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
488 instance, resource_id, (int) buffer, buflen);
490 hrsrc = FindResource16( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
491 if (!hrsrc) return 0;
492 hmem = LoadResource16( instance, hrsrc );
493 if (!hmem) return 0;
495 p = LockResource16(hmem);
496 string_num = resource_id & 0x000f;
497 for (i = 0; i < string_num; i++)
498 p += *p + 1;
500 dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
502 i = MIN(buflen - 1, *p);
503 if (buffer == NULL)
504 return i;
505 if (i > 0) {
506 memcpy(buffer, p + 1, i);
507 buffer[i] = '\0';
508 } else {
509 if (buflen > 1) {
510 buffer[0] = '\0';
511 return 0;
513 fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
514 fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
516 FreeResource16( hmem );
518 dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
519 return i;
522 /**********************************************************************
523 * LoadString32W (USER32.375)
525 INT32 WINAPI LoadString32W( HINSTANCE32 instance, UINT32 resource_id,
526 LPWSTR buffer, int buflen )
528 HGLOBAL32 hmem;
529 HRSRC32 hrsrc;
530 WCHAR *p;
531 int string_num;
532 int i;
534 if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
535 resource_id = (UINT32)(-((INT32)resource_id));
536 dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
537 "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
539 hrsrc = FindResource32W( instance, (LPCWSTR)((resource_id>>4)+1),
540 (LPCWSTR)RT_STRING );
541 if (!hrsrc) return 0;
542 hmem = LoadResource32( instance, hrsrc );
543 if (!hmem) return 0;
545 p = LockResource32(hmem);
546 string_num = resource_id & 0x000f;
547 for (i = 0; i < string_num; i++)
548 p += *p + 1;
550 dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
552 i = MIN(buflen - 1, *p);
553 if (buffer == NULL)
554 return i;
555 if (i > 0) {
556 memcpy(buffer, p + 1, i * sizeof (WCHAR));
557 buffer[i] = (WCHAR) 0;
558 } else {
559 if (buflen > 1) {
560 buffer[0] = (WCHAR) 0;
561 return 0;
563 #if 0
564 fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
565 fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
566 #endif
568 #if 0
569 dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
570 #endif
571 return i;
574 /**********************************************************************
575 * LoadString32A (USER32.374)
577 INT32 WINAPI LoadString32A( HINSTANCE32 instance, UINT32 resource_id,
578 LPSTR buffer,int buflen )
580 INT32 retval;
581 LPWSTR buffer2 = NULL;
582 if (buffer) buffer2 = HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
583 retval = LoadString32W(instance,resource_id,buffer2,buflen);
585 if (buffer2)
587 lstrcpynWtoA( buffer, buffer2, buflen );
588 HeapFree( GetProcessHeap(), 0, buffer2 );
590 return retval;
593 /* Messages...used by FormatMessage32* (KERNEL32.something)
595 * They can be specified either directly or using a message ID and
596 * loading them from the resource.
598 * The resourcedata has following format:
599 * start:
600 * 0: DWORD nrofentries
601 * nrofentries * subentry:
602 * 0: DWORD firstentry
603 * 4: DWORD lastentry
604 * 8: DWORD offset from start to the stringentries
606 * (lastentry-firstentry) * stringentry:
607 * 0: WORD len (0 marks end)
608 * 2: WORD unknown (flags?)
609 * 4: CHAR[len-4]
610 * (stringentry i of a subentry refers to the ID 'firstentry+i')
612 * Yes, ANSI strings in win32 resources. Go figure.
615 /**********************************************************************
616 * LoadMessage32A (internal)
618 INT32 LoadMessage32A( HINSTANCE32 instance, UINT32 id, WORD lang,
619 LPSTR buffer, int buflen )
621 HGLOBAL32 hmem;
622 HRSRC32 hrsrc;
623 BYTE *p;
624 int nrofentries,i,slen;
625 struct _subentry {
626 DWORD firstentry;
627 DWORD lastentry;
628 DWORD offset;
629 } *se;
630 struct _stringentry {
631 WORD len;
632 WORD unknown;
633 CHAR str[1];
634 } *stre;
636 dprintf_resource(stddeb, "LoadMessage: instance = %04x, id = %04x, buffer = %08x, "
637 "length = %d\n", instance, (int)id, (int) buffer, buflen);
639 /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
640 hrsrc = FindResourceEx32W(instance,(LPWSTR)1,(LPCWSTR)RT_MESSAGELIST,lang);
641 if (!hrsrc) return 0;
642 hmem = LoadResource32( instance, hrsrc );
643 if (!hmem) return 0;
645 p = LockResource32(hmem);
646 nrofentries = *(DWORD*)p;
647 stre = NULL;
648 se = (struct _subentry*)(p+4);
649 for (i=nrofentries;i--;) {
650 if ((id>=se->firstentry) && (id<=se->lastentry)) {
651 stre = (struct _stringentry*)(p+se->offset);
652 id -= se->firstentry;
653 break;
655 se++;
657 if (!stre)
658 return 0;
659 for (i=id;i--;) {
660 if (!(slen=stre->len))
661 return 0;
662 stre = (struct _stringentry*)(((char*)stre)+slen);
664 slen=stre->len;
665 dprintf_resource(stddeb," - strlen=%d\n",slen);
666 i = MIN(buflen - 1, slen);
667 if (buffer == NULL)
668 return slen; /* different to LoadString */
669 if (i>0) {
670 lstrcpyn32A(buffer,stre->str,i);
671 buffer[i]=0;
672 } else {
673 if (buflen>1) {
674 buffer[0]=0;
675 return 0;
678 if (buffer)
679 dprintf_resource(stddeb,"LoadMessage // '%s' copied !\n", buffer);
680 return i;
683 /**********************************************************************
684 * LoadMessage32W (internal)
686 INT32 LoadMessage32W( HINSTANCE32 instance, UINT32 id, WORD lang,
687 LPWSTR buffer, int buflen )
689 INT32 retval;
690 LPSTR buffer2 = NULL;
691 if (buffer) buffer2 = HeapAlloc( GetProcessHeap(), 0, buflen );
692 retval = LoadMessage32A(instance,id,lang,buffer2,buflen);
693 if (buffer)
695 lstrcpynAtoW( buffer, buffer2, buflen );
696 HeapFree( GetProcessHeap(), 0, buffer2 );
698 return retval;
701 #ifndef WINELIB
702 /**********************************************************************
703 * SetResourceHandler (KERNEL.43)
705 FARPROC16 WINAPI SetResourceHandler( HMODULE16 hModule, SEGPTR s,
706 FARPROC16 resourceHandler )
708 NE_MODULE *pModule;
710 hModule = GetExePtr( hModule );
712 dprintf_resource(stddeb, "SetResourceHandler: module=%04x type=", hModule );
713 PrintId( s );
714 dprintf_resource( stddeb, "\n" );
716 if ((pModule = MODULE_GetPtr( hModule )))
718 if (pModule->flags & NE_FFLAGS_WIN32)
719 fprintf(stderr,"SetResourceHandler: %s", NEWin32FailureString);
720 else if (pModule->res_table)
721 return NE_SetResourceHandler( hModule, s, resourceHandler );
723 return NULL;
726 /**********************************************************************
727 * EnumResourceTypesA (KERNEL32.90)
729 BOOL32 WINAPI EnumResourceTypes32A( HMODULE32 hmodule,ENUMRESTYPEPROC32A lpfun,
730 LONG lParam)
732 return PE_EnumResourceTypes32A(hmodule,lpfun,lParam);
735 /**********************************************************************
736 * EnumResourceTypesW (KERNEL32.91)
738 BOOL32 WINAPI EnumResourceTypes32W( HMODULE32 hmodule,ENUMRESTYPEPROC32W lpfun,
739 LONG lParam)
741 return PE_EnumResourceTypes32W(hmodule,lpfun,lParam);
744 /**********************************************************************
745 * EnumResourceNamesA (KERNEL32.88)
747 BOOL32 WINAPI EnumResourceNames32A( HMODULE32 hmodule, LPCSTR type,
748 ENUMRESNAMEPROC32A lpfun, LONG lParam )
750 return PE_EnumResourceNames32A(hmodule,type,lpfun,lParam);
752 /**********************************************************************
753 * EnumResourceNamesW (KERNEL32.89)
755 BOOL32 WINAPI EnumResourceNames32W( HMODULE32 hmodule, LPCWSTR type,
756 ENUMRESNAMEPROC32W lpfun, LONG lParam )
758 return PE_EnumResourceNames32W(hmodule,type,lpfun,lParam);
761 /**********************************************************************
762 * EnumResourceLanguagesA (KERNEL32.86)
764 BOOL32 WINAPI EnumResourceLanguages32A( HMODULE32 hmodule, LPCSTR type,
765 LPCSTR name, ENUMRESLANGPROC32A lpfun,
766 LONG lParam)
768 return PE_EnumResourceLanguages32A(hmodule,type,name,lpfun,lParam);
770 /**********************************************************************
771 * EnumResourceLanguagesW (KERNEL32.87)
773 BOOL32 WINAPI EnumResourceLanguages32W( HMODULE32 hmodule, LPCWSTR type,
774 LPCWSTR name, ENUMRESLANGPROC32W lpfun,
775 LONG lParam)
777 return PE_EnumResourceLanguages32W(hmodule,type,name,lpfun,lParam);
779 #endif /* WINELIB */