Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: Shared/PluginClass.cpp

Issue 9422198: Exe updater support and bug fixes (Closed)
Patch Set: Created Feb. 28, 2013, 10:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Shared/Config.h ('k') | Shared/PluginClassThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginDictionary.h" 4 #include "PluginDictionary.h"
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 #include "PluginSystem.h" 6 #include "PluginSystem.h"
7 #ifdef SUPPORT_FILTER 7 #ifdef SUPPORT_FILTER
8 #include "PluginFilter.h" 8 #include "PluginFilter.h"
9 #endif 9 #endif
10 #include "PluginMimeFilterClient.h" 10 #include "PluginMimeFilterClient.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 void CPluginClass::LaunchUpdater(const CString& strPath) 272 void CPluginClass::LaunchUpdater(const CString& strPath)
273 { 273 {
274 PROCESS_INFORMATION pi; 274 PROCESS_INFORMATION pi;
275 ::ZeroMemory(&pi, sizeof(pi)); 275 ::ZeroMemory(&pi, sizeof(pi));
276 276
277 STARTUPINFO si; 277 STARTUPINFO si;
278 ::ZeroMemory(&si, sizeof(si)); 278 ::ZeroMemory(&si, sizeof(si));
279 si.cb = sizeof(si); 279 si.cb = sizeof(si);
280 si.wShowWindow = FALSE; 280 si.wShowWindow = FALSE;
281 281 » CString cpath;
282 » CString cpath = _T("\"msiexec.exe\" /i \"") + strPath + _T("\" UPDATEPLU GIN=\"True\""); 282 » if (strPath.Find(L".exe") == strPath.GetLength() - 4)
283 » {
284 » » cpath = strPath;
285 » }
286 » else
287 » {
288 » » cpath = _T("\"msiexec.exe\" /i \"") + strPath + _T("\" UPDATEPLU GIN=\"True\"");
289 » }
283 290
284 if (!::CreateProcess(NULL, cpath.GetBuffer(), NULL, NULL, FALSE, CREATE_ BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi)) 291 if (!::CreateProcess(NULL, cpath.GetBuffer(), NULL, NULL, FALSE, CREATE_ BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi))
285 { 292 {
286 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UPDATER, PLUGIN_E RROR_UPDATER_CREATE_PROCESS, "Class::Updater - Failed to start process"); 293 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UPDATER, PLUGIN_E RROR_UPDATER_CREATE_PROCESS, "Class::Updater - Failed to start process");
287 return; 294 return;
288 } 295 }
289 #ifndef AUTOMATIC_SHUTDOWN 296 #ifndef AUTOMATIC_SHUTDOWN
290 else 297 else
291 { 298 {
292 ::WaitForSingleObject(pi.hProcess, INFINITE); 299 ::WaitForSingleObject(pi.hProcess, INFINITE);
(...skipping 22 matching lines...) Expand all
315 322
316 323
317 324
318 // This gets called when a new browser window is created (which also triggers th e 325 // This gets called when a new browser window is created (which also triggers th e
319 // creation of this object). The pointer passed in should be to a IWebBrowser2 326 // creation of this object). The pointer passed in should be to a IWebBrowser2
320 // interface that represents the browser for the window. 327 // interface that represents the browser for the window.
321 // it is also called when a tab is closed, this unknownSite will be null 328 // it is also called when a tab is closed, this unknownSite will be null
322 // so we should handle that it is called this way several times during a session 329 // so we should handle that it is called this way several times during a session
323 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) 330 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite)
324 { 331 {
325 332 »
326 CPluginSettings* settings = CPluginSettings::GetInstance(); 333 CPluginSettings* settings = CPluginSettings::GetInstance();
327 #ifdef AVAST_ABP 334 #ifdef AVAST_ABP
328 HKEY hkey; 335 HKEY hkey;
329 LONG res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windo ws\\CurrentVersion\\Explorer\\Browser Helper Objects\\{FFCB3198-32F3-4E8B-9539-4 324694ED664}", NULL, KEY_QUERY_VALUE, &hkey); 336 LONG res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windo ws\\CurrentVersion\\Explorer\\Browser Helper Objects\\{FFCB3198-32F3-4E8B-9539-4 324694ED664}", NULL, KEY_QUERY_VALUE, &hkey);
330 if (hkey != NULL) 337 if (hkey != NULL)
331 { 338 {
332 RegCloseKey(hkey); 339 RegCloseKey(hkey);
333 // Decide what to do when there are 2 versions installed 340 // Decide what to do when there are 2 versions installed
334 /* SHANDLE_PTR pBrowserHWnd = NULL; 341 /* SHANDLE_PTR pBrowserHWnd = NULL;
335 CComQIPtr<IWebBrowser2> tmpbrwsr; 342 CComQIPtr<IWebBrowser2> tmpbrwsr;
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 s_hMainThread = handle; 933 s_hMainThread = handle;
927 934
928 ::ResumeThread(handle); 935 ::ResumeThread(handle);
929 } 936 }
930 937
931 return true; 938 return true;
932 } 939 }
933 940
934 bool CPluginClass::CreateStatusBarPane() 941 bool CPluginClass::CreateStatusBarPane()
935 { 942 {
943 CPluginClient* client = CPluginClient::GetInstance();
944
945 if (client->GetIEVersion()< 7)
946
947 return true;
948
936 TCHAR szClassName[MAX_PATH]; 949 TCHAR szClassName[MAX_PATH];
937 950
938 // Get browser window and url 951 // Get browser window and url
939 HWND hBrowserWnd = GetBrowserHWND(); 952 HWND hBrowserWnd = GetBrowserHWND();
940 if (!hBrowserWnd) 953 if (!hBrowserWnd)
941 { 954 {
942 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER , "Class::CreateStatusBarPane - No status bar") 955 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER , "Class::CreateStatusBarPane - No status bar")
943 return false; 956 return false;
944 } 957 }
945 958
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 2180
2168 2181
2169 void CPluginClass::UpdateStatusBar() 2182 void CPluginClass::UpdateStatusBar()
2170 { 2183 {
2171 DEBUG_GENERAL("*** Updating statusbar") 2184 DEBUG_GENERAL("*** Updating statusbar")
2172 2185
2173 if (m_hPaneWnd == NULL) 2186 if (m_hPaneWnd == NULL)
2174 { 2187 {
2175 CreateStatusBarPane(); 2188 CreateStatusBarPane();
2176 } 2189 }
2177 if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE)) 2190 » if (m_hPaneWnd != NULL)
2178 { 2191 {
2179 » » DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_ UI_INVALIDATE_STATUSBAR, "Class::Invalidate statusbar");» 2192 » » if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE))
2193 » » {
2194 » » » DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGI N_ERROR_UI_INVALIDATE_STATUSBAR, "Class::Invalidate statusbar");»
2195 » » }
2180 } 2196 }
2181 } 2197 }
2182 2198
2183 2199
2184 void CPluginClass::Unadvice() 2200 void CPluginClass::Unadvice()
2185 { 2201 {
2186 s_criticalSectionLocal.Lock(); 2202 s_criticalSectionLocal.Lock();
2187 { 2203 {
2188 if (m_isAdviced) 2204 if (m_isAdviced)
2189 { 2205 {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 } 2309 }
2294 } 2310 }
2295 } 2311 }
2296 2312
2297 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 2313 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
2298 } 2314 }
2299 2315
2300 return hTabWnd; 2316 return hTabWnd;
2301 2317
2302 } 2318 }
OLDNEW
« no previous file with comments | « Shared/Config.h ('k') | Shared/PluginClassThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld