1 | /* $Id: nameid.cpp,v 1.7 1999-08-19 10:25:27 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Resource id to name id conversion procedures
|
---|
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 | #define INCL_BASE
|
---|
13 | #define INCL_WIN
|
---|
14 | #define INCL_WINERRORS
|
---|
15 | #define INCL_DOSFILEMGR
|
---|
16 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
17 | #include <stdio.h>
|
---|
18 | #include <stdlib.h>
|
---|
19 | #include <string.h>
|
---|
20 | #include <win32type.h>
|
---|
21 | #include <misc.h>
|
---|
22 | #include "nameid.h"
|
---|
23 | #include "win32util.h"
|
---|
24 | #include <winimage.h>
|
---|
25 | #include <winexe.h>
|
---|
26 | #include "os2util.h"
|
---|
27 |
|
---|
28 | /******************************************************************************/
|
---|
29 | /******************************************************************************/
|
---|
30 | int SYSTEM EXPORT ConvertNameId(ULONG hmod, char *name)
|
---|
31 | {
|
---|
32 | Win32Dll *module;
|
---|
33 |
|
---|
34 | dprintf(("Convert %s in mod %X to id\n", name, hmod ));
|
---|
35 |
|
---|
36 | if(hmod == 0 || hmod == -1 || hmod == WinExe->getInstanceHandle() )
|
---|
37 | {
|
---|
38 | return WinExe->convertNameId(name);
|
---|
39 | }
|
---|
40 |
|
---|
41 | module = Win32Dll::findModule(hmod);
|
---|
42 | if(module == 0)
|
---|
43 | {
|
---|
44 | dprintf(("ConvertNameId: module %X not found\n", hmod));
|
---|
45 | return(0);
|
---|
46 | }
|
---|
47 | return module->convertNameId(name);
|
---|
48 | }
|
---|
49 | //******************************************************************************
|
---|
50 | //******************************************************************************
|
---|
51 | char *StripPath(char *path)
|
---|
52 | {
|
---|
53 | /* @@@PH what does this function do ? Strip the path from a FQFN name ? */
|
---|
54 | char *pszFilename;
|
---|
55 |
|
---|
56 | pszFilename = strrchr(path, '\\'); /* find rightmost slash */
|
---|
57 | if (pszFilename != NULL)
|
---|
58 | return (pszFilename++); /* return pointer to next character */
|
---|
59 |
|
---|
60 | pszFilename = strrchr(path, '/'); /* find rightmost slash */
|
---|
61 | if (pszFilename != NULL)
|
---|
62 | return (pszFilename++); /* return pointer to next character */
|
---|
63 |
|
---|
64 | return (path); /* default return value */
|
---|
65 | }
|
---|
66 | //******************************************************************************
|
---|
67 | //******************************************************************************
|
---|