Previous in Contents Next in Contents

Class ObjCreator

Programmatic Identifier

ObjCreator.ObjCreator.1

CLSID

C9C419D1-8B6A-11D0-BCD9-00805FCCCE04

COM Class Name

ObjCreator

Type Library Name

Site Server Search 3.0 Authentication Client Type Library

Type Library Location

C:\Winnt\System32\objcreator.dll

Threading Model

"Both"

The ObjCreator Component Object Model (COM) class provides an implementation of the standard DCOM function CoCreateInstanceEx that programming and scripting languages that do not support virtual table (vtable) binding to set the target host on which an object is to be created. . Programmers using higher-level languages such as Microsoft® Visual Basic®, Visual Basic Scripting Edition, or Java can use the ObjCreator class to create instances of desired COM objects and optionally specify the target host. This is in contrast to, for example, the Visual Basic function CreateObject that is hard-coded to call the COM function CoCreateInstance. In the latter case, when a programmer requests the creation of an object that resides on a remote host, the registry settings under the associated AppID are used to determine the host name.

The ObjCreator COM class also implements a special method CreateObjAuth that is used by administrators to create P&M administrative objects so they can be rendered read/write.  This method should only be used to create instances of COM classes that were specifically designed to work with the CreateObjAuth method.

Interfaces

The ObjCreator COM class implements two interfaces with logical names IObjCreator, and IObjCreatorAuth. The IObjCreator interface is dual, providing both direct binding to the interface and a standard dispinterface for clients that require access through the IDispatch interface.

Interface IObjCreator

IID

C9C419D0-8B6A-11D0-BCD9-00805FCCCE04

Type Library

c:\winnt\system32\objcreator.dll

This dual interface defines two methods for requesting the services of COM classes either on a local or remote machine. The CreateObj method allows creation of objects with a particular programmatic identifier (ProgID) on the host specified, through DCOM. The CreateObjAuth method does the same, but forces a custom two-way Security Support Provider Interface (SSPI) handshake to authenticate the requesting client to the target object. If the newly created object is satisfied that the client requesting its services has sufficient credentials, the object will allow the client to invoke the set of protected methods. If the credentials are not sufficient, the client will only be able to execute methods that do not require special privilege by the created object. This security implementation requires a special implementation for the COM class it attempts to create. This method should not be used with objects unless they are specified to work with the ObjCreator COM class.

Methods

CreateObj

The CreateObj method calls the COM function CoCreateInstanceEx after populating the COSERVERINFO structure with the desired server name. If successful, the resulting object is created on the target machine, and the IDispatch interface is returned in the [out,retval] parameter.

IDL Definition

HRESULT  CreateObj (
[in]            BSTR      bstrProgId, // the prog id of the class 
[in, optional]  BSTR      bstrServer, // the server to create it on
[out, retval]   VARIANT  *pVarObject // if success, the VT_DISPATCH
);

Remarks

This method attempts to create an instance of the desired COM class on the server specified. If an empty string is specified for the server name, the name "localhost" is assumed. Server names should conform to those used to populate the COSERVERINFO structure used with CoCreateInstanceEx.

A standard HRESULT value is returned by the method.

CreateObjAuth

The CreateObjAuth method calls the COM function CoCreateInstanceEx after populating the COSERVERINFO structure with the desired server name. If successful, it then performs a custom SSPI handshake with the target object through a custom interface. Finally, the IDispatch interface is returned in the [out,retval] parameter. This method will only create instances of COM classes designed specifically to work with the ObjCreator COM class.

IDL Definition

HRESULT  CreateObjAuth (
[in]            BSTR      bstrProgId, // prog id of class to create
[in, optional]  BSTR      bstrServer,  // server to create on
[out, retval]   VARIANT  *pVarObject  // VT_DISPATCH
);

Remarks

This method attempts to create an instance of the desired COM class on the server specified. If an empty string is specified for the server name, the name "localhost" is assumed. Server names should conform to those used to populate the COSERVERINFO structure used with CoCreateInstanceEx.

This method will only be successful when creating objects that are specifically designed to work with the ObjCreator object. If an attempt is made to use CreateObjAuth to create an instance of an object that is not designed to work with ObjCreator, a failed HRESULT value is returned.

If an object designed to work with ObjCreator is successfully instantiated, but the calling process's security credentials do not match the object's security requirements, an S_FALSE HRESULT value is returned. You can continue to use the object in this case as if it had been created directly using CoCreateInstanceEx. However, the restricted methods on the newly created object will return E_ACCESSDENIED when invoked.

The method returns S_OK if the credentials were sufficient, and the restricted methods on the newly created object will succeed.

Interface IObjCreatorAuth

IID

0B63E394-9CCC-11D0-BCDB-00805FCCCE04

Type Library

c:\winnt\system32\objcreator.dll

This interface provides a pure COM interface for C/C++ or pointer-enabled client applications. In this case, there is only one method, and it performs the same function as IObjCreator::CreateObjAuth described earlier. However, you must supply the CLSID of the component object class (coclass) desired, rather than the programmatic identifier. Similarly, the IUnknown interface address is returned in the [out, retval] argument. This method performs a custom SSPI handshake to establish the credentials of the calling client process to the target coclass instance. If the authentication is not successful, the method returns the HRESULT value S_FALSE; if successful, it returns S_OK. In either case, the IUnknown address is returned on an instance of the requested COM object or a standard HRESULT exception is returned.

Method

CreateClsObjAuth

This method takes a CLSID and an optional server name and attempts to bind an instance of the object on that machine through the DCOM call CoCreateInstanceEx. If successful, it then attempts to perform a custom security handshake with the newly created object. This method can only be successful with COM classes that were designed to work specifically with the ObjCreator COM class. If successful, it returns the IUnknown interface.

IDL Definition

HRESULT CreateClsObjAuth(
     [in]    GUID*      rClsid, // the CLSID for the class desired
     [in]    BSTR       bstrServer, // the server to run object on
     [out]   IUnknown** ppUnknown   // if successful, the IUnknown 
);

Remarks

This method attempts to create an instance of the desired COM class on the server specified. If an empty string is specified for the server name, the name "localhost" is assumed. Server names should conform to those used to populate the COSERVERINFO structure used with CoCreateInstanceEx.

This method will only be successful when creating objects that are specifically designed to work with the ObjCreator object. If an attempt is made to use CreateObjClsAuth to create an instance of an object that is not designed to work with ObjCreator, a failed HRESULT value is returned.

If an object designed to work with ObjCreator is successfully instantiated, but the calling process's security credentials do not match the object's security requirements, an S_FALSE HRESULT value is returned. You can continue to use the object in this case as if it had been created directly using CoCreateInstanceEx. However, the restricted methods on the newly created object will return E_ACCESSDENIED when invoked.

The method returns S_OK if the credentials were sufficient, and the restricted methods on the newly created object will succeed.


© 1997-2000 Microsoft Corporation. All rights reserved.