1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: queryprocessinfo.e
|
---|
4 | *
|
---|
5 | * .e wrapper routine to access the NEPMD library DLL.
|
---|
6 | * include of nepmdlib.e
|
---|
7 | *
|
---|
8 | * Copyright (c) Netlabs EPM Distribution Project 2002
|
---|
9 | *
|
---|
10 | * $Id: queryprocessinfo.e 2417 2011-05-15 23:32:51Z aschn $
|
---|
11 | *
|
---|
12 | * ===========================================================================
|
---|
13 | *
|
---|
14 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
15 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
16 | * GNU General Public License as published by the Free Software
|
---|
17 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
18 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
20 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | ****************************************************************************/
|
---|
24 |
|
---|
25 | /*
|
---|
26 | @@NepmdQueryProcessInfo@PROTOTYPE
|
---|
27 | InfoValue = NepmdQueryProcessInfo( ValueTag);
|
---|
28 |
|
---|
29 | @@NepmdQueryProcessInfo@CATEGORY@PROCESS
|
---|
30 |
|
---|
31 | @@NepmdQueryProcessInfo@SYNTAX
|
---|
32 | This function queries values related to the current EPM process.
|
---|
33 |
|
---|
34 | @@NepmdQueryProcessInfo@PARM@ValueTag
|
---|
35 | This parameter specifies a keyword determining the
|
---|
36 | process information value to be returned.
|
---|
37 |
|
---|
38 | The following keywords are supported:
|
---|
39 | .pl bold
|
---|
40 | - PID
|
---|
41 | = returns the process ID of the current process
|
---|
42 | - PPID
|
---|
43 | = returns the process ID of the parent of the current process
|
---|
44 | - PROGRAM
|
---|
45 | = returns the full pathname of the process executable (so of *EPM*)
|
---|
46 | - PARMS
|
---|
47 | = returns the commandline parameters for the current process
|
---|
48 | .el
|
---|
49 |
|
---|
50 | @@NepmdQueryProcessInfo@RETURNS
|
---|
51 | *NepmdQueryProcessInfo* returns either
|
---|
52 | .ul compact
|
---|
53 | - the information value or
|
---|
54 | - the string *ERROR:xxx*, where *xxx* is an OS/2 error code.
|
---|
55 |
|
---|
56 | @@NepmdQueryProcessInfo@TESTCASE
|
---|
57 | You can test this function from the *EPM* commandline by
|
---|
58 | executing:
|
---|
59 | .sl
|
---|
60 | - *NepmdQueryProcessInfo*
|
---|
61 | - or
|
---|
62 | - *QueryProcessInfo*
|
---|
63 |
|
---|
64 | Executing this command will
|
---|
65 | open up a virtual file and
|
---|
66 | write all [.IDPNL_EFUNC_NEPMDQUERYPROCESSINFO_PARM_VALUETAG supported process values]
|
---|
67 | into it.
|
---|
68 |
|
---|
69 | @@
|
---|
70 | */
|
---|
71 |
|
---|
72 | /* ------------------------------------------------------------- */
|
---|
73 | /* allow editor command to call function */
|
---|
74 | /* ------------------------------------------------------------- */
|
---|
75 | compile if NEPMD_LIB_TEST
|
---|
76 |
|
---|
77 | defc NepmdQueryProcessInfo, QueryProcessInfo
|
---|
78 |
|
---|
79 | helperNepmdCreateDumpfile( 'NepmdQueryProcessInfo', '');
|
---|
80 | insertline helperNepmdQueryProcessInfoValue( 'PID');
|
---|
81 | insertline helperNepmdQueryProcessInfoValue( 'PPID');
|
---|
82 | insertline helperNepmdQueryProcessInfoValue( 'PROGRAM');
|
---|
83 | insertline helperNepmdQueryProcessInfoValue( 'PARMS');
|
---|
84 | .modify = 0;
|
---|
85 |
|
---|
86 | return;
|
---|
87 |
|
---|
88 | defproc helperNepmdQueryProcessInfoValue( ValueTag) =
|
---|
89 | return leftstr( ValueTag, 15) ':' NepmdQueryProcessInfo( ValueTag);
|
---|
90 |
|
---|
91 | compile endif
|
---|
92 |
|
---|
93 | /* ------------------------------------------------------------- */
|
---|
94 | /* procedure: NepmdQueryProcessInfo */
|
---|
95 | /* ------------------------------------------------------------- */
|
---|
96 | /* .e Syntax: */
|
---|
97 | /* InfoValue = NepmdQueryProcessInfo( ValueTag); */
|
---|
98 | /* */
|
---|
99 | /* See valig tags in src\gui\nepmdlib\nepmdlib.h: */
|
---|
100 | /* NEPMD_PROCESSINFO_* */
|
---|
101 | /* ------------------------------------------------------------- */
|
---|
102 | /* C prototype: */
|
---|
103 | /* APIRET EXPENTRY NepmdQueryProcessInfo( PSZ pszInfoTag, */
|
---|
104 | /* PSZ pszBuffer, */
|
---|
105 | /* ULONG ulBuflen) */
|
---|
106 | /* ------------------------------------------------------------- */
|
---|
107 |
|
---|
108 | defproc NepmdQueryProcessInfo( ValueTag) =
|
---|
109 |
|
---|
110 | BufLen = 260;
|
---|
111 | InfoValue = copies( atoi( 0), BufLen);
|
---|
112 |
|
---|
113 | /* prepare parameters for C routine */
|
---|
114 | ValueTag = ValueTag''atoi( 0);
|
---|
115 |
|
---|
116 | /* call C routine */
|
---|
117 | LibFile = helperNepmdGetlibfile();
|
---|
118 | rc = dynalink32( LibFile,
|
---|
119 | "NepmdQueryProcessInfo",
|
---|
120 | address( ValueTag) ||
|
---|
121 | address( InfoValue) ||
|
---|
122 | atol( Buflen));
|
---|
123 |
|
---|
124 | helperNepmdCheckliberror( LibFile, rc);
|
---|
125 |
|
---|
126 | return makerexxstring( InfoValue);
|
---|
127 |
|
---|