Microsoft KB Archive/186275

{|
 * width="100%"|

HOWTO: Set DCOM Client's Authentication Level Programmatically

 * }

ID: Q186275

-

The information in this article applies to:


 * Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0, on platform(s):
 * The Microsoft Windows NT operating system
 * The Microsoft Windows operating system 95
 * The Microsoft Windows operating system 98

-

SUMMARY
There are specific network situations where you will need to specify DCOM security settings on a remote client machine. As of version 1.1 of DCOM95, you can now specify process-specific security for a DCOM client running on a Windows 95 or Windows 98 machine. This eliminates the need to have DCOMCNFG.EXE run on the DCOM client machines. Please see the DCOM95 release notes for more information regarding this feature. Go to www.microsoft.com\com and select the DCOM link.

MORE INFORMATION
This article contains a function that can be used to set a DCOM client's remote Authentication Level from within a Visual Basic program.

The SetAuthentication function:

By providing this function with your DCOM server's first class name and your authentication level request (1-None or 2-Connect), you can set up the security for your client from within setup1.vbp after the exe gets registered.

This will enable your security settings for the client before it has ever executed on the client machine. Note that setting this value from within the client process will not affect security until the client is restarted. Therefore, it is recommended using this function in your setup program, as this sample demonstrates. This will have no effect on Windows NT 4.0. This functionality will be available in later versions of Windows NT.

NOTE: You should always make a backup copy of the Setup1 folder and its associated files before modifying the project for a custom set up. Setup Wizard reads the setup1.vbp project from the setup1 folder. If this is not done, your set up files will be permanently modified.


 * 1) Make a copy of the ...\DevStudio\VB\setupkit\setup1 folder and rename it Setuporg (unless you have already done so).
 * 2) Open the project ...\DevStudio\VB\setupkit\setup1\Setup1.vbp.
 * 3) Add the following code to a new standard module in setup1.vbp:
 * 4) You can now call this function from within the setup project. You should use the SetAuthentication function after the major portion of setup has completed.
 * 5) In the Form_Load event of Setup1.frm you will find a label named ExitSetup:. Add the call to SetAuthentication just above this label using the following syntax:
 * 6) Change the first parameter to the name of your server's first class.
 * 7) Set the second parameter to 2 if you want to use Connect authentication.
 * 8) Save and compile the project and run Setup Wizard as usual.
 * 9) If an error occurs, then calling ExitSetup with the gintRET_FATAL constant will safely abort the entire setup. You can choose to handle the error any way you deem appropriate.
 * 10) Your custom setup will now include client side security and should not require the use or installation of DCOMCNFG.EXE.
 * 11) Rename the Setuporg directory to Setup1.