With Novell's Library for C, what function should...
Articles and Tips: qna
01 Sep 2002
Q.
With Novell's Library for C, what function should I use to get information as to which service pack has been installed on a server?
A.
You can use something like NWGetNetWare- ProductVersion(). The program below prints the following information: majorVersion = 6, minorVersion = 0, revision = 1
#include int main( int argc, char* argv[]) { char const* server_name; NWRCODE rcode; NWCCODE ccode; NWCONN_HANDLE conn_handle; NETWARE_PRODUCT_VERSION product_version; if ( argc != 2) { printf( "Usage: %s \n", *argv); return EXIT_FAILURE; } server_name = strupr( *++argv); rcode = NWCCOpenConnByName( 0, server_name, NWCC_NAME_FORMAT_BIND, NWCC_OPEN_LICENSED, NWCC_TRAN_TYPE_WILD, &conn_handle); if ( rcode != 0) { printf( "NWCCOpenConnByName failed, rcode = %x", rcode); return EXIT_FAILURE; } ccode = NWGetNetWareProductVersion( conn_handle, &product_version); if ( ccode != 0) { printf( "NWGetNetWareProductVersion failed, ccode = %x", ccode); return EXIT_FAILURE; } printf( "majorVersion = %d, minorVersion = %d, revision = %d\n", product_version.majorVersion, product_version.minorVersion, product_version.revision); NWCCCloseConn( conn_handle); return EXIT_SUCCESS; }
Note that the function does not distinguish between minor revisions of Support Packs, such as SP2 and SP2a. Russ Bateman, CLIB Senior Engineer here at Novell, adds the following explanation of all the ways you can get version information.
This might not be all the ways you can get this information, but the main idea is that starting with NetWare v5.1, the file server version number (the OS or SERVER.EXE's version information) stopped having much to do with the Marketing versions.
LibC: sys/utsname.h, function uname, uname2 (gives you the whole enchilada and certainly callable from CLib apps too CLib: utsname.h, function uname (not as comprehensive as LibC; no product version information, enchilada with cheese only) Other, legitimate external interfaces (of varying utility): GetFileServerDescriptionStrings (as strings) GetServerInformation NWGetFileServerVersionInfo NWGetNetWareProductVersion (supposedly the best official interface besides uname) NWGetOSVersionInfo And here is some version data that should be correct (if a bit aging-- I got this when the product numbers became an issue for the libraries; displayed in fixed-width font, it looks cleanly aligned): NetWare v5.1 Support Pack 1 (English and International) Product version: 5.1.1 GetProductMajorVersionNumber() returns 5 GetProductMinorVersionNumber() returns 1 GetProductRevisionNumber() returns 1 File server version: 5.00i GetFileServerMajorVersionNumber() returns 5 GetFileServerMinorVersionNumber() returns 0 GetFileServerRevisionNumber() returns 8 ('i') NetWare v5.1 Support Pack 1 (Cobra English only) Product version: 5.1.0 GetProductMajorVersionNumber() returns 5 GetProductMinorVersionNumber() returns 1 GetProductRevisionNumber() returns 0 File server version: 5.00h GetFileServerMajorVersionNumber()returns 5 GetFileServerMinorVersionNumber()returns 0 GetFileServerRevisionNumber() returns 7 ('h') NetWare v5.0 Support Pack 5 Product version: 5.00.5 GetProductMajorVersionNumber() returns 5 GetProductMinorVersionNumber() returns 0 GetProductRevisionNumber() returns 5 File server version: 5.00i GetFileServerMajorVersionNumber() returns 5 GetFileServerMinorVersionNumber() returns 0 GetFileServerRevisionNumber() returns 8 NetWare v5.0 Support Pack 4 Product version: 5.00.4 GetProductMajorVersionNumber() returns 5 GetProductMinorVersionNumber() returns 0 GetProductRevisionNumber() returns 4 File server version: 5.00g GetFileServerMajorVersionNumber() returns 5 GetFileServerMinorVersionNumber() returns 0 GetFileServerRevisionNumber() returns 6 NetWare v4.11 Product version: 4.11 GetProductMajorVersionNumber() returns (function doesn't exist) GetProductMinorVersionNumber() returns (function doesn't exist) GetProductRevisionNumber() returns (function doesn't exist) File server version: 4.11 GetFileServerMajorVersionNumber() returns 4 GetFileServerMinorVersionNumber() returns 11 GetFileServerRevisionNumber() returns 0
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.