Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSAPI / SSAPI.cpp
blobeb8f1d3d878ecee565741ace524940535d12f854
1 // SSAPI.cpp : Implementation of DLL Exports.
4 // Note: Proxy/Stub Information
5 // To build a separate proxy/stub DLL,
6 // run nmake -f SSAPIps.mk in the project directory.
8 #include "stdafx.h"
9 #include "resource.h"
10 #include <initguid.h>
11 #include "SSAPI.h"
13 #include "SSAPI_i.c"
14 #include "VSSApp.h"
15 #include "VSSDatabase.h"
17 CComModule _Module;
19 BEGIN_OBJECT_MAP(ObjectMap)
20 OBJECT_ENTRY(CLSID_VSSApp, CVSSApp)
21 OBJECT_ENTRY(CLSID_VSSDatabase, CVSSDatabase)
22 //OBJECT_ENTRY(CLSID_VSSItem, CVSSItem)
23 //OBJECT_ENTRY(CLSID_VSSItems, CVSSItems)
24 //OBJECT_ENTRY(CLSID_VSSVersions, CVSSVersions)
25 END_OBJECT_MAP()
27 /////////////////////////////////////////////////////////////////////////////
28 // DLL Entry Point
30 extern "C"
31 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
33 if (dwReason == DLL_PROCESS_ATTACH)
35 _Module.Init(ObjectMap, hInstance, &LIBID_SourceSafeTypeLib);
36 DisableThreadLibraryCalls(hInstance);
38 else if (dwReason == DLL_PROCESS_DETACH)
39 _Module.Term();
40 return TRUE; // ok
43 /////////////////////////////////////////////////////////////////////////////
44 // Used to determine whether the DLL can be unloaded by OLE
46 STDAPI DllCanUnloadNow(void)
48 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
51 /////////////////////////////////////////////////////////////////////////////
52 // Returns a class factory to create an object of the requested type
54 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
56 return _Module.GetClassObject(rclsid, riid, ppv);
59 /////////////////////////////////////////////////////////////////////////////
60 // DllRegisterServer - Adds entries to the system registry
62 STDAPI DllRegisterServer(void)
64 // registers object, typelib and all interfaces in typelib
65 return _Module.RegisterServer(TRUE);
68 /////////////////////////////////////////////////////////////////////////////
69 // DllUnregisterServer - Removes entries from the system registry
71 STDAPI DllUnregisterServer(void)
73 return _Module.UnregisterServer(TRUE);
76 //---------------------------------------------------------------------------
77 void Info (const char* message)
79 ATLTRACE ("INFO: %s", message);
82 void Notice (const char* message)
84 ATLTRACE ("NOTICE: %s", message);
87 void Warning (const char* message)
89 ATLTRACE ("WARNING: %s", message);
92 void Error (const char* message)
94 ATLTRACE ("ERROR: %s", message);