1 // so_activex.cpp : Implementation of DLL Exports.
4 // Note: Proxy/Stub Information
5 // To build a separate proxy/stub DLL,
6 // run nmake -f so_activexps.mk in the project directory.
12 #include "so_activex.h"
14 #include "so_activex_i.c"
15 #include "SOActiveX.h"
17 #include <comphelper\documentconstants.hxx>
23 BEGIN_OBJECT_MAP(ObjectMap
)
24 OBJECT_ENTRY(CLSID_SOActiveX
, CSOActiveX
)
27 /////////////////////////////////////////////////////////////////////////////
31 BOOL WINAPI
DllMain(HINSTANCE hInstance
, DWORD dwReason
, LPVOID
/*lpReserved*/)
33 if (dwReason
== DLL_PROCESS_ATTACH
)
35 _Module
.Init(ObjectMap
, hInstance
, &LIBID_SO_ACTIVEXLib
);
36 DisableThreadLibraryCalls(hInstance
);
38 else if (dwReason
== DLL_PROCESS_DETACH
)
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 // for now database component and chart are always installed
63 #define SUPPORTED_EXT_NUM 30
64 const char* aFileExt
[] = { ".vor",
65 ".sds", ".sda", ".sdd", ".sdp", ".sdc", ".sdw", ".smf",
66 ".stw", ".stc", ".sti", ".std",
67 ".sxw", ".sxc", ".sxi", ".sxd", ".sxg", ".sxm",
68 ".ott", ".otg", ".otp", ".ots", ".otf",
69 ".odt", ".oth", ".odm", ".odg", ".odp", ".ods", ".odf"};
70 const char* aMimeType
[] = {
71 "application/vnd.stardivision.writer",
73 "application/vnd.stardivision.chart",
74 "application/vnd.stardivision.draw",
75 "application/vnd.stardivision.impress",
76 "application/vnd.stardivision.impress-packed",
77 "application/vnd.stardivision.calc",
78 "application/vnd.stardivision.writer",
79 "application/vnd.stardivision.math",
81 MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII
,
82 MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII
,
83 MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII
,
84 MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII
,
86 MIMETYPE_VND_SUN_XML_WRITER_ASCII
,
87 MIMETYPE_VND_SUN_XML_CALC_ASCII
,
88 MIMETYPE_VND_SUN_XML_IMPRESS_ASCII
,
89 MIMETYPE_VND_SUN_XML_DRAW_ASCII
,
90 MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII
,
91 MIMETYPE_VND_SUN_XML_MATH_ASCII
,
93 MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII
,
94 MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII
,
95 MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII
,
96 MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII
,
97 MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII
,
99 MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
,
100 MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII
,
101 MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII
,
102 MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII
,
103 MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII
,
104 MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
,
105 MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII
};
107 const int nForModes
[] = { 16,
108 1, 2, 4, 4, 8, 16, 32,
112 16, 16, 16, 2, 4, 8, 32 };
114 const char* aClassID
= "{67F2A879-82D5-4A6D-8CC5-FFB3C114B69D}";
115 const char* aTypeLib
= "{61FA3F13-8061-4796-B055-3697ED28CB38}";
117 // ISOComWindowPeer interface information
118 const char* aInterIDWinPeer
= "{BF5D10F3-8A10-4A0B-B150-2B6AA2D7E118}";
119 const char* aProxyStubWinPeer
= "{00020424-0000-0000-C000-000000000046}";
121 // ISODispatchInterceptor interface information
122 const char* aInterIDDispInt
= "{9337694C-B27D-4384-95A4-9D8E0EABC9E5}";
123 const char* aProxyStubDispInt
= "{00020424-0000-0000-C000-000000000046}";
125 // ISOActionsApproval interface information
126 const char* aInterIDActApprove
= "{029E9F1E-2B3F-4297-9160-8197DE7ED54F}";
127 const char* aProxyStubActApprove
= "{00020424-0000-0000-C000-000000000046}";
129 // The following prefix is required for HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER ( not for HKEY_CLASSES_ROOT )
130 const char* aLocalPrefix
= "Software\\Classes\\";
132 BOOL
createKey( HKEY hkey
,
133 const char* aKeyToCreate
,
134 const char* aValue
= NULL
,
135 const char* aChildName
= NULL
,
136 const char* aChildValue
= NULL
)
140 return ( ERROR_SUCCESS
== RegCreateKey( hkey
, aKeyToCreate
, &hkey1
)
141 && ( !aValue
|| ERROR_SUCCESS
== RegSetValueEx( hkey1
,
147 && ( !aChildName
|| ERROR_SUCCESS
== RegSetValueEx( hkey1
,
151 (const BYTE
*)aChildValue
,
152 strlen( aChildValue
) ) )
153 && ERROR_SUCCESS
== RegCloseKey( hkey1
) );
157 STDAPI
DllUnregisterServerNative( int nMode
, BOOL bForAllUsers
);
158 STDAPI
DllRegisterServerNative( int nMode
, BOOL bForAllUsers
, const char* pActiveXPath
)
160 BOOL aResult
= FALSE
;
169 const char* aPrefix
= aLocalPrefix
; // bForAllUsers ? "" : aLocalPrefix;
171 char pActiveXPath101
[1024];
172 char pPrCatalogPath
[1019];
175 // In case SO7 is installed for this user he can have local registry entries that will prevent him from
176 // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control.
177 // Unfortunately it can be done only for the user who installs the office.
179 DllUnregisterServerNative( nMode
, sal_False
);
182 MessageBoxA(NULL
, pActiveXPath
, "Library Path, ( from library )", MB_OK
| MB_ICONINFORMATION
);
187 sprintf( pActiveXPath101
, "%s, 101", pActiveXPath
);
189 int nPrCatLength
= strlen( pActiveXPath
) - sizeof( "so_activex.dll" ) + 1;
190 strncpy( pPrCatalogPath
, pActiveXPath
, nPrCatLength
);
191 pPrCatalogPath
[ nPrCatLength
] = 0;
194 wsprintf( aSubKey
, "%sCLSID\\%s", aPrefix
, aClassID
);
196 ( ERROR_SUCCESS
== RegCreateKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
)
197 && ERROR_SUCCESS
== RegSetValueEx( hkey
, "", 0, REG_SZ
, (const BYTE
*)"SOActiveX Class", 17 )
198 && createKey( hkey
, "Control" )
199 && createKey( hkey
, "EnableFullPage" )
200 && createKey( hkey
, "InprocServer32", pActiveXPath
, "ThreadingModel", "Apartment" )
201 && createKey( hkey
, "MiscStatus", "0" )
202 && createKey( hkey
, "MiscStatus\\1", "131473" )
203 && createKey( hkey
, "ProgID", "so_activex.SOActiveX.1" )
204 && createKey( hkey
, "Programmable" )
205 && createKey( hkey
, "ToolboxBitmap32", pActiveXPath101
)
206 && createKey( hkey
, "TypeLib", aTypeLib
)
207 && createKey( hkey
, "Version", "1.0" )
208 && createKey( hkey
, "VersionIndependentProgID", "so_activex.SOActiveX" )
209 && ERROR_SUCCESS
== RegCloseKey( hkey
)
210 && ERROR_SUCCESS
== RegCreateKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aPrefix
, &hkey
)
211 && createKey( hkey
, "so_activex.SOActiveX", "SOActiveX Class" )
212 && ERROR_SUCCESS
== RegCreateKey( hkey
, "so_activex.SOActiveX", &hkey1
)
213 && createKey( hkey1
, "CLSID", aClassID
)
214 && createKey( hkey1
, "CurVer", "so_activex.SOActiveX.1" )
215 && ERROR_SUCCESS
== RegCloseKey( hkey1
)
216 && createKey( hkey
, "so_activex.SOActiveX.1", "SOActiveX Class" )
217 && ERROR_SUCCESS
== RegCreateKey( hkey
, "so_activex.SOActiveX.1", &hkey1
)
218 && createKey( hkey1
, "CLSID", aClassID
)
219 && ERROR_SUCCESS
== RegCloseKey( hkey1
)
220 && ERROR_SUCCESS
== RegCreateKey( hkey
, "TypeLib", &hkey1
)
221 && ERROR_SUCCESS
== RegCreateKey( hkey1
, aTypeLib
, &hkey2
)
222 && createKey( hkey2
, "1.0", "wrap_activex 1.0 Type Library" )
223 && ERROR_SUCCESS
== RegCreateKey( hkey2
, "1.0", &hkey3
)
224 && ERROR_SUCCESS
== RegCreateKey( hkey3
, "0", &hkey4
)
225 && createKey( hkey4
, "win32", pActiveXPath
)
226 && ERROR_SUCCESS
== RegCloseKey( hkey4
)
227 && createKey( hkey3
, "FLAGS", "0" )
228 && createKey( hkey3
, "HELPDIR", pPrCatalogPath
)
229 && ERROR_SUCCESS
== RegCloseKey( hkey3
)
230 && ERROR_SUCCESS
== RegCloseKey( hkey2
)
231 && ERROR_SUCCESS
== RegCloseKey( hkey1
)
232 && ERROR_SUCCESS
== RegCreateKey( hkey
, "Interface", &hkey1
)
233 && createKey( hkey1
, aInterIDWinPeer
, "ISOComWindowPeer" )
234 && ERROR_SUCCESS
== RegCreateKey( hkey1
, aInterIDWinPeer
, &hkey2
)
235 && createKey( hkey2
, "ProxyStubClsid", aProxyStubWinPeer
)
236 && createKey( hkey2
, "ProxyStubClsid32", aProxyStubWinPeer
)
237 && createKey( hkey2
, "TypeLib", aTypeLib
, "Version", "1.0" )
238 && ERROR_SUCCESS
== RegCloseKey( hkey2
)
239 && createKey( hkey1
, aInterIDActApprove
, "ISOActionsApproval" )
240 && ERROR_SUCCESS
== RegCreateKey( hkey1
, aInterIDActApprove
, &hkey2
)
241 && createKey( hkey2
, "ProxyStubClsid", aProxyStubActApprove
)
242 && createKey( hkey2
, "ProxyStubClsid32", aProxyStubActApprove
)
243 && createKey( hkey2
, "TypeLib", aTypeLib
, "Version", "1.0" )
244 && ERROR_SUCCESS
== RegCloseKey( hkey2
)
245 && createKey( hkey1
, aInterIDDispInt
, "ISODispatchInterceptor" )
246 && ERROR_SUCCESS
== RegCreateKey( hkey1
, aInterIDDispInt
, &hkey2
)
247 && createKey( hkey2
, "ProxyStubClsid", aProxyStubDispInt
)
248 && createKey( hkey2
, "ProxyStubClsid32", aProxyStubDispInt
)
249 && createKey( hkey2
, "TypeLib", aTypeLib
, "Version", "1.0" )
250 && ERROR_SUCCESS
== RegCloseKey( hkey2
)
251 && ERROR_SUCCESS
== RegCloseKey( hkey1
)
252 && ERROR_SUCCESS
== RegCloseKey( hkey
) );
254 hkey
= hkey1
= hkey2
= hkey3
= hkey4
= NULL
;
258 for( ind
= 0; ind
< SUPPORTED_EXT_NUM
&& aResult
; ind
++ )
260 if( nForModes
[ind
] & nMode
)
262 wsprintf( aSubKey
, "%sMIME\\DataBase\\Content Type\\%s", aPrefix
, aMimeType
[ind
] );
263 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
)
264 // || ERROR_SUCCESS != RegSetValueEx(hkey, "Extension", 0, REG_SZ,
265 // (const BYTE *)aFileExt[ind], strlen( aFileExt[ind] ) )
266 || ERROR_SUCCESS
!= RegSetValueEx(hkey
, "CLSID", 0, REG_SZ
,
267 (const BYTE
*)aClassID
, strlen(aClassID
)) )
271 RegCloseKey(hkey
),hkey
= NULL
;
274 wsprintf( aSubKey, "%s%s", aPrefix, aFileExt[ind] );
275 if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey)
276 || ERROR_SUCCESS != RegSetValueEx(hkey, "Content Type", 0, REG_SZ,
277 (const BYTE *)aMimeType[ind], strlen( aMimeType[ind] ) ) )
280 RegCloseKey(hkey),hkey= NULL;
285 wsprintf( aSubKey
, "%sCLSID\\%s", aPrefix
, aClassID
);
286 if ( aResult
&& ERROR_SUCCESS
== RegOpenKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
) )
288 for( ind
= 0; ind
< SUPPORTED_EXT_NUM
; ind
++ )
290 wsprintf( aSubKey
, "EnableFullPage\\%s", aFileExt
[ind
] );
291 if ( ERROR_SUCCESS
!= RegCreateKey( hkey
, aSubKey
, &hkey1
) )
295 RegCloseKey(hkey1
),hkey1
= NULL
;
302 RegCloseKey(hkey
),hkey
= NULL
;
307 /////////////////////////////////////////////////////////////////////////////
308 // DllUnregisterServer - Removes entries from the system registry
310 STDAPI
DllUnregisterServerNative( int nMode
, BOOL bForAllUsers
)
315 const char* aPrefix
= aLocalPrefix
; // bForAllUsers ? "" : aLocalPrefix;
317 for( int ind
= 0; ind
< SUPPORTED_EXT_NUM
; ind
++ )
319 if( nForModes
[ind
] & nMode
)
321 DWORD nSubKeys
= 0, nValues
= 0;
322 wsprintf( aSubKey
, "%sMIME\\DataBase\\Content Type\\%s", aPrefix
, aMimeType
[ind
] );
323 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
) )
327 if ( ERROR_SUCCESS
!= RegDeleteValue( hkey
, "CLSID" ) )
330 if ( ERROR_SUCCESS
!= RegQueryInfoKey( hkey
, NULL
, NULL
, NULL
,
331 &nSubKeys
, NULL
, NULL
,
332 &nValues
, NULL
, NULL
, NULL
, NULL
) )
334 RegCloseKey( hkey
), hkey
= NULL
;
339 RegCloseKey( hkey
), hkey
= NULL
;
340 if ( !nSubKeys
&& !nValues
)
341 SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
);
345 wsprintf( aSubKey
, "%s%s", aPrefix
, aFileExt
[ind
] );
346 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
) )
350 if ( ERROR_SUCCESS
!= RegQueryInfoKey( hkey
, NULL
, NULL
, NULL
,
351 &nSubKeys
, NULL
, NULL
,
352 &nValues
, NULL
, NULL
, NULL
, NULL
) )
354 RegCloseKey( hkey
), hkey
= NULL
;
359 RegCloseKey( hkey
), hkey
= NULL
;
360 if ( !nSubKeys
&& !nValues
)
361 SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
);
367 wsprintf( aSubKey
, "%sCLSID\\%s", aPrefix
, aClassID
);
368 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
371 wsprintf( aSubKey
, "%sso_activex.SOActiveX", aPrefix
);
372 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
375 wsprintf( aSubKey
, "%sso_activex.SOActiveX.1", aPrefix
);
376 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
379 wsprintf( aSubKey
, "%s\\TypeLib\\%s", aPrefix
, aTypeLib
);
380 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
383 wsprintf( aSubKey
, "%s\\Interface\\%s", aPrefix
, aInterIDWinPeer
);
384 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
387 wsprintf( aSubKey
, "%s\\Interface\\%s", aPrefix
, aInterIDDispInt
);
388 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
391 wsprintf( aSubKey
, "%s\\Interface\\%s", aPrefix
, aInterIDActApprove
);
392 if( ERROR_SUCCESS
!= SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
) )
398 /////////////////////////////////////////////////////////////////////////////
399 // DllRegisterServerDoc - Adds entries to the system registry
401 #define SUPPORTED_MSEXT_NUM 7
402 const char* aMSFileExt
[] = { ".dot", ".doc", ".xlt", ".xls", ".pot", ".ppt", ".pps" };
403 const char* aMSMimeType
[] = { "application/msword",
404 "application/msword",
405 "application/msexcell",
406 "application/msexcell",
407 "application/mspowerpoint",
408 "application/mspowerpoint",
409 "application/mspowerpoint" };
410 const int nForMSModes
[] = { 1, 1, 2, 2, 4, 4, 4 };
412 STDAPI
DllUnregisterServerDoc( int nMode
, BOOL bForAllUsers
);
413 STDAPI
DllRegisterServerDoc( int nMode
, BOOL bForAllUsers
)
421 const char* aPrefix
= aLocalPrefix
; // bForAllUsers ? "" : aLocalPrefix;
423 // In case SO7 is installed for this user he can have local registry entries that will prevent him from
424 // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control.
425 // Unfortunately it can be done only for the user who installs the office.
427 DllUnregisterServerDoc( nMode
, sal_False
);
429 for( ind
= 0; ind
< SUPPORTED_MSEXT_NUM
&& aResult
; ind
++ )
431 if( nForMSModes
[ind
] & nMode
)
433 wsprintf( aSubKey
, "%sMIME\\DataBase\\Content Type\\%s", aPrefix
, aMSMimeType
[ind
] );
434 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
)
435 || ERROR_SUCCESS
!= RegSetValueEx(hkey
, "Extension", 0, REG_SZ
,
436 (const BYTE
*)aMSFileExt
[ind
], strlen( aMSFileExt
[ind
] ) )
437 || ERROR_SUCCESS
!= RegSetValueEx(hkey
, "CLSID", 0, REG_SZ
,
438 (const BYTE
*)aClassID
, strlen(aClassID
)) )
442 RegCloseKey(hkey
),hkey
= NULL
;
444 wsprintf( aSubKey
, "%s%s", aPrefix
, aMSFileExt
[ind
] );
445 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
)
446 || ERROR_SUCCESS
!= RegSetValueEx(hkey
, "Content Type", 0, REG_SZ
,
447 (const BYTE
*)aMSMimeType
[ind
], strlen( aMSMimeType
[ind
] ) ) )
451 RegCloseKey(hkey
),hkey
= NULL
;
455 wsprintf( aSubKey
, "%sCLSID\\%s", aPrefix
, aClassID
);
456 if ( aResult
&& ERROR_SUCCESS
== RegCreateKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
)
457 && createKey( hkey
, "EnableFullPage" ) )
459 for( ind
= 0; ind
< SUPPORTED_MSEXT_NUM
; ind
++ )
461 if( nForMSModes
[ind
] & nMode
)
463 wsprintf( aSubKey
, "EnableFullPage\\%s", aMSFileExt
[ind
] );
464 if ( ERROR_SUCCESS
!= RegCreateKey( hkey
, aSubKey
, &hkey1
) )
468 RegCloseKey(hkey1
),hkey1
= NULL
;
476 RegCloseKey(hkey
),hkey
= NULL
;
483 /////////////////////////////////////////////////////////////////////////////
484 // DllUnregisterServerDoc - Removes entries from the system registry
486 STDAPI
DllUnregisterServerDoc( int nMode
, BOOL bForAllUsers
)
491 const char* aPrefix
= aLocalPrefix
; // bForAllUsers ? "" : aLocalPrefix;
493 for( int ind
= 0; ind
< SUPPORTED_MSEXT_NUM
; ind
++ )
495 if( nForMSModes
[ind
] & nMode
)
497 DWORD nSubKeys
= 0, nValues
= 0;
499 wsprintf( aSubKey
, "%sMIME\\DataBase\\Content Type\\%s", aPrefix
, aMSMimeType
[ind
] );
500 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
) )
504 if ( ERROR_SUCCESS
!= RegDeleteValue( hkey
, "Extension" ) )
507 if ( ERROR_SUCCESS
!= RegDeleteValue( hkey
, "CLSID" ) )
510 if ( ERROR_SUCCESS
!= RegQueryInfoKey( hkey
, NULL
, NULL
, NULL
,
511 &nSubKeys
, NULL
, NULL
,
512 &nValues
, NULL
, NULL
, NULL
, NULL
) )
514 RegCloseKey( hkey
), hkey
= NULL
;
519 RegCloseKey( hkey
), hkey
= NULL
;
520 if ( !nSubKeys
&& !nValues
)
521 SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
);
525 wsprintf( aSubKey
, "%s%s", aPrefix
, aMSFileExt
[ind
] );
526 if ( ERROR_SUCCESS
!= RegCreateKey(bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
, &hkey
) )
530 if ( ERROR_SUCCESS
!= RegDeleteValue( hkey
, "Content Type" ) )
533 if ( ERROR_SUCCESS
!= RegQueryInfoKey( hkey
, NULL
, NULL
, NULL
,
534 &nSubKeys
, NULL
, NULL
,
535 &nValues
, NULL
, NULL
, NULL
, NULL
) )
537 RegCloseKey( hkey
), hkey
= NULL
;
542 RegCloseKey( hkey
), hkey
= NULL
;
543 if ( !nSubKeys
&& !nValues
)
544 SHDeleteKey( bForAllUsers
? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
, aSubKey
);
553 STDAPI
DllRegisterServer( void )
555 char pActiveXPath
[1019];
556 HRESULT aResult
= E_FAIL
;
558 HMODULE aCurModule
= GetModuleHandleA( "so_activex.dll" );
559 if( aCurModule
&& GetModuleFileNameA( aCurModule
, pActiveXPath
, 1019 ) )
561 aResult
= DllRegisterServerNative( 31, TRUE
, pActiveXPath
);
562 if( SUCCEEDED( aResult
) )
563 aResult
= DllRegisterServerDoc( 31, TRUE
);
566 aResult
= DllRegisterServerNative( 31, FALSE
, pActiveXPath
);
567 if( SUCCEEDED( aResult
) )
568 aResult
= DllRegisterServerDoc( 31, FALSE
);
575 STDAPI
DllUnregisterServer( void )
577 DllUnregisterServerDoc( 63, FALSE
);
578 DllUnregisterServerNative( 63, FALSE
);
579 DllUnregisterServerDoc( 63, TRUE
);
580 return DllUnregisterServerNative( 63, TRUE
);