Windows Management Instrumentation SDK Sample


Utillib

The Utillib sample library is a collection of useful routines used by some of the samples applications and that can be used in general for building WMI applications.

 

Building the Utillib Library

 

The UtilLib sample can be built from the command line using NMAKE, or it can be built using Microsoft Visual C++.  

 

From the command line in the sample installation directory, type the following:

 

NMAKE /f "Makefile"

 

From Microsoft Visual C++:

 

1.    Select File + Open Workspace

2.    Select the UtilLib.DSP file

 

 

General Functions Available in the Library

 

Function Name

Purpose

WbemErrorString

Translates SCODE into an error text string

PrintError

Translates SCODE into an error text string, formats and prints the error message

PrintErrorAndExit

Translates SCODE into an error text string, formats and prints the error message.  After printing message, exits the program.

PrintErrorAndAsk

Translates SCODE into an error text string, formats and prints the error message.  After printing message, prompts user if they wish to continue.

TypeToString

Takes a variant, returns a pointer to a string that is the variant type

TypeToString

Takes a VARTYPE, returns a pointer to a string that is the variant type

TypeToString

Takes a CIMTYPE, returns a pointer to a string that is the variant type

ValueToString

Takes a variant, returns a string representation of that variant

cvt

Converts Unicode to OEM for console output

myWFPrintf

Checks to see if outputting to console and converts string to OEM if necessary.

difftime

Returns the elapsed time between two _timeb structures

bIsNT

Boolean function that determines whether this is an NT operating system.

 

 

Security Functions Available in the Library

 

Function Name

Purpose

InitializeSecurity

Initialize DCOM security.

ParseAuthorityUserArgs

Examines the Authority and User argument and determines the authentication type.

GetAuthImp

Gets the authentication and impersonation levels for a current interface.

SetInterfaceSecurity

Set the identity to be used by a connection.

 


© 1998-2001 Microsoft Corporation. All rights reserved.