24extern "C" __declspec(dllexport) UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
38 std::wstring sInstallLocation =
GetMsiPropertyW( handle, L
"INSTALLLOCATION" );
39 std::wstring sOfficeDirHostname =
GetMsiPropertyW( handle, L
"OFFICEDIRHOSTNAME_" );
44 bool pathCompletionRequired =
true;
46 if ( wcsstr( sInstallLocation.c_str(), sOfficeDirHostname.c_str() ) )
48 pathCompletionRequired =
false;
54 if ( pathCompletionRequired )
56 std::wstring sManufacturer =
GetMsiPropertyW( handle, L
"Manufacturer" );
57 std::wstring sDefinedName =
GetMsiPropertyW( handle, L
"DEFINEDPRODUCT" );
62 std::wstring sProductKey30 = L
"Software\\" + sManufacturer + L
"\\" + sDefinedName +
63 L
"\\" L
"3.0" L
"\\" + sUpgradeCode;
65 std::wstring sProductKey31 = L
"Software\\" + sManufacturer + L
"\\" + sDefinedName +
66 L
"\\" L
"3.1" L
"\\" + sUpgradeCode;
68 std::wstring sProductKey32 = L
"Software\\" + sManufacturer + L
"\\" + sDefinedName +
69 L
"\\" L
"3.2" L
"\\" + sUpgradeCode;
71 bool oldVersionExists =
false;
73 if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_CURRENT_USER, sProductKey30.c_str(), &hKey ) )
75 oldVersionExists =
true;
78 else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_CURRENT_USER, sProductKey31.c_str(), &hKey ) )
80 oldVersionExists =
true;
83 else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_CURRENT_USER, sProductKey32.c_str(), &hKey ) )
85 oldVersionExists =
true;
88 else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE, sProductKey30.c_str(), &hKey ) )
90 oldVersionExists =
true;
93 else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE, sProductKey31.c_str(), &hKey ) )
95 oldVersionExists =
true;
98 else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE, sProductKey32.c_str(), &hKey ) )
100 oldVersionExists =
true;
104 if ( oldVersionExists )
107 sInstallLocation += sOfficeDirHostname;
109 MsiSetPropertyW(handle, L
"INSTALLLOCATION", sInstallLocation.c_str());
113 return ERROR_SUCCESS;
__declspec(dllexport) UINT __stdcall CompleteInstallPath(MSIHANDLE handle)
static std::wstring GetMsiPropertyW(MSIHANDLE handle, const std::wstring &sProperty)