| 1 | /* $Id: resource.cpp,v 1.2 1999-05-31 22:08:12 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | *
|
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 6 | *
|
|---|
| 7 | */
|
|---|
| 8 | /*
|
|---|
| 9 | * Misc resource procedures
|
|---|
| 10 | *
|
|---|
| 11 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 12 | * Copyright 1998 Patrick Haller
|
|---|
| 13 | *
|
|---|
| 14 | */
|
|---|
| 15 | #include <os2win.h>
|
|---|
| 16 | #include "unicode.h"
|
|---|
| 17 | #include "winres.h"
|
|---|
| 18 | #include "winimage.h"
|
|---|
| 19 | #include "winexe.h"
|
|---|
| 20 | #include "misc.h"
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | //******************************************************************************
|
|---|
| 24 | //lpszName = integer id (high word 0), else string (name or "#237")
|
|---|
| 25 | //Can lpszType contain a pointer to a default resource type name?
|
|---|
| 26 | //******************************************************************************
|
|---|
| 27 | HRSRC WIN32API FindResourceA(HINSTANCE hModule, LPCSTR lpszName, LPCSTR lpszType)
|
|---|
| 28 | {
|
|---|
| 29 | Win32Image *module;
|
|---|
| 30 |
|
|---|
| 31 | dprintf(("FindResourceA %X", hModule));
|
|---|
| 32 | if(hModule == 0 || hModule == -1)
|
|---|
| 33 | module = (Win32Image *)WinExe;
|
|---|
| 34 | else module = (Win32Image *)Win32Dll::findModule(hModule);
|
|---|
| 35 |
|
|---|
| 36 | if(module == NULL)
|
|---|
| 37 | return(NULL);
|
|---|
| 38 |
|
|---|
| 39 | return module->findResourceA(lpszName, (LPSTR)lpszType);
|
|---|
| 40 | }
|
|---|
| 41 | //******************************************************************************
|
|---|
| 42 | //******************************************************************************
|
|---|
| 43 | HRSRC WIN32API FindResourceW(HINSTANCE hModule, LPCWSTR lpszName,
|
|---|
| 44 | LPCWSTR lpszType)
|
|---|
| 45 | {
|
|---|
| 46 | Win32Image *module;
|
|---|
| 47 |
|
|---|
| 48 | dprintf(("FindResourceW %X", hModule));
|
|---|
| 49 | if(hModule == 0 || hModule == -1)
|
|---|
| 50 | module = (Win32Image *)WinExe;
|
|---|
| 51 | else module = (Win32Image *)Win32Dll::findModule(hModule);
|
|---|
| 52 |
|
|---|
| 53 | if(module == NULL)
|
|---|
| 54 | return(NULL);
|
|---|
| 55 |
|
|---|
| 56 | return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType);
|
|---|
| 57 | }
|
|---|
| 58 | //******************************************************************************
|
|---|
| 59 | //hRes returned by LoadResource
|
|---|
| 60 | //******************************************************************************
|
|---|
| 61 | PVOID WIN32API LockResource(HGLOBAL hRes)
|
|---|
| 62 | {
|
|---|
| 63 | Win32Resource *res = (Win32Resource *)hRes;
|
|---|
| 64 |
|
|---|
| 65 | dprintf(("LockResource %X\n", hRes));
|
|---|
| 66 |
|
|---|
| 67 | /* @@@PH */
|
|---|
| 68 | if (res == NULL)
|
|---|
| 69 | return (NULL);
|
|---|
| 70 | else
|
|---|
| 71 | return res->lockResource();
|
|---|
| 72 | }
|
|---|
| 73 | //******************************************************************************
|
|---|
| 74 | //******************************************************************************
|
|---|
| 75 | HGLOBAL WIN32API LoadResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 76 | {
|
|---|
| 77 | return (HGLOBAL)hRes;
|
|---|
| 78 | }
|
|---|
| 79 | //******************************************************************************
|
|---|
| 80 | //hRes == returned by FindResource(Ex)
|
|---|
| 81 | //******************************************************************************
|
|---|
| 82 | DWORD WIN32API SizeofResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 83 | {
|
|---|
| 84 | Win32Resource *res = (Win32Resource *)hRes;
|
|---|
| 85 |
|
|---|
| 86 | dprintf(("OS2SizeofResource\n"));
|
|---|
| 87 | if(res == NULL)
|
|---|
| 88 | return(0);
|
|---|
| 89 |
|
|---|
| 90 | return res->sizeofResource();
|
|---|
| 91 | }
|
|---|
| 92 | //******************************************************************************
|
|---|
| 93 | //******************************************************************************
|
|---|
| 94 | BOOL WIN32API EnumResourceNamesA(HINSTANCE hModule, LPCTSTR lpszType,
|
|---|
| 95 | ENUMRESNAMEPROCA lpEnumFunc, LONG lParam)
|
|---|
| 96 | {
|
|---|
| 97 | dprintf(("OS2EnumResourceNamesA - stub\n"));
|
|---|
| 98 | return(FALSE);
|
|---|
| 99 | }
|
|---|
| 100 | //******************************************************************************
|
|---|
| 101 | //******************************************************************************
|
|---|