6.4.1 Object-Creation Functions in the Handler

All eight of the object-creation functions must be included in the handler, since a client could call any object-creation function. All of the object-creation functions must be put into the object handler as functions with the Dll prefix. Once a handler has been registered, any calls to the original object-creation functions (prefixed with Ole) will be redirected to the new object-creation functions in the handler (prefixed with Dll).

The following table lists the object-creation function names when used with object handlers:

Original Function Name Handler Object-Creation Function Name

OleCreate DllCreate
OleCreateFromClip DllCreateFromClip
OleCreateFromFile DllCreateFromFile
OleCreateFromTemplate DllCreateFromTemplate
OleCreateLinkFromClip DllCreateLinkFromClip
OleCreateLinkFromFile DllCreateLinkFromFile
OleCreateInvisible DllCreateInvisible
OleLoadFromStream DllLoadFromStream

6.4.1.1 Object-Creation Aliases

The original object-creation functions in OLECLI.DLL must also be called in the handler object-creation function code. Since object-creation functions with the Ole prefix are redirected to the handler, the calls to the original functions use the Def prefix, which is set up by OLECLI.DLL as an alias. Each object creation-function code block in the handler must include at the very beginning a function call to the alias of the original object-creation function using the prefix Def.

The following table lists the object-creation alias names:

Original Function Name Object-Creation Alias Function Name

OleCreate DefCreate
OleCreateFromClip DefCreateFromClip
OleCreateFromFile DefCreateFromFile
OleCreateFromTemplate DefCreateFromTemplate
OleCreateLinkFromClip DefCreateLinkFromClip
OleCreateLinkFromFile DefCreateLinkFromFile
OleCreateInvisible DefCreateInvisible
OleLoadFromStream DefLoadFromStream

6.4.1.2 Object-Creation Code Structure

The following pseudocode shows the structure that each object-creation function in the handler must follow. There must be a call to the OLECLI.DLL object-creation function alias (using the Def prefix) and there must also be a call to a function to copy the OLEOBJECTVTBL. Additional code can also be used to provide extra functionality to any of the object-creation functions.

DllCreateFunctionName(parameters)

{

DefCreateFunctionName(parameters);

CopyVTBLFunction;

AdditionalCode;

}

Note The object handler must contain Dll calls to all eight of the object-creation functions. OLECLI.DLL checks to see if all eight object-creation functions are in the handler with the Dll prefix. If they are not, the handler is unloaded and ignored.