# COM Server Responsibilities

One of the most important ways for a client to get a pointer to an object is for the client to ask that a server be launched, and that an instance of the object provided by the server be created and activated. It is the responsibility of the server to ensure that this happens properly. There are several important parts to this.

The server must implement code for a class object through an implementation of either the IClassFactory or IClassFactory2 interface.

The server must register its CLSID in the system registry on the machine on which it resides, and further, has the option of publishing its machine location to other systems on a network to allow clients to call it without requiring the client to know the server’s location.

The server is primarily responsible for security &emdash; that is, for the most part, the server determines whether it will provide a pointer to one of its objects to a client.

In-process servers should implement and export certain functions that allow the client process to instantiate them.

This chapter contains the following sections:

- Implementing IClassFactory

- Licensing and IClassFactory2

- Registering COM Servers

- Out-of-process Server Implementation Helpers

- GUID Creation and Optimizations