source: trunk/src/kernel32/winmod.cpp@ 110

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

comctl32 wine conversion bugs fixed
trackbar: TRACKBAR_Draw prototype

File size: 2.5 KB
Line 
1/* $Id: winmod.cpp,v 1.4 1999-06-16 20:25:45 cbratschi Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8/*
9 * Win32 PE Image class
10 *
11 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
12 *
13 */
14#define INCL_BASE
15#define INCL_WIN
16#define INCL_WINERRORS
17#define INCL_DOSFILEMGR
18#include <os2.h>
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include "win32type.h"
23#include "misc.h"
24#include "nameid.h"
25#include "win32util.h"
26#define INCL_WINRES
27#include "winres.h"
28#include "winimage.h"
29#include "windll.h"
30
31//******************************************************************************
32//******************************************************************************
33int Win32Image::getWin32ResourceId(int id)
34{
35 int nrres, i;
36
37 if(Win32Table == NULL)
38 return(-1);
39
40 nrres = *Win32Table;
41 for(i=1;i<=nrres;i++) {
42 if(id == (Win32Table[i] >> 16)) {
43 dprintf(("OS/2 id -> Win32 id = %d -> %d\n", id, Win32Table[i] & 0xFFFF));
44 return(Win32Table[i] & 0xFFFF);
45 }
46 }
47 dprintf(("Original resource not found!!\n"));
48 return(-1);
49}
50//******************************************************************************
51//******************************************************************************
52int Win32Image::convertNameId(char *lpszName)
53{
54 NameId *curnid;
55 int nrcvtnames, i;
56 char *upname;
57
58 if(NameTable == NULL)
59 return(0);
60
61 nrcvtnames = *(USHORT *)NameTable;
62 curnid = (NameId *)((int)NameTable + sizeof(USHORT));;
63 for(i=0;i<nrcvtnames;i++) {
64 if(strcmp(lpszName, curnid->name) == 0) {
65 return(curnid->id);
66 }
67 curnid = (NameId *)((char *)curnid + sizeof(NameId) + strlen(curnid->name));
68 }
69
70 //try upper case search
71 //SvL: Copy it, since string might be located in readonly object
72
73 upname = (char *)malloc(strlen(lpszName)+1); //CB: Trap with MFC Toolbar/UpDown samples
74 strcpy(upname, lpszName);
75 UpCase(upname);
76 dprintf(("Convert %s to id\n", upname));
77 curnid = (NameId *)((int)NameTable + sizeof(USHORT));;
78 for(i=0;i<nrcvtnames;i++) {
79 if(strcmp(upname, curnid->name) == 0) {
80 free(upname);
81 return(curnid->id);
82 }
83 curnid = (NameId *)((char *)curnid + sizeof(NameId) + strlen(curnid->name));
84 }
85 dprintf(("Converted name NOT found!\n"));
86 free(upname);
87
88 return(0);
89}
90//******************************************************************************
91//******************************************************************************
Note: See TracBrowser for help on using the repository browser.