************************************************************************ PROCEDURE DCOMCnfgServer *********************** *** Function: Sets the security attributes of an Automation server *** to Interactive User *** Assume: Only works for Interactive user for now *** Pass: lcProgId - Program ID for the server (wcdemo.wcdemoserver) *** lcRunAs - User Account (Default: Interactive User) *** Return: nothing ************************************************************************* LPARAMETER lcProgId, lcRunAs LOCAL lcProgId, loAPI, lcClassId, lcServerName lcRunAs=IIF(type("lcRunAs")="C",lcRunAs,"Interactive User") lcProgId=IIF(type("lcProgId")="C",lcProgId,"") loAPI = CREATE("wwAPI") *** Retrieve ClassId and Server Name lcClassId = loAPI.ReadRegistryString(HKEY_CLASSES_ROOT,; lcProgId + "\CLSID",; "") lcServerName = loAPI.ReadRegistryString(HKEY_CLASSES_ROOT,; lcProgId + "","") IF ISNULL(lcClassId) or ISNULL(lcServerName) wait window nowait "Invalid Class Id..." RETURN ENDIF wait window "Configuring server security for "+CR+; lcProgId + CR + lcServerName nowait *** Now add AppId key to the ClsID entry if !loAPI.WriteRegistryString(HKEY_LOCAL_MACHINE,; "SOFTWARE\Classes\CLSID\"+lcClassId,"AppId",lcClassID,.t.) wait window "Unable to write AppID value..." nowait RETURN ENDIF *** Create a AppID Entry if it doesn't exist if !loAPI.WriteRegistryString(HKEY_CLASSES_ROOT,; "AppID\"+lcClassId,CHR(0),CHR(0),.t.) wait window "Unable to write AppID key..." nowait RETURN ENDIF *** Write the Server Name into the Default key loAPI.WriteRegistryString(HKEY_CLASSES_ROOT,; "AppID\"+lcClassId,"",; lcServerName,; .t.) *** Write Interactive User (or user Accounts) loAPI.WriteRegistryString(HKEY_CLASSES_ROOT,; "AppID\"+lcClassId,"RunAs",; lcRunAS,; .t.) wait window "DCOM security context set to: " + lcRunAs nowait RETURN+++ Rick ---