Release 970928
[wine.git] / loader / resource.c
blob23ba6b619c989c255565fb11a422a0549c662e1e
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 "arch.h"
16 #include "windows.h"
17 #include "gdi.h"
18 #include "global.h"
19 #include "heap.h"
20 #include "neexe.h"
21 #include "task.h"
22 #include "accel.h"
23 #include "module.h"
24 #include "resource.h"
25 #include "stddebug.h"
26 #include "debug.h"
27 #include "libres.h"
29 #define PrintId(name) \
30 if (HIWORD((DWORD)name)) \
31 dprintf_resource( stddeb, "'%s'", (char *)PTR_SEG_TO_LIN(name)); \
32 else \
33 dprintf_resource( stddeb, "#%04x", LOWORD(name));
35 extern WORD WINE_LanguageId;
37 /* error message when 16-bit resource function is called for Win32 module */
38 static const char* NEWin32FailureString = "fails with Win32 module\n";
39 /* error message when 32-bit resource function is called for Win16 module */
40 static const char* PEWin16FailureString = "fails with Win16 module\n";
42 /**********************************************************************
43 * FindResource16 (KERNEL.60)
45 HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
47 NE_MODULE *pModule;
49 hModule = MODULE_HANDLEtoHMODULE16( hModule );
50 dprintf_resource(stddeb, "FindResource16: module=%04x type=", hModule );
51 PrintId( type );
53 if (HIWORD(name)) /* Check for '#xxx' name */
55 char *ptr = PTR_SEG_TO_LIN( name );
56 if (ptr[0] == '#') {
57 if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
61 dprintf_resource( stddeb, " name=" );
62 PrintId( name );
63 dprintf_resource( stddeb, "\n" );
65 if ((pModule = MODULE_GetPtr( hModule )))
67 #ifndef WINELIB
68 if (pModule->flags & NE_FFLAGS_WIN32)
69 fprintf(stderr,"FindResource16: %s", NEWin32FailureString);
70 else
71 return NE_FindResource( hModule, type, name );
72 #else
73 return LIBRES_FindResource16( hModule, name, type );
74 #endif
76 return 0;
80 /**********************************************************************
81 * FindResource32A (KERNEL32.128)
83 HANDLE32 WINAPI FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type)
85 return FindResourceEx32A(hModule,name,type,WINE_LanguageId);
88 /**********************************************************************
89 * FindResourceEx32A (KERNEL32.129)
91 HANDLE32 WINAPI FindResourceEx32A( HINSTANCE32 hModule, LPCSTR name,
92 LPCSTR type, WORD lang )
94 LPWSTR xname,xtype;
95 HANDLE32 ret;
97 if (HIWORD((DWORD)name))
98 xname = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
99 else
100 xname = (LPWSTR)name;
101 if (HIWORD((DWORD)type))
102 xtype = HEAP_strdupAtoW( GetProcessHeap(), 0, type);
103 else
104 xtype = (LPWSTR)type;
105 ret = FindResourceEx32W( hModule, xname, xtype, lang );
106 if (HIWORD((DWORD)name)) HeapFree( GetProcessHeap(), 0, xname );
107 if (HIWORD((DWORD)type)) HeapFree( GetProcessHeap(), 0, xtype );
108 return ret;
112 /**********************************************************************
113 * FindResourceEx32W (KERNEL32.130)
115 HRSRC32 WINAPI FindResourceEx32W( HINSTANCE32 hModule, LPCWSTR name,
116 LPCWSTR type, WORD lang )
118 #ifndef WINELIB
119 NE_MODULE *pModule;
121 if (!hModule) hModule = GetTaskDS();
122 hModule = MODULE_HANDLEtoHMODULE32( hModule );
123 dprintf_resource(stddeb, "FindResource32W: module=%08x type=", hModule );
124 if (HIWORD(type))
125 dprintf_resource(stddeb,"%p",type);
126 else
127 dprintf_resource(stddeb,"#%p",type);
128 dprintf_resource( stddeb, " name=" );
129 if (HIWORD(name))
130 dprintf_resource(stddeb,"%p",name);
131 else
132 dprintf_resource(stddeb,"#%p",name);
133 dprintf_resource( stddeb, "\n" );
134 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
135 if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
136 return PE_FindResourceEx32W(hModule,name,type,lang);
137 #else
138 return LIBRES_FindResource32( hModule, name, type );
139 #endif
142 /**********************************************************************
143 * FindResource32W (KERNEL32.131)
145 HRSRC32 WINAPI FindResource32W(HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type)
147 return FindResourceEx32W(hModule,name,type,WINE_LanguageId);
151 /**********************************************************************
152 * LoadResource16 (KERNEL.61)
154 HGLOBAL16 WINAPI LoadResource16( HMODULE16 hModule, HRSRC16 hRsrc )
156 NE_MODULE *pModule;
158 hModule = MODULE_HANDLEtoHMODULE16( hModule );
159 dprintf_resource(stddeb, "LoadResource16: module=%04x res=%04x\n",
160 hModule, hRsrc );
161 if (!hRsrc) return 0;
162 if ((pModule = MODULE_GetPtr( hModule )))
164 #ifndef WINELIB
165 if (pModule->flags & NE_FFLAGS_WIN32)
166 fprintf(stderr,"LoadResource16: %s", NEWin32FailureString);
167 else
168 return NE_LoadResource( hModule, hRsrc );
169 #else
170 return LIBRES_LoadResource( hModule, hRsrc );
171 #endif
173 return 0;
176 /**********************************************************************
177 * LoadResource32 (KERNEL32.370)
179 HGLOBAL32 WINAPI LoadResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
181 #ifndef WINELIB
182 NE_MODULE *pModule;
184 if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
185 hModule = MODULE_HANDLEtoHMODULE32( hModule );
186 dprintf_resource(stddeb, "LoadResource32: module=%04x res=%04x\n",
187 hModule, hRsrc );
188 if (!hRsrc) return 0;
190 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
191 if (!(pModule->flags & NE_FFLAGS_WIN32))
193 fprintf(stderr,"LoadResource32: %s", PEWin16FailureString );
194 return 0; /* FIXME? */
196 return PE_LoadResource32(hModule,hRsrc);
197 #else
198 return LIBRES_LoadResource( hModule, hRsrc );
199 #endif
203 /**********************************************************************
204 * LockResource (KERNEL.62)
206 /* 16-bit version */
207 SEGPTR WINAPI WIN16_LockResource16(HGLOBAL16 handle)
209 #ifndef WINELIB
210 HMODULE16 hModule;
211 NE_MODULE *pModule;
213 dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
214 if (!handle) return (SEGPTR)0;
215 hModule = MODULE_HANDLEtoHMODULE16( handle );
216 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
217 if (pModule->flags & NE_FFLAGS_WIN32)
219 fprintf(stderr,"LockResource16: %s", NEWin32FailureString);
220 return 0;
222 return NE_LockResource( hModule, handle );
223 #else
224 return LIBRES_LockResource( handle );
225 #endif
228 /* WINELIB 16-bit version */
229 LPVOID WINAPI LockResource16( HGLOBAL16 handle )
231 #ifndef WINELIB
232 HMODULE16 hModule;
233 NE_MODULE *pModule;
235 dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
236 if (!handle) return NULL;
237 hModule = MODULE_HANDLEtoHMODULE16( handle );
238 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
239 if (pModule->flags & NE_FFLAGS_WIN32)
241 fprintf(stderr,"LockResource16: %s", NEWin32FailureString);
242 return 0;
244 return (LPSTR)PTR_SEG_TO_LIN( NE_LockResource( hModule, handle ) );
245 #else
246 return LIBRES_LockResource( handle );
247 #endif
251 /**********************************************************************
252 * LockResource32 (KERNEL32.384)
254 LPVOID WINAPI LockResource32( HGLOBAL32 handle )
256 return (LPVOID)handle;
260 /**********************************************************************
261 * FreeResource16 (KERNEL.63)
263 BOOL16 WINAPI FreeResource16( HGLOBAL16 handle )
265 #ifndef WINELIB
266 HMODULE16 hModule;
267 NE_MODULE *pModule;
269 dprintf_resource(stddeb, "FreeResource16: handle=%04x\n", handle );
270 if (!handle) return FALSE;
271 hModule = MODULE_HANDLEtoHMODULE16( handle );
272 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
273 if (pModule->flags & NE_FFLAGS_WIN32)
275 fprintf(stderr,"FreeResource16: %s", NEWin32FailureString);
276 return 0;
278 return NE_FreeResource( hModule, handle );
279 #else
280 return LIBRES_FreeResource( handle );
281 #endif
284 /**********************************************************************
285 * FreeResource32 (KERNEL32.145)
287 BOOL32 WINAPI FreeResource32( HGLOBAL32 handle )
289 /* no longer used in Win32 */
290 return TRUE;
294 /**********************************************************************
295 * AccessResource16 (KERNEL.64)
297 INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
299 NE_MODULE *pModule;
301 hModule = MODULE_HANDLEtoHMODULE16( hModule );
302 dprintf_resource(stddeb, "AccessResource16: module=%04x res=%04x\n",
303 hModule, hRsrc );
304 if (!hRsrc) return 0;
305 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
306 #ifndef WINELIB
307 if (pModule->flags & NE_FFLAGS_WIN32)
309 fprintf(stderr,"AccessResource16: %s", NEWin32FailureString);
310 return 0;
312 return NE_AccessResource( hModule, hRsrc );
313 #else
314 return LIBRES_AccessResource( hModule, hRsrc );
315 #endif
319 /**********************************************************************
320 * AccessResource32 (KERNEL32.64)
322 INT32 WINAPI AccessResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
324 hModule = MODULE_HANDLEtoHMODULE32( hModule );
325 dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
326 hModule, hRsrc );
327 if (!hRsrc) return 0;
328 fprintf(stderr,"AccessResource32: not implemented\n");
329 return 0;
333 /**********************************************************************
334 * SizeofResource16 (KERNEL.65)
336 DWORD WINAPI SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc )
338 NE_MODULE *pModule;
340 hModule = MODULE_HANDLEtoHMODULE16( hModule );
341 dprintf_resource(stddeb, "SizeofResource16: module=%04x res=%04x\n",
342 hModule, hRsrc );
343 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
344 #ifndef WINELIB
345 if (pModule->flags & NE_FFLAGS_WIN32)
347 fprintf(stderr,"SizeOfResource16: %s", NEWin32FailureString);
348 return 0;
350 return NE_SizeofResource( hModule, hRsrc );
351 #else
352 return LIBRES_SizeofResource( hModule, hRsrc );
353 #endif
357 /**********************************************************************
358 * SizeofResource32 (KERNEL32.522)
360 DWORD WINAPI SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
362 hModule = MODULE_HANDLEtoHMODULE32( hModule );
363 dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n",
364 hModule, hRsrc );
365 #ifndef WINELIB
366 return PE_SizeofResource32(hModule,hRsrc);
367 #else
368 fprintf(stderr,"SizeofResource32: not implemented\n");
369 return 0;
370 #endif
374 /**********************************************************************
375 * AllocResource16 (KERNEL.66)
377 HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
379 NE_MODULE *pModule;
381 hModule = MODULE_HANDLEtoHMODULE16( hModule );
382 dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n",
383 hModule, hRsrc, size );
384 if (!hRsrc) return 0;
385 if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
386 #ifndef WINELIB
387 if (pModule->flags & NE_FFLAGS_WIN32)
389 fprintf(stderr,"AllocResource16: %s", NEWin32FailureString);
390 return 0;
392 return NE_AllocResource( hModule, hRsrc, size );
393 #else
394 return LIBRES_AllocResource( hModule, hRsrc, size );
395 #endif
398 /**********************************************************************
399 * DirectResAlloc (KERNEL.168)
401 * Check Schulman, p. 232 for details
403 HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType,
404 UINT16 wSize )
406 dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n",
407 hInstance, wType, wSize );
408 hInstance = MODULE_HANDLEtoHMODULE16(hInstance);
409 if(!hInstance)return 0;
410 if(wType != 0x10) /* 0x10 is the only observed value, passed from
411 CreateCursorIndirect. */
412 fprintf(stderr, "DirectResAlloc: wType = %x\n", wType);
413 return GLOBAL_Alloc(GMEM_MOVEABLE, wSize, hInstance, FALSE, FALSE, FALSE);
417 /**********************************************************************
418 * LoadAccelerators16 [USER.177]
420 HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, SEGPTR lpTableName)
422 HRSRC16 hRsrc;
424 if (HIWORD(lpTableName))
425 dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
426 instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
427 else
428 dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
429 instance, LOWORD(lpTableName) );
431 if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATOR )))
432 return 0;
433 return LoadResource16(instance,hRsrc);
436 /**********************************************************************
437 * LoadAccelerators32W [USER.177]
438 * The image layout seems to look like this (not 100% sure):
439 * 00: BYTE type type of accelerator
440 * 01: BYTE pad (to WORD boundary)
441 * 02: WORD event
442 * 04: WORD IDval
443 * 06: WORD pad (to DWORD boundary)
445 HACCEL32 WINAPI LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
447 HRSRC32 hRsrc;
449 if (HIWORD(lpTableName))
450 dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
451 instance, (char *)( lpTableName ) );
452 else
453 dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
454 instance, LOWORD(lpTableName) );
456 if (!(hRsrc = FindResource32W( instance, lpTableName,
457 (LPCWSTR)RT_ACCELERATOR )))
458 return 0;
459 return LoadResource32( instance, hRsrc );
462 HACCEL32 WINAPI LoadAccelerators32A(HINSTANCE32 instance,LPCSTR lpTableName)
464 LPWSTR uni;
465 HACCEL32 result;
466 if (HIWORD(lpTableName))
467 uni = HEAP_strdupAtoW( GetProcessHeap(), 0, lpTableName );
468 else
469 uni = (LPWSTR)lpTableName;
470 result = LoadAccelerators32W(instance,uni);
471 if (HIWORD(uni)) HeapFree( GetProcessHeap(), 0, uni);
472 return result;
476 /**********************************************************************
477 * LoadString16
479 INT16 WINAPI LoadString16( HINSTANCE16 instance, UINT16 resource_id,
480 LPSTR buffer, INT16 buflen )
482 HGLOBAL16 hmem;
483 HRSRC16 hrsrc;
484 unsigned char *p;
485 int string_num;
486 int i;
488 dprintf_resource(stddeb,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
489 instance, resource_id, (int) buffer, buflen);
491 hrsrc = FindResource16( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
492 if (!hrsrc) return 0;
493 hmem = LoadResource16( instance, hrsrc );
494 if (!hmem) return 0;
496 p = LockResource16(hmem);
497 string_num = resource_id & 0x000f;
498 for (i = 0; i < string_num; i++)
499 p += *p + 1;
501 dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
503 i = MIN(buflen - 1, *p);
504 if (buffer == NULL)
505 return i;
506 if (i > 0) {
507 memcpy(buffer, p + 1, i);
508 buffer[i] = '\0';
509 } else {
510 if (buflen > 1) {
511 buffer[0] = '\0';
512 return 0;
514 fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
515 fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
517 FreeResource16( hmem );
519 dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
520 return i;
523 /**********************************************************************
524 * LoadString32W (USER32.375)
526 INT32 WINAPI LoadString32W( HINSTANCE32 instance, UINT32 resource_id,
527 LPWSTR buffer, int buflen )
529 HGLOBAL32 hmem;
530 HRSRC32 hrsrc;
531 WCHAR *p;
532 int string_num;
533 int i;
535 if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
536 resource_id = (UINT32)(-((INT32)resource_id));
537 dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
538 "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
540 hrsrc = FindResource32W( instance, (LPCWSTR)((resource_id>>4)+1),
541 (LPCWSTR)RT_STRING );
542 if (!hrsrc) return 0;
543 hmem = LoadResource32( instance, hrsrc );
544 if (!hmem) return 0;
546 p = LockResource32(hmem);
547 string_num = resource_id & 0x000f;
548 for (i = 0; i < string_num; i++)
549 p += *p + 1;
551 dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
553 i = MIN(buflen - 1, *p);
554 if (buffer == NULL)
555 return i;
556 if (i > 0) {
557 memcpy(buffer, p + 1, i * sizeof (WCHAR));
558 buffer[i] = (WCHAR) 0;
559 } else {
560 if (buflen > 1) {
561 buffer[0] = (WCHAR) 0;
562 return 0;
564 #if 0
565 fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
566 fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
567 #endif
569 #if 0
570 dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
571 #endif
572 return i;
575 /**********************************************************************
576 * LoadString32A (USER32.374)
578 INT32 WINAPI LoadString32A( HINSTANCE32 instance, UINT32 resource_id,
579 LPSTR buffer,int buflen )
581 INT32 retval;
582 LPWSTR buffer2 = NULL;
583 if (buffer) buffer2 = HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
584 retval = LoadString32W(instance,resource_id,buffer2,buflen);
586 if (buffer2)
588 lstrcpynWtoA( buffer, buffer2, buflen );
589 HeapFree( GetProcessHeap(), 0, buffer2 );
591 return retval;
594 /* Messages...used by FormatMessage32* (KERNEL32.something)
596 * They can be specified either directly or using a message ID and
597 * loading them from the resource.
599 * The resourcedata has following format:
600 * start:
601 * 0: DWORD nrofentries
602 * nrofentries * subentry:
603 * 0: DWORD firstentry
604 * 4: DWORD lastentry
605 * 8: DWORD offset from start to the stringentries
607 * (lastentry-firstentry) * stringentry:
608 * 0: WORD len (0 marks end)
609 * 2: WORD unknown (flags?)
610 * 4: CHAR[len-4]
611 * (stringentry i of a subentry refers to the ID 'firstentry+i')
613 * Yes, ANSI strings in win32 resources. Go figure.
616 /**********************************************************************
617 * LoadMessage32A (internal)
619 INT32 LoadMessage32A( HINSTANCE32 instance, UINT32 id, WORD lang,
620 LPSTR buffer, int buflen )
622 HGLOBAL32 hmem;
623 HRSRC32 hrsrc;
624 BYTE *p;
625 int nrofentries,i,slen;
626 struct _subentry {
627 DWORD firstentry;
628 DWORD lastentry;
629 DWORD offset;
630 } *se;
631 struct _stringentry {
632 WORD len;
633 WORD unknown;
634 CHAR str[1];
635 } *stre;
637 dprintf_resource(stddeb, "LoadMessage: instance = %04x, id = %04x, buffer = %08x, "
638 "length = %d\n", instance, (int)id, (int) buffer, buflen);
640 /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
641 hrsrc = FindResourceEx32W(instance,(LPWSTR)1,(LPCWSTR)RT_MESSAGELIST,lang);
642 if (!hrsrc) return 0;
643 hmem = LoadResource32( instance, hrsrc );
644 if (!hmem) return 0;
646 p = LockResource32(hmem);
647 nrofentries = *(DWORD*)p;
648 stre = NULL;
649 se = (struct _subentry*)(p+4);
650 for (i=nrofentries;i--;) {
651 if ((id>=se->firstentry) && (id<=se->lastentry)) {
652 stre = (struct _stringentry*)(p+se->offset);
653 id -= se->firstentry;
654 break;
656 se++;
658 if (!stre)
659 return 0;
660 for (i=id;i--;) {
661 if (!(slen=stre->len))
662 return 0;
663 stre = (struct _stringentry*)(((char*)stre)+slen);
665 slen=stre->len;
666 dprintf_resource(stddeb," - strlen=%d\n",slen);
667 i = MIN(buflen - 1, slen);
668 if (buffer == NULL)
669 return slen; /* different to LoadString */
670 if (i>0) {
671 lstrcpyn32A(buffer,stre->str,i);
672 buffer[i]=0;
673 } else {
674 if (buflen>1) {
675 buffer[0]=0;
676 return 0;
679 if (buffer)
680 dprintf_resource(stddeb,"LoadMessage // '%s' copied !\n", buffer);
681 return i;
684 /**********************************************************************
685 * LoadMessage32W (internal)
687 INT32 LoadMessage32W( HINSTANCE32 instance, UINT32 id, WORD lang,
688 LPWSTR buffer, int buflen )
690 INT32 retval;
691 LPSTR buffer2 = NULL;
692 if (buffer) buffer2 = HeapAlloc( GetProcessHeap(), 0, buflen );
693 retval = LoadMessage32A(instance,id,lang,buffer2,buflen);
694 if (buffer)
696 lstrcpynAtoW( buffer, buffer2, buflen );
697 HeapFree( GetProcessHeap(), 0, buffer2 );
699 return retval;
702 #ifndef WINELIB
703 /**********************************************************************
704 * SetResourceHandler (KERNEL.43)
706 FARPROC16 WINAPI SetResourceHandler( HMODULE16 hModule, SEGPTR s,
707 FARPROC16 resourceHandler )
709 NE_MODULE *pModule;
711 hModule = GetExePtr( hModule );
713 dprintf_resource(stddeb, "SetResourceHandler: module=%04x type=", hModule );
714 PrintId( s );
715 dprintf_resource( stddeb, "\n" );
717 if ((pModule = MODULE_GetPtr( hModule )))
719 if (pModule->flags & NE_FFLAGS_WIN32)
720 fprintf(stderr,"SetResourceHandler: %s", NEWin32FailureString);
721 else if (pModule->res_table)
722 return NE_SetResourceHandler( hModule, s, resourceHandler );
724 return NULL;
727 /**********************************************************************
728 * EnumResourceTypesA (KERNEL32.90)
730 BOOL32 WINAPI EnumResourceTypes32A( HMODULE32 hmodule,ENUMRESTYPEPROC32A lpfun,
731 LONG lParam)
733 return PE_EnumResourceTypes32A(hmodule,lpfun,lParam);
736 /**********************************************************************
737 * EnumResourceTypesW (KERNEL32.91)
739 BOOL32 WINAPI EnumResourceTypes32W( HMODULE32 hmodule,ENUMRESTYPEPROC32W lpfun,
740 LONG lParam)
742 return PE_EnumResourceTypes32W(hmodule,lpfun,lParam);
745 /**********************************************************************
746 * EnumResourceNamesA (KERNEL32.88)
748 BOOL32 WINAPI EnumResourceNames32A( HMODULE32 hmodule, LPCSTR type,
749 ENUMRESNAMEPROC32A lpfun, LONG lParam )
751 return PE_EnumResourceNames32A(hmodule,type,lpfun,lParam);
753 /**********************************************************************
754 * EnumResourceNamesW (KERNEL32.89)
756 BOOL32 WINAPI EnumResourceNames32W( HMODULE32 hmodule, LPCWSTR type,
757 ENUMRESNAMEPROC32W lpfun, LONG lParam )
759 return PE_EnumResourceNames32W(hmodule,type,lpfun,lParam);
762 /**********************************************************************
763 * EnumResourceLanguagesA (KERNEL32.86)
765 BOOL32 WINAPI EnumResourceLanguages32A( HMODULE32 hmodule, LPCSTR type,
766 LPCSTR name, ENUMRESLANGPROC32A lpfun,
767 LONG lParam)
769 return PE_EnumResourceLanguages32A(hmodule,type,name,lpfun,lParam);
771 /**********************************************************************
772 * EnumResourceLanguagesW (KERNEL32.87)
774 BOOL32 WINAPI EnumResourceLanguages32W( HMODULE32 hmodule, LPCWSTR type,
775 LPCWSTR name, ENUMRESLANGPROC32W lpfun,
776 LONG lParam)
778 return PE_EnumResourceLanguages32W(hmodule,type,name,lpfun,lParam);
780 #endif /* WINELIB */