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

Last change on this file since 37 was 37, checked in by cbratschi, 26 years ago

hiho

File size: 3.3 KB
Line 
1/* $Id: resource.cpp,v 1.4 1999-06-06 12:25:49 cbratschi 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//******************************************************************************
28HRSRC WIN32API FindResourceA(HINSTANCE hModule, LPCSTR lpszName, LPCSTR lpszType)
29{
30 Win32Image *module;
31
32 dprintf(("FindResourceA %X", hModule));
33 // EB: ->>> added real exe module handle
34 if(hModule == 0 || hModule == -1 || (WinExe != NULL && hModule == WinExe->getOS2InstanceHandle()))
35 module = (Win32Image *)WinExe;
36 else
37 module = (Win32Image *)Win32Dll::findModule(hModule);
38
39 if(module == NULL)
40 return(NULL);
41
42 return module->findResourceA(lpszName, (LPSTR)lpszType);
43}
44//******************************************************************************
45//******************************************************************************
46HRSRC WIN32API FindResourceW(HINSTANCE hModule, LPCWSTR lpszName,
47 LPCWSTR lpszType)
48{
49 Win32Image *module;
50
51 dprintf(("FindResourceW %X", hModule));
52 if(hModule == 0 || hModule == -1)
53 module = (Win32Image *)WinExe;
54 else module = (Win32Image *)Win32Dll::findModule(hModule);
55
56 if(module == NULL)
57 return(NULL);
58
59 return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType);
60}
61//******************************************************************************
62//hRes returned by LoadResource
63//******************************************************************************
64PVOID WIN32API LockResource(HGLOBAL hRes)
65{
66 Win32Resource *res = (Win32Resource *)hRes;
67
68 dprintf(("LockResource %X\n", hRes));
69
70 /* @@@PH */
71 if (res == NULL)
72 return (NULL);
73 else
74 return res->lockResource();
75}
76//******************************************************************************
77//******************************************************************************
78HGLOBAL WIN32API LoadResource(HINSTANCE hModule, HRSRC hRes)
79{
80 return (HGLOBAL)hRes;
81}
82//******************************************************************************
83//hRes == returned by FindResource(Ex)
84//******************************************************************************
85DWORD WIN32API SizeofResource(HINSTANCE hModule, HRSRC hRes)
86{
87 Win32Resource *res = (Win32Resource *)hRes;
88
89 dprintf(("OS2SizeofResource\n"));
90 if(res == NULL)
91 return(0);
92
93 return res->sizeofResource();
94}
95//******************************************************************************
96//******************************************************************************
97BOOL WIN32API EnumResourceNamesA(HINSTANCE hModule, LPCTSTR lpszType,
98 ENUMRESNAMEPROCA lpEnumFunc, LONG lParam)
99{
100 dprintf(("OS2EnumResourceNamesA - stub\n"));
101 return(FALSE);
102}
103//******************************************************************************
104//******************************************************************************
Note: See TracBrowser for help on using the repository browser.