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