| 1 | /* $Id: resource.cpp,v 1.1 1999-05-24 20:19:48 ktk 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 |
|
|---|
| 21 | //******************************************************************************
|
|---|
| 22 | //lpszName = integer id (high word 0), else string (name or "#237")
|
|---|
| 23 | //Can lpszType contain a pointer to a default resource type name?
|
|---|
| 24 | //******************************************************************************
|
|---|
| 25 | HRSRC WIN32API FindResourceA(HINSTANCE hModule, LPCSTR lpszName, LPCSTR lpszType)
|
|---|
| 26 | {
|
|---|
| 27 | Win32Image *module;
|
|---|
| 28 |
|
|---|
| 29 | dprintf(("FindResourceA %X", hModule));
|
|---|
| 30 | if(hModule == 0 || hModule == -1)
|
|---|
| 31 | module = (Win32Image *)WinExe;
|
|---|
| 32 | else module = (Win32Image *)Win32Dll::findModule(hModule);
|
|---|
| 33 |
|
|---|
| 34 | if(module == NULL)
|
|---|
| 35 | return(NULL);
|
|---|
| 36 |
|
|---|
| 37 | return module->findResourceA(lpszName, (LPSTR)lpszType);
|
|---|
| 38 | }
|
|---|
| 39 | //******************************************************************************
|
|---|
| 40 | //******************************************************************************
|
|---|
| 41 | HRSRC WIN32API FindResourceW(HINSTANCE hModule, LPCWSTR lpszName,
|
|---|
| 42 | LPCWSTR lpszType)
|
|---|
| 43 | {
|
|---|
| 44 | Win32Image *module;
|
|---|
| 45 |
|
|---|
| 46 | dprintf(("FindResourceW %X", hModule));
|
|---|
| 47 | if(hModule == 0 || hModule == -1)
|
|---|
| 48 | module = (Win32Image *)WinExe;
|
|---|
| 49 | else module = (Win32Image *)Win32Dll::findModule(hModule);
|
|---|
| 50 |
|
|---|
| 51 | if(module == NULL)
|
|---|
| 52 | return(NULL);
|
|---|
| 53 |
|
|---|
| 54 | return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType);
|
|---|
| 55 | }
|
|---|
| 56 | //******************************************************************************
|
|---|
| 57 | //hRes returned by LoadResource
|
|---|
| 58 | //******************************************************************************
|
|---|
| 59 | PVOID WIN32API LockResource(HGLOBAL hRes)
|
|---|
| 60 | {
|
|---|
| 61 | Win32Resource *res = (Win32Resource *)hRes;
|
|---|
| 62 |
|
|---|
| 63 | dprintf(("LockResource %X\n", hRes));
|
|---|
| 64 |
|
|---|
| 65 | /* @@@PH */
|
|---|
| 66 | if (res == NULL)
|
|---|
| 67 | return (NULL);
|
|---|
| 68 | else
|
|---|
| 69 | return res->lockResource();
|
|---|
| 70 | }
|
|---|
| 71 | //******************************************************************************
|
|---|
| 72 | //******************************************************************************
|
|---|
| 73 | HGLOBAL WIN32API LoadResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 74 | {
|
|---|
| 75 | return (HGLOBAL)hRes;
|
|---|
| 76 | }
|
|---|
| 77 | //******************************************************************************
|
|---|
| 78 | //hRes == returned by FindResource(Ex)
|
|---|
| 79 | //******************************************************************************
|
|---|
| 80 | DWORD WIN32API SizeofResource(HINSTANCE hModule, HRSRC hRes)
|
|---|
| 81 | {
|
|---|
| 82 | Win32Resource *res = (Win32Resource *)hRes;
|
|---|
| 83 |
|
|---|
| 84 | dprintf(("OS2SizeofResource\n"));
|
|---|
| 85 | if(res == NULL)
|
|---|
| 86 | return(0);
|
|---|
| 87 |
|
|---|
| 88 | return res->sizeofResource();
|
|---|
| 89 | }
|
|---|
| 90 | //******************************************************************************
|
|---|
| 91 | //******************************************************************************
|
|---|
| 92 | BOOL WIN32API EnumResourceNamesA(HINSTANCE hModule, LPCTSTR lpszType,
|
|---|
| 93 | ENUMRESNAMEPROCA lpEnumFunc, LONG lParam)
|
|---|
| 94 | {
|
|---|
| 95 | dprintf(("OS2EnumResourceNamesA - stub\n"));
|
|---|
| 96 | return(FALSE);
|
|---|
| 97 | }
|
|---|
| 98 | //******************************************************************************
|
|---|
| 99 | //******************************************************************************
|
|---|