|
Security
The Security sample
demonstrates the basics of how set the security on interface proxys. It
demonstrates this by allowing the connection to be made as a caller other than
the currently logged on user. It also
demonstrates how to access the security descriptor for a namespace.
The sample also
demonstrates how to use Credential Manager API for
password prompting:
this functionality is only implemented on Windows XP and above.
Win2K Limitation
Therefore, you will
need to remove CredUI code to make the sample run on
Win2K. It will compile
and build on Win2k anyway.
Building the Security Application
The application 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 Security.dsp file
Using the Security Sample
1.
Build the
Security sample using NMAKE as described above
2.
Execute the Security
application and the appropriate options will be listed. From the command line in the sample
installation directory, type the following:
Security.exe
General Notes
Things
to remember when you're building your own WMI client application:
1.
WMI interfaces are defined
in wbemcli.h and wbemprov.h
found in the wmi\include directory. You may #include both these files by
including just wbemidl.h located in the same
directory.
2.
WMI interface CLSIDs are defined in wbemuuid.lib.
If you get unresolved externals in interfaces and CLSIDs,
this is what is missing.
3.
You'll need to link with
oleaut32.lib and ole32.lib to get the needed COM support.
4.
In the Link|Output
settings, specify 'wWinMainCRTStartup' as the entry
point. This is per the Unicode programming instructions.
5.
If you're using the makefiles, don't
forget to set the Visual C++ environment variables. This is done by running
VCVARS32.BAT.