2 * Copyright 2000, International Business Machines Corporation and others.
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
11 #include <afs/param.h>
16 #include "afs_shl_ext.h"
19 #include "shell_ext.h"
24 static char THIS_FILE[] = __FILE__;
28 /////////////////////////////////////////////////////////////////////////////
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!
38 /////////////////////////////////////////////////////////////////////////////
39 // CAfsShlExt construction
41 CAfsShlExt::CAfsShlExt()
43 /* Start up sockets */
45 WSAStartup(0x0101, &WSAjunk);
48 /////////////////////////////////////////////////////////////////////////////
49 // The one and only CAfsShlExt object
53 /////////////////////////////////////////////////////////////////////////////
54 // CAfsShlExt initialization
56 BOOL CAfsShlExt::InitInstance()
58 // Load our translated resources
59 TaLocale_LoadCorrespondingModule (m_hInstance);
61 // Register all OLE server (factories) as running. This enables the
62 // OLE libraries to create objects from other applications.
63 COleObjectFactory::RegisterAll();
65 SetHelpPath(m_pszHelpFilePath);
70 /////////////////////////////////////////////////////////////////////////////
71 // Special entry points required for inproc servers
73 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
75 AFX_MANAGE_STATE(AfxGetStaticModuleState());
76 return AfxDllGetClassObject(rclsid, riid, ppv);
79 STDAPI DllCanUnloadNow(void)
81 AFX_MANAGE_STATE(AfxGetStaticModuleState());
83 if (!nCMRefCount && !nSERefCount && !nICRefCount && !nTPRefCount && !nXPRefCount)
89 // by exporting DllRegisterServer, you can use regsvr.exe
90 STDAPI DllRegisterServer(void)
96 TCHAR szSubKey[MAX_PATH];
97 TCHAR szCLSID[MAX_PATH];
98 TCHAR szModule[MAX_PATH];
100 AFX_MANAGE_STATE(AfxGetStaticModuleState());
101 COleObjectFactory::UpdateRegistryAll();
102 wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
103 lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
107 REG_OPTION_NON_VOLATILE,
113 if(NOERROR == lResult)
115 //Create the value string.
116 lResult = RegSetValueEx( hKey,
121 (lstrlen(szCLSID) + 1) * sizeof(TCHAR));
125 return SELFREG_E_CLASS;
127 //If running on NT, register the extension as approved.
129 osvi.dwOSVersionInfoSize = sizeof(osvi);
131 if(VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
133 lstrcpy( szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
135 lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
139 REG_OPTION_NON_VOLATILE,
145 if(NOERROR == lResult)
147 TCHAR szData[MAX_PATH];
149 //Create the value string.
150 lstrcpy(szData, STR_EXT_TITLE);
152 lResult = RegSetValueEx( hKey,
157 (lstrlen(szData) + 1) * sizeof(TCHAR));
161 return SELFREG_E_CLASS;