source: trunk/src/kernel32/winres.cpp@ 4606

Last change on this file since 4606 was 4575, checked in by sandervl, 25 years ago

removed unused code + GetLocaleInfoW fix

File size: 4.3 KB
Line 
1/* $Id: winres.cpp,v 1.28 2000-11-09 18:18:11 sandervl Exp $ */
2
3/*
4 * Win32 resource class
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 *
12 */
13#define INCL_BASE
14#define INCL_WIN
15#define INCL_GPIBITMAPS
16#define INCL_BITMAPFILEFORMAT
17#define INCL_DOSMODULEMGR
18#include <os2wrap.h> //Odin32 OS/2 api wrappers
19#include <stdarg.h>
20#ifdef __IBMCPP__
21#include <builtin.h>
22#endif
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26#define INCL_WINRES
27#include <win32type.h>
28#include <win32api.h>
29#include <winconst.h>
30#include <winres.h>
31#include <misc.h>
32#include <winimagebase.h>
33#include <winexebase.h>
34#include <windllbase.h>
35#include "cvtresource.h"
36
37#define DBG_LOCALLOG DBG_winres
38#include "dbglocal.h"
39
40//******************************************************************************
41//******************************************************************************
42PVOID WIN32API ConvertResourceToOS2(HINSTANCE hInstance, LPSTR restype, HRSRC hResource)
43{
44 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
45 Win32ImageBase *module;
46 char *resdata;
47 int ressize, cvtressize;
48
49 if(hInstance == 0 || hInstance == -1 || (WinExe && hInstance == WinExe->getInstanceHandle())) {
50 module = (Win32ImageBase *)WinExe;
51 }
52 else {
53 module = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
54 }
55 resdata = (char *)LockResource(LoadResource(hInstance, hResource));
56 ressize = SizeofResource(hInstance, hResource);
57
58 switch((int)restype) {
59 case NTRT_CURSOR:
60 return ConvertCursor((CursorComponent *)resdata, ressize, &cvtressize);
61
62 case NTRT_GROUP_CURSOR:
63 return ConvertCursorGroup((CursorHeader *)resdata, ressize, module);
64
65 case NTRT_NEWMENU:
66 case NTRT_MENU:
67 case NTRT_NEWDIALOG:
68 case NTRT_DIALOG:
69 case NTRT_FONTDIR:
70 case NTRT_FONT:
71 case NTRT_MESSAGETABLE:
72 case NTRT_RCDATA:
73 case NTRT_VERSION:
74 case NTRT_STRING:
75 break;
76
77 default:
78 break;
79 }
80 dprintf(("ConvertResourceToOS2: Can't convert resource %x (inst %x)", hResource, hInstance));
81 return 0;
82}
83//******************************************************************************
84//******************************************************************************
85PVOID WIN32API ConvertCursorToOS2(LPVOID lpWinResData)
86{
87 int ressize, cvtressize;
88
89 ressize = QueryConvertedCursorSize((CursorComponent *)lpWinResData, 0);
90
91 return ConvertCursor((CursorComponent *)lpWinResData, ressize, &cvtressize);
92}
93//******************************************************************************
94//******************************************************************************
95VOID WIN32API FreeOS2Resource(LPVOID lpResource)
96{
97 free(lpResource);
98}
99//******************************************************************************
100//******************************************************************************
101ULONG WIN32API QueryConvertedResourceSize(HINSTANCE hInstance, LPSTR restype, HRSRC hResource)
102{
103 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
104 Win32ImageBase *module;
105 char *resdata;
106 int ressize, cvtressize;
107
108 if(hInstance == 0 || hInstance == -1 || (WinExe && hInstance == WinExe->getInstanceHandle())) {
109 module = (Win32ImageBase *)WinExe;
110 }
111 else {
112 module = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
113 }
114 resdata = (char *)LockResource(LoadResource(hInstance, hResource));
115 ressize = SizeofResource(hInstance, hResource);
116
117 switch((int)restype) {
118 case NTRT_CURSOR:
119 return QueryConvertedCursorSize((CursorComponent *)resdata, ressize);
120
121 case NTRT_GROUP_ICON:
122 case NTRT_GROUP_CURSOR:
123 case NTRT_ACCELERATORS:
124 case NTRT_NEWMENU:
125 case NTRT_MENU:
126 case NTRT_NEWDIALOG:
127 case NTRT_DIALOG:
128 case NTRT_FONTDIR:
129 case NTRT_FONT:
130 case NTRT_MESSAGETABLE:
131 case NTRT_RCDATA:
132 case NTRT_VERSION:
133 case NTRT_STRING:
134 default:
135 dprintf(("Win32Resource::getOS2Size SHOULDN'T BE CALLED for this resource type (%d) (NOT IMPLEMENTED)!!", restype));
136 break;
137 }
138 return 0;
139}
140//******************************************************************************
141//******************************************************************************
Note: See TracBrowser for help on using the repository browser.