355 lines
15 KiB
HTML
355 lines
15 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Example: Administration APIs" />
|
|
<meta name="abstract" content="This example demonstrates how an application might use iSeries Access for Windows Administration APIs." />
|
|
<meta name="description" content="This example demonstrates how an application might use iSeries Access for Windows Administration APIs." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaikadmin.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="adminapiex" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Example: Administration APIs</title>
|
|
</head>
|
|
<body id="adminapiex"><a name="adminapiex"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Administration APIs</h1>
|
|
<div><p>This example demonstrates how an application might use iSeries™ Access
|
|
for Windows<sup>®</sup> Administration
|
|
APIs.</p>
|
|
<div class="section"><p>In this example, the APIs are used to get and display:</p>
|
|
<ul><li>The current iSeries Access
|
|
for Windows Version/Release/Modification
|
|
level</li>
|
|
<li>The current service pack (fix) level</li>
|
|
<li>The components that currently are installed on the PC</li>
|
|
</ul>
|
|
<p>The user then is allowed to enter iSeries Navigator plug-in names, and
|
|
is informed whether the plug-in is installed.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Usage notes:</h4><p>Include cwbad.h * </p>
|
|
<p>Link with
|
|
cwbapi.lib</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Example</h4><pre>#include <windows.h>
|
|
#include <stdio.h>
|
|
|
|
#include "cwbad.h"
|
|
|
|
|
|
/*
|
|
* This is the highest numbered component ID known (it is
|
|
* the ID of the last component defined in cwbad.h).
|
|
*/
|
|
#define LAST_COMPID_WE_KNOW_ABOUT (CWBAD_COMP_SSL_40_BIT)
|
|
|
|
|
|
/*
|
|
* Array of component names, taken from comments for component IDs
|
|
* in cwbad.h, so human-readable component descriptions are displayed .
|
|
* In the compDescr array, the component ID for a component must match
|
|
* the index in the array of that component's description.
|
|
*
|
|
* For a blank or unknown component name, a string is provided to display
|
|
* an indication that the component ID is unknown, and what that ID is.
|
|
*/
|
|
static char* compDescr[ LAST_COMPID_WE_KNOW_ABOUT + 1 ] = {
|
|
"", // #0 is not used
|
|
"Required programs",
|
|
"Optional Components",
|
|
"Directory Update",
|
|
"Incoming Remote Command",
|
|
"", // not used,
|
|
"Online User's Guide",
|
|
"iSeries Navigator",
|
|
"Data Access",
|
|
"Data Transfer",
|
|
"Data Transfer Base Support",
|
|
"Data Transfer Excel Add-in",
|
|
"Data Transfer WK4 file support",
|
|
"ODBC",
|
|
"OLE DB Provider",
|
|
"AFP Workbench Viewer",
|
|
"iSeries Java Toolbox",
|
|
"5250 Display and Printer Emulator",
|
|
"Printer Drivers",
|
|
"AFP printer driver",
|
|
"SCS printer driver",
|
|
"iSeries Operations Console",
|
|
"iSeries Access Programmer's Toolkit",
|
|
"Headers, Libraries, and Documentation",
|
|
"Visual Basic Wizards",
|
|
"EZ Setup",
|
|
"Java Toolkit",
|
|
"Screen customizer",
|
|
".NET Data Provider",
|
|
"", //-------------#29
|
|
"", "", "", "", "", // #30-34
|
|
"", "", "", "", "", // #35-39
|
|
"", "", "", "", "", // #40-44
|
|
"", "", "", "", "", // #45-49
|
|
"", "", "", "", "", // not #50-54
|
|
"", "", "", "", "", // #55-59
|
|
"", "", "", "", "", // #60-64
|
|
"", "", "", "", "", // #65-69
|
|
"", "", "", "", "", // used #70-74
|
|
"", "", "", "", "", // #75-79
|
|
"", "", "", "", "", // #80-84
|
|
"", "", "", "", "", // #85-89
|
|
"", "", "", "", "", // #90-94
|
|
"", "", "", "", "", //------------ #95-99
|
|
"iSeries Navigator Base Support",
|
|
"iSeries Navigator Basic Operations",
|
|
"iSeries Navigator Job Management",
|
|
"iSeries Navigator System Configuration",
|
|
"iSeries Navigator Networks",
|
|
"iSeries Navigator Security",
|
|
"iSeries Navigator Users and Groups",
|
|
"iSeries Navigator Database",
|
|
"", // not used #108
|
|
"iSeries Navigator Backup",
|
|
"iSeries Navigator Application Development",
|
|
"iSeries Navigator Application Administrat",
|
|
"iSeries Navigator File Systems",
|
|
"iSeries Navigator Management Central",
|
|
"iSeries Navigator Management Central - Commands",
|
|
"iSeries Navigator Management Central - Packages and Products",
|
|
"iSeries Navigator Logical Systems",
|
|
"iSeries Navigator Advanced Function Presentation",
|
|
"","" //-------------#118-119
|
|
"", "", "", "", "", // not #120-124
|
|
"", "", "", "", "", // #125-129
|
|
"", "", "", "", "", // #130-134
|
|
"", "", "", "", "", // used #135-139
|
|
"", "", "", "", "", // #140-144
|
|
"", "", "", "", "", //------------ #145-149
|
|
"PC5250: BASE_KOREAN",
|
|
"PC5250: PDFPDT_KOREAN",
|
|
"PC5250: BASE_SIMPCHIN",
|
|
"PC5250: PDFPDT_SIMPCHIN",
|
|
"PC5250: BASE_TRADCHIN",
|
|
"PC5250: PDFPDT_TRADCHIN",
|
|
"PC5250: BASE_STANDARD",
|
|
"PC5250: PDFPDT_STANDARD",
|
|
"PC5250: FONT_ARABIC",
|
|
"PC5250: FONT_BALTIC",
|
|
"PC5250: FONT_LATIN2",
|
|
"PC5250: FONT_CYRILLIC",
|
|
"PC5250: FONT_GREEK",
|
|
"PC5250: FONT_HEBREW",
|
|
"PC5250: FONT_LAO",
|
|
"PC5250: FONT_THAI",
|
|
"PC5250: FONT_TURKISH",
|
|
"PC5250: FONT_VIET",
|
|
"PC5250: FONT_HINDI",
|
|
"", //------------ #169
|
|
"", "", "", "", "", // #170-174
|
|
"", "", "", "", "", // not #175-179
|
|
"", "", "", "", "", // #180-184
|
|
"", "", "", "", "", // used #185-189
|
|
"", "", "", "", "", // #190-194
|
|
"", "", "", "", "", //------------ #195-199
|
|
"Secure Sockets Layer (SSL)" } ; // last one defined
|
|
static char unknownComp[] = "unknown, ID= ";
|
|
static char* pInsertID = &amp;( unknownComp[12] ); // insert ID here!
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* Show the iSeries Access for Windows Version/Release/Modification level
|
|
**************************************************************************/
|
|
void showCA_VRM()
|
|
{
|
|
ULONG caVer, caRel, caMod;
|
|
UINT rc;
|
|
char fixlevelBuf[ MAX_PATH ];
|
|
ULONG fixlevelBufLen = sizeof( fixlevelBuf );
|
|
|
|
printf( "iSeries Access level installed:\n\n" );
|
|
|
|
rc = cwbAD_GetClientVersion( &caVer;, &caRel;, &caMod; );
|
|
if ( rc != CWB_OK )
|
|
{
|
|
printf( " Error %u occurred when calling cwbAD_GetClientVersion()\n\n",
|
|
rc );
|
|
}
|
|
else
|
|
{
|
|
printf( " Version %lu, Release %lu, Modification %lu\n\n",
|
|
caVer, caRel, caMod );
|
|
|
|
printf( "iSeries Access service pack level installed:\n\n" );
|
|
rc = cwbAD_GetProductFixLevel( fixlevelBuf, &fixlevelBufLen; );
|
|
if ( rc != CWB_OK )
|
|
{
|
|
printf( " Error %u occurred when calling "
|
|
"cwbAD_GetProduceFixLevel()\n\n", rc );
|
|
}
|
|
else if ( fixlevelBuf[0] == '\0' ) // empty, no service packs applied
|
|
{
|
|
printf( " None\n\n" );
|
|
}
|
|
else
|
|
{
|
|
printf( " %s\n\n", fixlevelBuf );
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* Call iSeries Access for Windows API to determine if the component is installed,
|
|
* and pass back:
|
|
* NULL if the component is not installed or an error occurs,
|
|
* OR
|
|
* A string indicating the component name is unknown if the
|
|
* component ID is higher than we know about OR the component
|
|
* description is blank,
|
|
* OR
|
|
* The human-readable component description if known.
|
|
**************************************************************************/
|
|
char* isCompInstalled( ULONG compID )
|
|
{
|
|
cwb_Boolean bIsInstalled;
|
|
char* pCompName;
|
|
|
|
UINT rc = cwbAD_IsComponentInstalled( compID, &bIsInstalled; );
|
|
|
|
/*
|
|
* Case 1: Error OR component not installed, return NULL to
|
|
* indicate not installed.
|
|
*/
|
|
if ( ( rc != CWB_OK ) || ( bIsInstalled == CWB_FALSE ) )
|
|
{
|
|
pCompName = NULL;
|
|
}
|
|
|
|
/*
|
|
* Case 2: Component IS installed, but its name is not known,
|
|
* return component name unknown string.
|
|
*/
|
|
else if ( ( compID > LAST_COMPID_WE_KNOW_ABOUT ) ||
|
|
( compDescr[ compID ][ 0 ] == '\0' ) )
|
|
{
|
|
pCompName = unknownComp;
|
|
sprintf( pInsertID, "%lu", compID );
|
|
}
|
|
|
|
/*
|
|
* Case 3: Component IS installed, and a name is known, return it
|
|
*/
|
|
else
|
|
{
|
|
pCompName = compDescr[ compID ];
|
|
}
|
|
|
|
return pCompName;
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* List the iSeries Access for Windows components that currently are installed.
|
|
**************************************************************************/
|
|
void showCA_CompInstalled()
|
|
{
|
|
ULONG compID;
|
|
char* compName;
|
|
|
|
printf( "iSeries Access components installed:\n\n" );
|
|
|
|
/*
|
|
* Try all known components, plus a bunch more in case some
|
|
* have been added (via service pack).
|
|
*/
|
|
for ( compID = 0;
|
|
compID &lt; (LAST_COMPID_WE_KNOW_ABOUT + 50);
|
|
compID++ )
|
|
{
|
|
compName = isCompInstalled( compID );
|
|
if ( compName != NULL )
|
|
{
|
|
printf( " %s\n", compName );
|
|
}
|
|
}
|
|
|
|
printf( "\n" );
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* MAIN PROGRAM BODY
|
|
**************************************************************************/
|
|
void main(void)
|
|
{
|
|
UINT rc;
|
|
char pluginName[ MAX_PATH ];
|
|
cwb_Boolean bPluginInstalled;
|
|
|
|
printf( "=======================================\n");
|
|
printf( "iSeries Access What's Installed Reporter\n" );
|
|
printf( "=======================================\n\n");
|
|
|
|
showCA_VRM();
|
|
showCA_CompInstalled();
|
|
|
|
/*
|
|
* Allow user to ask by name what plug-ins are installed.
|
|
*/
|
|
while ( TRUE ) /* REMINDER: requires a break to exit the loop! */
|
|
{
|
|
printf( "Enter plug-in to check for, or DONE to quit:\n" );
|
|
gets( pluginName );
|
|
if ( stricmp( pluginName, "DONE" ) == 0 )
|
|
{
|
|
break; /* exit from the while loop, DONE at user's request */
|
|
}
|
|
|
|
rc = cwbAD_IsOpNavPluginInstalled( pluginName, &bPluginInstalled; );
|
|
if ( rc == CWB_OK )
|
|
{
|
|
if ( bPluginInstalled == CWB_TRUE )
|
|
{
|
|
printf( "The plug-in '%s' is installed.\n\n", pluginName );
|
|
}
|
|
else
|
|
{
|
|
printf( "The plug-in '%s' is NOT installed.\n\n", pluginName );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
printf(
|
|
"Error %u occurred when calling cwbAD_IsOpNavPluginInstalled.\n\n",
|
|
rc );
|
|
}
|
|
} // end while (TRUE)
|
|
|
|
printf( "\nEnd of program.\n\n" );
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikadmin.htm" title="iSeries Access for Windows Administration APIs provide functions that access information about the iSeries Access for Windows code that is installed on the PC.">iSeries Access for Windows Administration APIs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |