| OLD | NEW |
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include "Plugin.h" | 3 #include "Plugin.h" |
| 4 #if (defined PRODUCT_SIMPLEADBLOCK) | 4 #if (defined PRODUCT_SIMPLEADBLOCK) |
| 5 #include "../AdBlocker/AdBlocker_i.c" | 5 #include "../AdBlocker/AdBlocker_i.c" |
| 6 #endif | 6 #endif |
| 7 | 7 |
| 8 #include "PluginClass.h" | 8 #include "PluginClass.h" |
| 9 #include "PluginClient.h" | 9 #include "PluginClient.h" |
| 10 #include "PluginSystem.h" | 10 #include "PluginSystem.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 STDAPI DllRegisterServer(void) | 119 STDAPI DllRegisterServer(void) |
| 120 { | 120 { |
| 121 return _Module.RegisterServer(TRUE); | 121 return _Module.RegisterServer(TRUE); |
| 122 } | 122 } |
| 123 | 123 |
| 124 STDAPI DllUnregisterServer(void) | 124 STDAPI DllUnregisterServer(void) |
| 125 { | 125 { |
| 126 return _Module.UnregisterServer(TRUE); | 126 return _Module.UnregisterServer(TRUE); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void InitPlugin(bool isInstall, CString pluginId) | 129 void InitPlugin(bool isInstall) |
| 130 { | 130 { |
| 131 CPluginSystem* system = CPluginSystem::GetInstance(); | 131 CPluginSystem* system = CPluginSystem::GetInstance(); |
| 132 | 132 |
| 133 CPluginSettings* settings = CPluginSettings::GetInstance(); | 133 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 134 | 134 |
| 135 settings->SetMainProcessId(); | 135 settings->SetMainProcessId(); |
| 136 settings->EraseTab(); | 136 settings->EraseTab(); |
| 137 | 137 |
| 138 settings->Remove(SETTING_PLUGIN_SELFTEST); | 138 settings->Remove(SETTING_PLUGIN_SELFTEST); |
| 139 settings->SetValue(SETTING_PLUGIN_INFO_PANEL, isInstall ? 1 : 2); | 139 settings->SetValue(SETTING_PLUGIN_INFO_PANEL, isInstall ? 1 : 2); |
| 140 | 140 |
| 141 if (!pluginId.IsEmpty()) | |
| 142 { | |
| 143 system->SetPluginId(pluginId); | |
| 144 settings->SetString(SETTING_PLUGIN_ID, pluginId); | |
| 145 } | |
| 146 | 141 |
| 147 settings->SetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0); | |
| 148 settings->Write(); | 142 settings->Write(); |
| 149 | 143 |
| 150 if (isInstall) | 144 if (isInstall) |
| 151 { | 145 { |
| 152 DEBUG_GENERAL( | 146 DEBUG_GENERAL( |
| 153 L"======================================================
==========================\nINSTALLER " + | 147 L"======================================================
==========================\nINSTALLER " + |
| 154 CString(IEPLUGIN_VERSION) + | 148 CString(IEPLUGIN_VERSION) + |
| 155 L"\n====================================================
============================") | 149 L"\n====================================================
============================") |
| 156 } | 150 } |
| 157 else | 151 else |
| (...skipping 19 matching lines...) Expand all Loading... |
| 177 DEBUG_GENERAL("*** Generating config file") | 171 DEBUG_GENERAL("*** Generating config file") |
| 178 CPluginConfig* config = CPluginConfig::GetInstance(); | 172 CPluginConfig* config = CPluginConfig::GetInstance(); |
| 179 config->Create(true); | 173 config->Create(true); |
| 180 #endif | 174 #endif |
| 181 | 175 |
| 182 HKEY hKey = NULL; | 176 HKEY hKey = NULL; |
| 183 DWORD dwDisposition = 0; | 177 DWORD dwDisposition = 0; |
| 184 | 178 |
| 185 DWORD dwResult = NULL; | 179 DWORD dwResult = NULL; |
| 186 | 180 |
| 187 #ifndef SUPPORT_FILTER | |
| 188 dwResult = ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\IE Download
Helper", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDispos
ition); | |
| 189 if (dwResult == ERROR_SUCCESS) | |
| 190 { | |
| 191 CString pluginId = system->GetPluginId(); | |
| 192 | |
| 193 ::RegSetValueEx(hKey, L"PluginId", 0, REG_SZ, (const BYTE*)plugi
nId.GetBuffer(), 2*(pluginId.GetLength() + 1)); | |
| 194 | |
| 195 ::RegCloseKey(hKey); | |
| 196 } | |
| 197 #else if | |
| 198 dwResult = ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\SimpleAdbloc
k", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition
); | |
| 199 if (dwResult == ERROR_SUCCESS) | |
| 200 { | |
| 201 CString pluginId = system->GetPluginId(); | |
| 202 | |
| 203 ::RegSetValueEx(hKey, L"PluginId", 0, REG_SZ, (const BYTE*)plugi
nId.GetBuffer(), 2*(pluginId.GetLength() + 1)); | |
| 204 | |
| 205 ::RegCloseKey(hKey); | |
| 206 } | |
| 207 #endif | |
| 208 // Post async plugin error | 181 // Post async plugin error |
| 209 CPluginError pluginError; | 182 CPluginError pluginError; |
| 210 while (CPluginClientBase::PopFirstPluginError(pluginError)) | 183 while (CPluginClientBase::PopFirstPluginError(pluginError)) |
| 211 { | 184 { |
| 212 CPluginClientBase::LogPluginError(pluginError.GetErrorCode(), pluginErro
r.GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(),
true, pluginError.GetProcessId(), pluginError.GetThreadId()); | 185 CPluginClientBase::LogPluginError(pluginError.GetErrorCode(), pluginErro
r.GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(),
true, pluginError.GetProcessId(), pluginError.GetThreadId()); |
| 213 } | 186 } |
| 214 } | 187 } |
| 215 | 188 |
| 216 // Called from installer | 189 // Called from installer |
| 217 EXTERN_C void STDAPICALLTYPE OnInstall(MSIHANDLE hInstall, MSIHANDLE tmp) | 190 EXTERN_C void STDAPICALLTYPE OnInstall(MSIHANDLE hInstall, MSIHANDLE tmp) |
| 218 { | 191 { |
| 219 | 192 InitPlugin(true); |
| 220 TCHAR szValue[251] = {0}; | |
| 221 | |
| 222 DWORD dwBuffer = 250; | |
| 223 UINT res = MsiGetProperty(hInstall, TEXT("CustomActionData"), szValue, &dwBuf
fer); | |
| 224 | |
| 225 CString pluginId = szValue; | |
| 226 | |
| 227 InitPlugin(true, pluginId); | |
| 228 } | 193 } |
| 229 | 194 |
| 230 // Called from updater | 195 // Called from updater |
| 231 EXTERN_C void STDAPICALLTYPE OnUpdate(void) | 196 EXTERN_C void STDAPICALLTYPE OnUpdate(void) |
| 232 { | 197 { |
| 233 » CString tmp; | 198 » InitPlugin(false); |
| 234 » InitPlugin(false, tmp); | |
| 235 } | 199 } |
| OLD | NEW |