| [953] | 1 | /* $Id: winres.h,v 1.10 1999-09-15 23:29:08 sandervl Exp $ */
 | 
|---|
| [337] | 2 | 
 | 
|---|
 | 3 | /*
 | 
|---|
 | 4 |  * Win32 resource class
 | 
|---|
 | 5 |  *
 | 
|---|
 | 6 |  * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
 | 
|---|
 | 7 |  *
 | 
|---|
 | 8 |  *
 | 
|---|
 | 9 |  * Project Odin Software License can be found in LICENSE.TXT
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  */
 | 
|---|
 | 12 | #ifndef __WINRES_H__
 | 
|---|
 | 13 | #define __WINRES_H__
 | 
|---|
 | 14 | 
 | 
|---|
| [953] | 15 | class Win32ImageBase;
 | 
|---|
| [337] | 16 | 
 | 
|---|
| [575] | 17 | //Use to distinguish between converted OS/2 resources in an image (pe2lx'ed) or
 | 
|---|
 | 18 | //resources that are loaded from the original win32 image (pe loader)
 | 
|---|
| [754] | 19 | #define RSRC_PELOADER        0
 | 
|---|
 | 20 | #define RSRC_PE2LX           1
 | 
|---|
 | 21 | #define RSRC_CUSTOMNODATA    2  //resources created in runtime without data (i.e. CreateMenu)
 | 
|---|
 | 22 | #define RSRC_CUSTOMINDIRECT  3  //resources indirectly created in runtime (i.e. CreateMenuIndirect)
 | 
|---|
| [575] | 23 | 
 | 
|---|
| [337] | 24 | class Win32Resource
 | 
|---|
 | 25 | {
 | 
|---|
 | 26 | public:
 | 
|---|
 | 27 |                    // Constructors and destructors
 | 
|---|
| [754] | 28 |                    Win32Resource(); //custum resource (i.e. created by app in runtime)
 | 
|---|
| [953] | 29 |                    Win32Resource(Win32ImageBase *module, HRSRC hRes, ULONG id, ULONG type);
 | 
|---|
 | 30 |                    Win32Resource(Win32ImageBase *module, ULONG id, ULONG type,
 | 
|---|
| [337] | 31 |                                  ULONG size, char *resdata);
 | 
|---|
| [341] | 32 |     virtual       ~Win32Resource();
 | 
|---|
| [337] | 33 | 
 | 
|---|
 | 34 |     virtual  PVOID lockResource();      //get original win32 resource
 | 
|---|
 | 35 |     virtual  PVOID lockOS2Resource();   //get converted OS/2 resource
 | 
|---|
 | 36 | 
 | 
|---|
| [816] | 37 |              //return size of original win32 resource
 | 
|---|
| [589] | 38 |              ULONG getSize()            { return ressize; };
 | 
|---|
| [816] | 39 |              //return size of converted win32 resource
 | 
|---|
 | 40 |              ULONG getOS2Size();
 | 
|---|
| [337] | 41 | 
 | 
|---|
| [344] | 42 |              ULONG getOS2Handle()               { return OS2ResHandle; };
 | 
|---|
 | 43 |               void setOS2Handle(ULONG handle)   { OS2ResHandle = handle; };
 | 
|---|
 | 44 | 
 | 
|---|
| [953] | 45 |     static    void destroyAll(Win32ImageBase *module);
 | 
|---|
| [337] | 46 | 
 | 
|---|
 | 47 | protected:
 | 
|---|
 | 48 | 
 | 
|---|
| [581] | 49 |              PVOID convertOS2Bitmap(void *bmpdata);
 | 
|---|
| [344] | 50 | 
 | 
|---|
| [581] | 51 |              PVOID convertResource(void *win32res);
 | 
|---|
 | 52 | 
 | 
|---|
| [953] | 53 |     Win32ImageBase *module;
 | 
|---|
| [337] | 54 | 
 | 
|---|
 | 55 |              HRSRC hres;
 | 
|---|
 | 56 |              ULONG type;
 | 
|---|
 | 57 |              ULONG orgos2type;
 | 
|---|
 | 58 |              ULONG id;
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 |              PVOID os2resdata;
 | 
|---|
 | 61 |              PVOID winresdata;
 | 
|---|
 | 62 | 
 | 
|---|
| [344] | 63 |              ULONG OS2ResHandle;
 | 
|---|
| [337] | 64 | 
 | 
|---|
 | 65 |              ULONG ressize;
 | 
|---|
| [575] | 66 |                int resType;
 | 
|---|
| [337] | 67 | 
 | 
|---|
| [761] | 68 |              BOOL  isUnicode;
 | 
|---|
 | 69 | 
 | 
|---|
| [337] | 70 |                                // Linked list management
 | 
|---|
| [344] | 71 |   Win32Resource*   next;               // Next Resource in module
 | 
|---|
| [337] | 72 | 
 | 
|---|
| [754] | 73 | private:
 | 
|---|
| [953] | 74 |     friend    class Win32ImageBase;
 | 
|---|
| [337] | 75 | };
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | 
 | 
|---|
 | 78 |     #define    NTRT_NEWRESOURCE      0x2000
 | 
|---|
 | 79 |     #define    NTRT_ERROR            0x7fff
 | 
|---|
 | 80 |     #define    NTRT_CURSOR           1
 | 
|---|
 | 81 |     #define    NTRT_BITMAP           2
 | 
|---|
 | 82 |     #define    NTRT_ICON             3
 | 
|---|
 | 83 |     #define    NTRT_MENU             4
 | 
|---|
 | 84 |     #define    NTRT_DIALOG           5
 | 
|---|
 | 85 |     #define    NTRT_STRING           6
 | 
|---|
 | 86 |     #define    NTRT_FONTDIR          7
 | 
|---|
 | 87 |     #define    NTRT_FONT             8
 | 
|---|
 | 88 |     #define    NTRT_ACCELERATORS     9
 | 
|---|
 | 89 |     #define    NTRT_RCDATA           10
 | 
|---|
 | 90 |     #define    NTRT_MESSAGETABLE     11
 | 
|---|
 | 91 |     #define    NTRT_GROUP_CURSOR     12
 | 
|---|
 | 92 |     #define    NTRT_GROUP_ICON       14
 | 
|---|
 | 93 |     #define    NTRT_VERSION          16
 | 
|---|
 | 94 |     #define    NTRT_NEWBITMAP        (NTRT_BITMAP|NTRT_NEWRESOURCE)
 | 
|---|
 | 95 |     #define    NTRT_NEWMENU          (NTRT_MENU|NTRT_NEWRESOURCE)
 | 
|---|
 | 96 |     #define    NTRT_NEWDIALOG        (NTRT_DIALOG|NTRT_NEWRESOURCE)
 | 
|---|
 | 97 | 
 | 
|---|
 | 98 | 
 | 
|---|
| [953] | 99 | #define MAX_RES 17
 | 
|---|
 | 100 | extern char *ResTypes[MAX_RES];
 | 
|---|
 | 101 | 
 | 
|---|
| [337] | 102 | #endif
 | 
|---|