PageRenderTime 25ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/Visual Studio 2008/CppExeCOMServer/Reg.h

#
C++ Header | 134 lines | 14 code | 10 blank | 110 comment | 0 complexity | 8918cdffb563bdd7d5d022c1b2d3be7c MD5 | raw file
  1/****************************** Module Header ******************************\
  2Module Name:  Reg.h
  3Project:      CppExeCOMServer
  4Copyright (c) Microsoft Corporation.
  5
  6
  7
  8This source is subject to the Microsoft Public License.
  9See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
 10All other rights reserved.
 11
 12THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 13EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 14WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 15\***************************************************************************/
 16
 17#pragma once
 18
 19#include <windows.h>
 20
 21
 22//
 23//   FUNCTION: RegisterLocalServer
 24//
 25//   PURPOSE: This helper function registers the out-of-process component in 
 26//   the registry.
 27//
 28//   PARAMETERS:
 29//   * pszModule - Path of the module that contains the component
 30//   * clsid - Class ID of the component
 31//   * pszFriendlyName - Friendly name
 32//   * pszThreadModel - Threading model
 33//   * libid - Type library ID
 34//   * pszProgID - ProgID of the component
 35//   * pszVerIndProgID - Version independent ProgID
 36//
 37//   NOTE: The function creates the HKCR\CLSID\{<CLSID>} key and the 
 38//   HKCR\<ProgID> key in the registry.
 39// 
 40//   HKCR
 41//   {
 42//      <ProgID> = s '<Friendly Name>'
 43//      {
 44//          CLSID = s '{<CLSID>}'
 45//      }
 46//      <VersionIndependentProgID> = s '<Friendly Name>'
 47//      {
 48//          CLSID = s '{<CLSID>}'
 49//          CurVer = s '<ProgID>'
 50//      }
 51//      NoRemove CLSID
 52//      {
 53//          ForceRemove {<CLSID>} = s '<Friendly Name>'
 54//          {
 55//              ProgID = s '<ProgID>'
 56//              VersionIndependentProgID = s '<VersionIndependentProgID>'
 57//              LocalServer32 = s '%MODULE%'
 58//              TypeLib = s '{<LIBID>}'
 59//          }
 60//      }
 61//   }
 62//
 63HRESULT RegisterLocalServer(PCWSTR pszModule, 
 64                           const CLSID& clsid, 
 65                           PCWSTR pszFriendlyName,
 66                           const IID& libid, 
 67                           PCWSTR pszProgID, 
 68                           PCWSTR pszVerIndProgID);
 69
 70
 71//
 72//   FUNCTION: UnregisterLocalServer(void)
 73//
 74//   PURPOSE: Unegister the out-of-process component in the registry.
 75//
 76//   PARAMETERS:
 77//   * clsid - Class ID of the component
 78//   * pszProgID - ProgID of the component
 79//   * pszVerIndProgID - Version independent ProgID
 80//
 81//   NOTE: The function deletes the HKCR\CLSID\{<CLSID>} key and the 
 82//   HKCR\<ProgID> key in the registry.
 83//
 84HRESULT UnregisterLocalServer(const CLSID& clsid, 
 85                              PCWSTR pszProgID, 
 86                              PCWSTR pszVerIndProgID);
 87
 88
 89//
 90//   FUNCTION: RegisterTypeLib
 91//
 92//   PURPOSE: This helper function registers the type library.
 93//
 94//   PARAMETERS:
 95//   * pszTypeLib - The type library file.
 96//
 97//   NOTE: The function creates the HKCR\TypeLib\{<LIBID>} key and the 
 98//   HKCR\Interface\{<IID>} key in the registry.
 99// 
100//   HKCR
101//   {
102//      NoRemove TypeLib
103//      {
104...
105//      }
106//      NoRemove Interface
107//      {
108//          ForceRemove {<IID>} = s '<Interface Name>'
109//          {
110//              ProxyStubClsid = s '<ProgID>'
111//              ProxyStubClsid32 = s '<VersionIndependentProgID>'
112//              TypeLib = s '{<LIBID>}'
113//              {
114//                  val Version = s '<TypeLib Version>'
115//              }
116//          }
117//      }
118//   }
119//
120HRESULT RegisterTypeLib(PCWSTR pszTypeLib);
121
122
123//
124//   FUNCTION: UnregisterTypeLib
125//
126//   PURPOSE: This helper function unregisters the type library.
127//
128//   PARAMETERS:
129//   * pszTypeLib - The type library file.
130//
131//   NOTE: The function deletes the HKCR\TypeLib\{<LIBID>} key and the 
132//   HKCR\Interface\{<IID>} key in the registry.
133//
134HRESULT UnregisterTypeLib(PCWSTR pszTypeLib);