nt-makefile-clean-targets-20010917
[openafs.git] / src / WINNT / client_exp / afs_shl_ext.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
13 }
14
15 #include "stdafx.h"
16 #include "afs_shl_ext.h"
17 #include <winsock2.h>
18 #include "help.h"
19 #include "shell_ext.h"
20
21 #ifdef _DEBUG
22 #define new DEBUG_NEW
23 #undef THIS_FILE
24 static char THIS_FILE[] = __FILE__;
25 #endif
26
27
28 /////////////////////////////////////////////////////////////////////////////
29 // CAfsShlExt
30
31 BEGIN_MESSAGE_MAP(CAfsShlExt, CWinApp)
32         //{{AFX_MSG_MAP(CAfsShlExt)
33                 // NOTE - the ClassWizard will add and remove mapping macros here.
34                 //    DO NOT EDIT what you see in these blocks of generated code!
35         //}}AFX_MSG_MAP
36 END_MESSAGE_MAP()
37
38 /////////////////////////////////////////////////////////////////////////////
39 // CAfsShlExt construction
40
41 CAfsShlExt::CAfsShlExt()
42 {
43         /* Start up sockets */
44         WSADATA WSAjunk;
45         WSAStartup(0x0101, &WSAjunk);
46 }
47
48 /////////////////////////////////////////////////////////////////////////////
49 // The one and only CAfsShlExt object
50
51 CAfsShlExt theApp;
52
53 /////////////////////////////////////////////////////////////////////////////
54 // CAfsShlExt initialization
55
56 BOOL CAfsShlExt::InitInstance()
57 {
58         // Load our translated resources
59         TaLocale_LoadCorrespondingModule (m_hInstance);
60
61         // Register all OLE server (factories) as running.  This enables the
62         //  OLE libraries to create objects from other applications.
63         COleObjectFactory::RegisterAll();
64
65         SetHelpPath(m_pszHelpFilePath);
66
67         return TRUE;
68 }
69
70 /////////////////////////////////////////////////////////////////////////////
71 // Special entry points required for inproc servers
72
73 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
74 {
75         AFX_MANAGE_STATE(AfxGetStaticModuleState());
76         return AfxDllGetClassObject(rclsid, riid, ppv);
77 }
78
79 STDAPI DllCanUnloadNow(void)
80 {
81         AFX_MANAGE_STATE(AfxGetStaticModuleState());
82
83         if (!nCMRefCount && !nSERefCount)
84                 return S_OK;
85
86         return S_FALSE;
87 }
88
89 // by exporting DllRegisterServer, you can use regsvr.exe
90 STDAPI DllRegisterServer(void)
91 {
92         AFX_MANAGE_STATE(AfxGetStaticModuleState());
93         COleObjectFactory::UpdateRegistryAll();
94         return S_OK;
95 }