source: trunk/src/kernel32/nameid.cpp@ 21

Last change on this file since 21 was 17, checked in by phaller, 26 years ago

Code cleanup #1 for build, mainly addresses linkage problems

File size: 2.4 KB
Line 
1/* $Id: nameid.cpp,v 1.2 1999-05-31 22:08:12 phaller Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8/*
9 * Resource id to name id conversion procedures
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
23#include <odin.h>
24#include "win32type.h"
25#include "misc.h"
26#include "nameid.h"
27#include "win32util.h"
28#include "winimage.h"
29#include "winexe.h"
30#include "os2util.h"
31
32void UpCase(char *mixedcase);
33
34/******************************************************************************/
35/******************************************************************************/
36int SYSTEM EXPORT ConvertNameId(ULONG hmod, char *name)
37{
38 HMODULE hmodule;
39 Win32Dll *module;
40
41 dprintf(("Convert %s in mod %X to id\n", name, hmod ));
42
43 hmodule = GetOS2ModuleHandle(hmod);
44 if( hmodule == 0
45 || hmodule == -1
46 || hmodule == OS2iGetModuleHandleA( NULL ) )
47 {
48 return WinExe->convertNameId(name);
49 }
50
51 module = Win32Dll::findModule(hmodule);
52 if(module == 0)
53 {
54 dprintf(("ConvertNameId: module %X not found\n", hmod));
55 return(0);
56 }
57 return module->convertNameId(name);
58}
59//******************************************************************************
60//******************************************************************************
61void SYSTEM EXPORT UpCase(char *mixedcase)
62{
63 int i;
64
65 for(i=0;i<strlen(mixedcase);i++) {
66 if(mixedcase[i] >= 'a' && mixedcase[i] <= 'z') {
67 mixedcase[i] += 'A' - 'a';
68 }
69 }
70}
71/******************************************************************************/
72/******************************************************************************/
73ULONG GetOS2ModuleHandle(ULONG hmod)
74{
75 APIRET rc;
76 char modname[128];
77 HMODULE hmodule;
78
79 if(hmod == 0 || hmod == -1) {
80 return(0);
81 }
82
83 if(Win32QueryModuleName(hmod, modname, sizeof(modname)) == 0) {
84 dprintf(("Can't determine handle of dll %X\n", hmod));
85 return(0);
86 }
87 rc = DosQueryModuleHandle(modname, &hmodule);
88 if(rc) {
89 dprintf(("Can't determine handle of dll %s\n", modname));
90 return(0);
91 }
92 return(hmodule);
93}
94/******************************************************************************/
95/******************************************************************************/
Note: See TracBrowser for help on using the repository browser.