source: trunk/src/kernel32/resource.cpp@ 589

Last change on this file since 589 was 589, checked in by sandervl, 26 years ago

More PE resource changes

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