reg4allmsi.cxx (599cc5b4) | reg4allmsi.cxx (c36aa0f1) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24#ifdef _MSC_VER 25#pragma warning(push, 1) /* disable warnings within system headers */ 26#endif | 20 *************************************************************/ 21 22 23 24#ifdef _MSC_VER 25#pragma warning(push, 1) /* disable warnings within system headers */ 26#endif |
27#define WIN32_LEAN_AND_MEAN | 27#define WIN32_LEAN_AND_MEAN |
28#include <windows.h> 29#include <msiquery.h> 30#ifdef _MSC_VER 31#pragma warning(pop) 32#endif 33 34#include <malloc.h> 35#include <string> 36#include <strsafe.h> 37 38//---------------------------------------------------------- 39static const CHAR* g_Extensions[] = 40{ 41 ".doc", // Microsoft Word Text [0] 42 ".dot", // Microsoft Word Template | 28#include <windows.h> 29#include <msiquery.h> 30#ifdef _MSC_VER 31#pragma warning(pop) 32#endif 33 34#include <malloc.h> 35#include <string> 36#include <strsafe.h> 37 38//---------------------------------------------------------- 39static const CHAR* g_Extensions[] = 40{ 41 ".doc", // Microsoft Word Text [0] 42 ".dot", // Microsoft Word Template |
43 ".rtf", // rtf text | 43 ".rtf", // RTF text |
44 ".docx", // Office Word 2007 XML document 45 ".docm", // Office Word 2007 XML macro-enabled document 46 ".dotx", // Office Word 2007 XML template 47 ".dotm", // Office Word 2007 XML macro-enabled template 48 ".xlw", // Microsoft Excel 49 ".xls", // Microsoft Excel 50 ".xlt", // Microsoft Excel Template 51 ".xlsx", // Office Excel 2007 XML workbook 52 ".xlsm", // Office Excel 2007 XML macro-enabled workbook 53 ".xltx", // Office Excel 2007 XML template 54 ".xltm", // Office Excel 2007 XML macro-enabled template 55 ".xlsb", // Office Excel 2007 binary workbook (BIFF12) | 44 ".docx", // Office Word 2007 XML document 45 ".docm", // Office Word 2007 XML macro-enabled document 46 ".dotx", // Office Word 2007 XML template 47 ".dotm", // Office Word 2007 XML macro-enabled template 48 ".xlw", // Microsoft Excel 49 ".xls", // Microsoft Excel 50 ".xlt", // Microsoft Excel Template 51 ".xlsx", // Office Excel 2007 XML workbook 52 ".xlsm", // Office Excel 2007 XML macro-enabled workbook 53 ".xltx", // Office Excel 2007 XML template 54 ".xltm", // Office Excel 2007 XML macro-enabled template 55 ".xlsb", // Office Excel 2007 binary workbook (BIFF12) |
56 ".ppt", // Microsoft Powerpoint 57 ".pps", // Microsoft Powerpoint 58 ".pot", // Microsoft Powerpoint Template | 56 ".ppt", // Microsoft PowerPoint 57 ".pps", // Microsoft PowerPoint 58 ".pot", // Microsoft PowerPoint Template |
59 ".pptx", // Office PowerPoint 2007 XML presentation 60 ".pptm", // Office PowerPoint 2007 macro-enabled XML presentation 61 ".potx", // Office PowerPoint 2007 XML template 62 ".potm", // Office PowerPoint 2007 macro-enabled XML template 63 ".ppsx", // Office PowerPoint 2007 XML show 64 0 65}; 66 --- 37 unchanged lines hidden (view full) --- 104 105 lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); 106 if ( ERROR_SUCCESS == lResult ) 107 { 108 szBuffer[nSize] = '\0'; 109 OutputDebugStringFormat( "Found value [%s] for key [%s].\n", szBuffer, lpSubKey ); 110 111 if ( strncmp( szBuffer, "WordPad.Document.1", 18 ) == 0 ) | 59 ".pptx", // Office PowerPoint 2007 XML presentation 60 ".pptm", // Office PowerPoint 2007 macro-enabled XML presentation 61 ".potx", // Office PowerPoint 2007 XML template 62 ".potm", // Office PowerPoint 2007 macro-enabled XML template 63 ".ppsx", // Office PowerPoint 2007 XML show 64 0 65}; 66 --- 37 unchanged lines hidden (view full) --- 104 105 lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); 106 if ( ERROR_SUCCESS == lResult ) 107 { 108 szBuffer[nSize] = '\0'; 109 OutputDebugStringFormat( "Found value [%s] for key [%s].\n", szBuffer, lpSubKey ); 110 111 if ( strncmp( szBuffer, "WordPad.Document.1", 18 ) == 0 ) |
112 { // We will replace registration for word pad | 112 { // We will replace registration for WordPad |
113 bRet = true; 114 } 115 else if ( strncmp( szBuffer, "OpenOffice.org.", 15 ) == 0 ) 116 { // We will replace registration for our (former) own types, too 117 bRet = true; 118 } 119 else if ( strncmp( szBuffer, "OpenOffice.", 11 ) == 0 ) 120 { // We will replace registration for our own types, too --- 14 unchanged lines hidden (view full) --- 135 while ( ERROR_SUCCESS == lResult ) 136 { 137 nSize = sizeof( szBuffer ); 138 lResult = RegEnumKeyExA( hSubKey, nIndex++, szBuffer, &nSize, NULL, NULL, NULL, NULL ); 139 if ( ERROR_SUCCESS == lResult ) 140 { 141 OutputDebugStringFormat( " Found value [%s] in OpenWithList of [%s].\n", szBuffer, lpSubKey ); 142 if ( strncmp( szBuffer, "WordPad.exe", 11 ) == 0 ) | 113 bRet = true; 114 } 115 else if ( strncmp( szBuffer, "OpenOffice.org.", 15 ) == 0 ) 116 { // We will replace registration for our (former) own types, too 117 bRet = true; 118 } 119 else if ( strncmp( szBuffer, "OpenOffice.", 11 ) == 0 ) 120 { // We will replace registration for our own types, too --- 14 unchanged lines hidden (view full) --- 135 while ( ERROR_SUCCESS == lResult ) 136 { 137 nSize = sizeof( szBuffer ); 138 lResult = RegEnumKeyExA( hSubKey, nIndex++, szBuffer, &nSize, NULL, NULL, NULL, NULL ); 139 if ( ERROR_SUCCESS == lResult ) 140 { 141 OutputDebugStringFormat( " Found value [%s] in OpenWithList of [%s].\n", szBuffer, lpSubKey ); 142 if ( strncmp( szBuffer, "WordPad.exe", 11 ) == 0 ) |
143 { // We will replace registration for word pad | 143 { // We will replace registration for WordPad |
144 bRet = true; 145 } 146 else if ( nSize > 0 ) 147 bRet = false; 148 } 149 } 150 } 151 else --- 15 unchanged lines hidden (view full) --- 167 168//---------------------------------------------------------- 169static LONG DeleteSubKeyTree( HKEY RootKey, LPCSTR lpKey ) 170{ 171 HKEY hKey; 172 LONG rc = RegOpenKeyExA( RootKey, lpKey, 0, KEY_READ | DELETE, &hKey ); 173 174 if (ERROR_SUCCESS == rc) | 144 bRet = true; 145 } 146 else if ( nSize > 0 ) 147 bRet = false; 148 } 149 } 150 } 151 else --- 15 unchanged lines hidden (view full) --- 167 168//---------------------------------------------------------- 169static LONG DeleteSubKeyTree( HKEY RootKey, LPCSTR lpKey ) 170{ 171 HKEY hKey; 172 LONG rc = RegOpenKeyExA( RootKey, lpKey, 0, KEY_READ | DELETE, &hKey ); 173 174 if (ERROR_SUCCESS == rc) |
175 { | 175 { |
176 LPCSTR lpSubKey; 177 DWORD nMaxSubKeyLen; 178 179 rc = RegQueryInfoKeyA( hKey, 0, 0, 0, 0, &nMaxSubKeyLen, 0, 0, 0, 0, 0, 0 ); 180 nMaxSubKeyLen++; // space for trailing '\0' 181 lpSubKey = reinterpret_cast<CHAR*>( _alloca( nMaxSubKeyLen*sizeof(CHAR) ) ); 182 183 while (ERROR_SUCCESS == rc) 184 { 185 DWORD nLen = nMaxSubKeyLen; | 176 LPCSTR lpSubKey; 177 DWORD nMaxSubKeyLen; 178 179 rc = RegQueryInfoKeyA( hKey, 0, 0, 0, 0, &nMaxSubKeyLen, 0, 0, 0, 0, 0, 0 ); 180 nMaxSubKeyLen++; // space for trailing '\0' 181 lpSubKey = reinterpret_cast<CHAR*>( _alloca( nMaxSubKeyLen*sizeof(CHAR) ) ); 182 183 while (ERROR_SUCCESS == rc) 184 { 185 DWORD nLen = nMaxSubKeyLen; |
186 rc = RegEnumKeyExA( hKey, 0, (LPSTR)lpSubKey, &nLen, 0, 0, 0, 0); // always index zero | 186 rc = RegEnumKeyExA( hKey, 0, (LPSTR)lpSubKey, &nLen, 0, 0, 0, 0); // always index zero |
187 188 if ( ERROR_NO_MORE_ITEMS == rc ) 189 { 190 rc = RegDeleteKeyA( RootKey, lpKey ); 191 if ( rc == ERROR_SUCCESS ) 192 OutputDebugStringFormat( "deleted key [%s] from registry.\n", lpKey ); 193 else 194 OutputDebugStringFormat( "RegDeleteKeyA %s returned %ld.\n", lpKey, rc ); --- 30 unchanged lines hidden (view full) --- 225 { 226 lResult = RegOpenKeyExA( hKey, lpSubKey, 0, KEY_QUERY_VALUE, &hSubKey ); 227 228 if ( ERROR_SUCCESS == lResult ) 229 { 230 DWORD nSubKeys = 1; 231 szBuffer[0] = '\0'; 232 | 187 188 if ( ERROR_NO_MORE_ITEMS == rc ) 189 { 190 rc = RegDeleteKeyA( RootKey, lpKey ); 191 if ( rc == ERROR_SUCCESS ) 192 OutputDebugStringFormat( "deleted key [%s] from registry.\n", lpKey ); 193 else 194 OutputDebugStringFormat( "RegDeleteKeyA %s returned %ld.\n", lpKey, rc ); --- 30 unchanged lines hidden (view full) --- 225 { 226 lResult = RegOpenKeyExA( hKey, lpSubKey, 0, KEY_QUERY_VALUE, &hSubKey ); 227 228 if ( ERROR_SUCCESS == lResult ) 229 { 230 DWORD nSubKeys = 1; 231 szBuffer[0] = '\0'; 232 |
233 // we get the value of the default key fist and while we are on querying, | 233 // we get the value of the default key first and while we are on querying, |
234 // we ask for the subkey count, too 235 lResult = RegQueryValueExA( hSubKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); 236 if ( ERROR_SUCCESS == lResult ) 237 RegQueryInfoKeyA( hSubKey, 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0 ); 238 RegCloseKey( hSubKey ); 239 | 234 // we ask for the subkey count, too 235 lResult = RegQueryValueExA( hSubKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); 236 if ( ERROR_SUCCESS == lResult ) 237 RegQueryInfoKeyA( hSubKey, 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0 ); 238 RegCloseKey( hSubKey ); 239 |
240 // we will remove all key with an default value starting with ooostub but | 240 // we will remove all key with a default value starting with ooostub but |
241 // we have to be careful about MSO keys 242 if ( strncmp( szBuffer, "opendocument.", 13 ) == 0 ) 243 { 244 if ( nSubKeys == 0 ) 245 { 246 DeleteSubKeyTree( hKey, lpSubKey ); 247 } 248 else --- 22 unchanged lines hidden (view full) --- 271 { 272 sz++; 273 DWORD nbytes = sz * sizeof(TCHAR); 274 LPSTR buff = reinterpret_cast<LPSTR>(_alloca(nbytes)); 275 ZeroMemory(buff, nbytes); 276 MsiGetPropertyA(handle, name, buff, &sz); 277 value = buff; 278 return true; | 241 // we have to be careful about MSO keys 242 if ( strncmp( szBuffer, "opendocument.", 13 ) == 0 ) 243 { 244 if ( nSubKeys == 0 ) 245 { 246 DeleteSubKeyTree( hKey, lpSubKey ); 247 } 248 else --- 22 unchanged lines hidden (view full) --- 271 { 272 sz++; 273 DWORD nbytes = sz * sizeof(TCHAR); 274 LPSTR buff = reinterpret_cast<LPSTR>(_alloca(nbytes)); 275 ZeroMemory(buff, nbytes); 276 MsiGetPropertyA(handle, name, buff, &sz); 277 value = buff; 278 return true; |
279 } | 279 } |
280 return false; 281} 282 283//---------------------------------------------------------- 284bool IsSetMsiProp( MSIHANDLE handle, LPCSTR name ) 285{ 286 std::string val; 287 GetMsiProp( handle, name, val ); --- 119 unchanged lines hidden (view full) --- 407 if ( bImpressEnabled ) 408 MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" ); 409 } 410 else 411 { 412 if ( bWriterEnabled && ! checkSomeExtensionInRegistry( WORD_START, EXCEL_START ) ) 413 { 414 MsiSetPropertyA( handle, "SELECT_WORD", "1" ); | 280 return false; 281} 282 283//---------------------------------------------------------- 284bool IsSetMsiProp( MSIHANDLE handle, LPCSTR name ) 285{ 286 std::string val; 287 GetMsiProp( handle, name, val ); --- 119 unchanged lines hidden (view full) --- 407 if ( bImpressEnabled ) 408 MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" ); 409 } 410 else 411 { 412 if ( bWriterEnabled && ! checkSomeExtensionInRegistry( WORD_START, EXCEL_START ) ) 413 { 414 MsiSetPropertyA( handle, "SELECT_WORD", "1" ); |
415 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for MicroSoft Word" ); | 415 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft Word" ); |
416 } 417 if ( bCalcEnabled && ! checkSomeExtensionInRegistry( EXCEL_START, POWERPOINT_START ) ) 418 { 419 MsiSetPropertyA( handle, "SELECT_EXCEL", "1" ); | 416 } 417 if ( bCalcEnabled && ! checkSomeExtensionInRegistry( EXCEL_START, POWERPOINT_START ) ) 418 { 419 MsiSetPropertyA( handle, "SELECT_EXCEL", "1" ); |
420 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for MicroSoft Excel" ); | 420 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft Excel" ); |
421 } 422 if ( bImpressEnabled && ! checkSomeExtensionInRegistry( POWERPOINT_START, POWERPOINT_END ) ) 423 { 424 MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" ); | 421 } 422 if ( bImpressEnabled && ! checkSomeExtensionInRegistry( POWERPOINT_START, POWERPOINT_END ) ) 423 { 424 MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" ); |
425 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for MicroSoft PowerPoint" ); | 425 OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft PowerPoint" ); |
426 } 427 } 428 } 429 430 MsiSetPropertyA( handle, "FILETYPEDIALOGUSED", "1" ); 431 432 return ERROR_SUCCESS; 433} 434 435//---------------------------------------------------------- 436extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle ) 437{ 438 OutputDebugStringFormat( "RegisterSomeExtensions: " ); 439 440 if ( IsSetMsiProp( handle, "SELECT_WORD" ) ) 441 { 442 registerSomeExtensions( handle, WORD_START, EXCEL_START, true ); 443 MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_LOCAL ); | 426 } 427 } 428 } 429 430 MsiSetPropertyA( handle, "FILETYPEDIALOGUSED", "1" ); 431 432 return ERROR_SUCCESS; 433} 434 435//---------------------------------------------------------- 436extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle ) 437{ 438 OutputDebugStringFormat( "RegisterSomeExtensions: " ); 439 440 if ( IsSetMsiProp( handle, "SELECT_WORD" ) ) 441 { 442 registerSomeExtensions( handle, WORD_START, EXCEL_START, true ); 443 MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_LOCAL ); |
444 OutputDebugStringFormat( "RegisterSomeExtensions: Register for MicroSoft Word" ); | 444 OutputDebugStringFormat( "RegisterSomeExtensions: Register for Microsoft Word" ); |
445 } 446 else 447 { 448 registerSomeExtensions( handle, WORD_START, EXCEL_START, false ); 449 MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_ABSENT ); 450 } 451 452 if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) ) 453 { 454 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true ); 455 MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_LOCAL ); | 445 } 446 else 447 { 448 registerSomeExtensions( handle, WORD_START, EXCEL_START, false ); 449 MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_ABSENT ); 450 } 451 452 if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) ) 453 { 454 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true ); 455 MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_LOCAL ); |
456 OutputDebugStringFormat( "RegisterSomeExtensions: Register for MicroSoft Excel" ); | 456 OutputDebugStringFormat( "RegisterSomeExtensions: Register for Microsoft Excel" ); |
457 } 458 else 459 { 460 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, false ); 461 MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_ABSENT ); 462 } 463 464 if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) ) 465 { 466 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, true ); 467 MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_LOCAL ); | 457 } 458 else 459 { 460 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, false ); 461 MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_ABSENT ); 462 } 463 464 if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) ) 465 { 466 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, true ); 467 MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_LOCAL ); |
468 OutputDebugStringFormat( "RegisterSomeExtensions: Register for MicroSoft PowerPoint" ); | 468 OutputDebugStringFormat( "RegisterSomeExtensions: Register for Microsoft PowerPoint" ); |
469 } 470 else 471 { 472 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, false ); 473 MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_ABSENT ); 474 } 475 476 return ERROR_SUCCESS; --- 4 unchanged lines hidden (view full) --- 481{ 482 if ( IsSetMsiProp( handle, "FILETYPEDIALOGUSED" ) ) 483 { 484 OutputDebugStringFormat( "FindRegisteredExtensions: FILETYPEDIALOGUSED!" ); 485 return ERROR_SUCCESS; 486 } 487 488 OutputDebugStringFormat( "FindRegisteredExtensions:" ); | 469 } 470 else 471 { 472 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, false ); 473 MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_ABSENT ); 474 } 475 476 return ERROR_SUCCESS; --- 4 unchanged lines hidden (view full) --- 481{ 482 if ( IsSetMsiProp( handle, "FILETYPEDIALOGUSED" ) ) 483 { 484 OutputDebugStringFormat( "FindRegisteredExtensions: FILETYPEDIALOGUSED!" ); 485 return ERROR_SUCCESS; 486 } 487 488 OutputDebugStringFormat( "FindRegisteredExtensions:" ); |
489 | 489 |
490 bool bRegisterAll = IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" ); 491 492 if ( IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" ) ) 493 { 494 OutputDebugStringFormat( "FindRegisteredExtensions: Register none!" ); 495 return ERROR_SUCCESS; 496 } 497 else if ( bRegisterAll ) 498 OutputDebugStringFormat( "FindRegisteredExtensions: Force all on" ); 499 else 500 OutputDebugStringFormat( "FindRegisteredExtensions: " ); 501 | 490 bool bRegisterAll = IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" ); 491 492 if ( IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" ) ) 493 { 494 OutputDebugStringFormat( "FindRegisteredExtensions: Register none!" ); 495 return ERROR_SUCCESS; 496 } 497 else if ( bRegisterAll ) 498 OutputDebugStringFormat( "FindRegisteredExtensions: Force all on" ); 499 else 500 OutputDebugStringFormat( "FindRegisteredExtensions: " ); 501 |
502 // setting the msi properties SELECT_* will force registering for all corresponding | 502 // setting the msi properties SELECT_* will force registering for all corresponding |
503 // file types 504 if ( IsSetMsiProp( handle, "SELECT_WORD" ) ) 505 registerSomeExtensions( handle, WORD_START, EXCEL_START, true ); 506 if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) ) 507 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true ); 508 if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) ) 509 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, true ); 510 511 registerForExtensions( handle, bRegisterAll ); 512 513 return ERROR_SUCCESS; 514} 515 516//---------------------------------------------------------- 517extern "C" UINT __stdcall DeleteRegisteredExtensions( MSIHANDLE /*handle*/ ) | 503 // file types 504 if ( IsSetMsiProp( handle, "SELECT_WORD" ) ) 505 registerSomeExtensions( handle, WORD_START, EXCEL_START, true ); 506 if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) ) 507 registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true ); 508 if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) ) 509 registerSomeExtensions( handle, POWERPOINT_START, POWERPOINT_END, true ); 510 511 registerForExtensions( handle, bRegisterAll ); 512 513 return ERROR_SUCCESS; 514} 515 516//---------------------------------------------------------- 517extern "C" UINT __stdcall DeleteRegisteredExtensions( MSIHANDLE /*handle*/ ) |
518{ | 518{ |
519 OutputDebugStringFormat( "DeleteRegisteredExtensions\n" ); 520 521 // remove all file extensions 522 int nIndex = 0; 523 while ( g_Extensions[nIndex] != 0 ) 524 { 525 RemoveExtensionInRegistry( g_Extensions[nIndex] ); 526 ++nIndex; 527 } 528 529 return ERROR_SUCCESS; 530} | 519 OutputDebugStringFormat( "DeleteRegisteredExtensions\n" ); 520 521 // remove all file extensions 522 int nIndex = 0; 523 while ( g_Extensions[nIndex] != 0 ) 524 { 525 RemoveExtensionInRegistry( g_Extensions[nIndex] ); 526 ++nIndex; 527 } 528 529 return ERROR_SUCCESS; 530} |