| OLD | NEW |
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
| 4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
| 5 #include "PluginSystem.h" | 5 #include "PluginSystem.h" |
| 6 #include "PluginFilter.h" | 6 #include "PluginFilter.h" |
| 7 #include "PluginMimeFilterClient.h" | 7 #include "PluginMimeFilterClient.h" |
| 8 #include "PluginClient.h" | 8 #include "PluginClient.h" |
| 9 #include "PluginClientFactory.h" | 9 #include "PluginClientFactory.h" |
| 10 #include "PluginMutex.h" | 10 #include "PluginMutex.h" |
| 11 #include "sddl.h" | 11 #include "sddl.h" |
| 12 #include "PluginUtil.h" | 12 #include "PluginUtil.h" |
| 13 #include "PluginUserSettings.h" | 13 #include "PluginUserSettings.h" |
| 14 #include "../shared/Utils.h" | 14 #include "../shared/Utils.h" |
| 15 #include "../shared/Dictionary.h" | 15 #include "../shared/Dictionary.h" |
| 16 #include <thread> | 16 #include <thread> |
| 17 #include <array> | |
| 18 | 17 |
| 19 #ifdef DEBUG_HIDE_EL | 18 #ifdef DEBUG_HIDE_EL |
| 20 DWORD profileTime = 0; | 19 DWORD profileTime = 0; |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 22 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
| 24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); | 23 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); |
| 25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 24 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
| 26 | 25 |
| 27 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 26 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 408 |
| 410 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); | 409 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); |
| 411 } | 410 } |
| 412 | 411 |
| 413 bool CPluginClass::IsStatusBarEnabled() | 412 bool CPluginClass::IsStatusBarEnabled() |
| 414 { | 413 { |
| 415 DEBUG_GENERAL("IsStatusBarEnabled start"); | 414 DEBUG_GENERAL("IsStatusBarEnabled start"); |
| 416 HKEY pHkey; | 415 HKEY pHkey; |
| 417 HKEY pHkeySub; | 416 HKEY pHkeySub; |
| 418 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); | 417 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); |
| 419 DWORD truth = 1; | 418 DWORD trueth = 1; |
| 420 DWORD truthSize = sizeof(truth); | 419 DWORD truethSize = sizeof(DWORD); |
| 421 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); | 420 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); |
| 422 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&trut
h, &truthSize); | 421 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&true
th, &truethSize); |
| 423 RegCloseKey(pHkey); | 422 RegCloseKey(pHkey); |
| 424 if (res != ERROR_SUCCESS) | 423 if (res != ERROR_SUCCESS) |
| 425 { | 424 { |
| 426 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p
HkeySub); | 425 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p
HkeySub); |
| 427 if (res == ERROR_SUCCESS) | 426 if (res == ERROR_SUCCESS) |
| 428 { | 427 { |
| 429 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*)
&truth, &truthSize); | 428 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*)
&trueth, &truethSize); |
| 430 if (res == ERROR_SUCCESS) | 429 if (res == ERROR_SUCCESS) |
| 431 { | 430 { |
| 432 RegCloseKey(pHkey); | 431 RegCloseKey(pHkey); |
| 433 } | 432 } |
| 434 } | 433 } |
| 435 } | 434 } |
| 436 DEBUG_GENERAL("IsStatusBarEnabled end"); | 435 DEBUG_GENERAL("IsStatusBarEnabled end"); |
| 437 return truth == 1; | 436 return trueth == 1; |
| 438 } | 437 } |
| 439 | 438 |
| 440 void CPluginClass::ShowStatusBar() | 439 void CPluginClass::ShowStatusBar() |
| 441 { | 440 { |
| 442 DEBUG_GENERAL("ShowStatusBar start"); | 441 DEBUG_GENERAL("ShowStatusBar start"); |
| 443 | 442 |
| 444 VARIANT_BOOL isVisible; | 443 VARIANT_BOOL isVisible; |
| 445 | 444 |
| 446 | 445 |
| 447 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 446 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 472 MB_OK); | 471 MB_OK); |
| 473 return; | 472 return; |
| 474 } | 473 } |
| 475 // Ask if a user wants to enable a status bar automatically | 474 // Ask if a user wants to enable a status bar automatically |
| 476 LRESULT res = MessageBox((HWND)m_hTabWnd, | 475 LRESULT res = MessageBox((HWND)m_hTabWnd, |
| 477 dictionary->Lookup("status-bar", "question").c_str(), | 476 dictionary->Lookup("status-bar", "question").c_str(), |
| 478 dictionary->Lookup("status-bar", "title").c_str(), | 477 dictionary->Lookup("status-bar", "title").c_str(), |
| 479 MB_YESNO); | 478 MB_YESNO); |
| 480 if (res == IDYES) | 479 if (res == IDYES) |
| 481 { | 480 { |
| 482 DWORD truth = 1; | 481 DWORD trueth = 1; |
| 483 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M
INIE", &pHkeySub); | 482 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M
INIE", &pHkeySub); |
| 484 regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE
*)&truth, sizeof(truth)); | 483 regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE
*)&trueth, sizeof(DWORD)); |
| 485 regRes = RegCloseKey(pHkeySub); | 484 regRes = RegCloseKey(pHkeySub); |
| 486 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M
ain", &pHkeySub); | 485 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M
ain", &pHkeySub); |
| 487 regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE*
)&truth, sizeof(truth)); | 486 regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE*
)&trueth, sizeof(DWORD)); |
| 488 regRes = RegCloseKey(pHkeySub); | 487 regRes = RegCloseKey(pHkeySub); |
| 489 hr = browser->put_StatusBar(TRUE); | 488 hr = browser->put_StatusBar(TRUE); |
| 490 if (FAILED(hr)) | 489 if (FAILED(hr)) |
| 491 { | 490 { |
| 492 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR,
"Class::Enable statusbar"); | 491 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR,
"Class::Enable statusbar"); |
| 493 } | 492 } |
| 494 CreateStatusBarPane(); | 493 CreateStatusBarPane(); |
| 495 | 494 |
| 496 // We need to restart the tab now, to enable the status bar properly | 495 // We need to restart the tab now, to enable the status bar properly |
| 497 VARIANT vFlags; | 496 VARIANT vFlags; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 798 } |
| 800 } | 799 } |
| 801 } | 800 } |
| 802 s_criticalSectionLocal.Unlock(); | 801 s_criticalSectionLocal.Unlock(); |
| 803 | 802 |
| 804 // Register pane class | 803 // Register pane class |
| 805 if (!GetAtomPaneClass()) | 804 if (!GetAtomPaneClass()) |
| 806 { | 805 { |
| 807 WNDCLASSEX wcex; | 806 WNDCLASSEX wcex; |
| 808 | 807 |
| 809 wcex.cbSize = sizeof(wcex); | 808 wcex.cbSize = sizeof(WNDCLASSEX); |
| 810 wcex.style = 0; | 809 wcex.style = 0; |
| 811 wcex.lpfnWndProc = (WNDPROC)PaneWindowProc; | 810 wcex.lpfnWndProc = (WNDPROC)PaneWindowProc; |
| 812 wcex.cbClsExtra = 0; | 811 wcex.cbClsExtra = 0; |
| 813 wcex.cbWndExtra = 0; | 812 wcex.cbWndExtra = 0; |
| 814 wcex.hInstance = _Module.m_hInst; | 813 wcex.hInstance = _Module.m_hInst; |
| 815 wcex.hIcon = NULL; | 814 wcex.hIcon = NULL; |
| 816 wcex.hCursor = NULL; | 815 wcex.hCursor = NULL; |
| 817 wcex.hbrBackground = NULL; | 816 wcex.hbrBackground = NULL; |
| 818 wcex.lpszMenuName = NULL; | 817 wcex.lpszMenuName = NULL; |
| 819 wcex.lpszClassName = STATUSBAR_PANE_NAME; | 818 wcex.lpszClassName = STATUSBAR_PANE_NAME; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 s_criticalSectionLocal.Unlock(); | 874 s_criticalSectionLocal.Unlock(); |
| 876 return true; | 875 return true; |
| 877 } | 876 } |
| 878 | 877 |
| 879 bool CPluginClass::CreateStatusBarPane() | 878 bool CPluginClass::CreateStatusBarPane() |
| 880 { | 879 { |
| 881 CriticalSection::Lock lock(m_csStatusBar); | 880 CriticalSection::Lock lock(m_csStatusBar); |
| 882 | 881 |
| 883 CPluginClient* client = CPluginClient::GetInstance(); | 882 CPluginClient* client = CPluginClient::GetInstance(); |
| 884 | 883 |
| 885 std::array<wchar_t, MAX_PATH> className; | 884 wchar_t szClassName[MAX_PATH]; |
| 886 // Get browser window and url | 885 // Get browser window and url |
| 887 HWND hBrowserWnd = GetBrowserHWND(); | 886 HWND hBrowserWnd = GetBrowserHWND(); |
| 888 if (!hBrowserWnd) | 887 if (!hBrowserWnd) |
| 889 { | 888 { |
| 890 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C
lass::CreateStatusBarPane - No status bar") | 889 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C
lass::CreateStatusBarPane - No status bar") |
| 891 return false; | 890 return false; |
| 892 } | 891 } |
| 893 | 892 |
| 894 // Looking for a TabWindowClass window in IE7 | 893 // Looking for a TabWindowClass window in IE7 |
| 895 // the last one should be parent for statusbar | 894 // the last one should be parent for statusbar |
| 896 HWND hWndStatusBar = NULL; | 895 HWND hWndStatusBar = NULL; |
| 897 | 896 |
| 898 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); | 897 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); |
| 899 UINT amoundOfNewTabs = 0; | 898 UINT amoundOfNewTabs = 0; |
| 900 HWND uniqueNewTab = NULL; | 899 HWND uniqueNewTab = NULL; |
| 901 while (hTabWnd) | 900 while (hTabWnd) |
| 902 { | 901 { |
| 903 className[0] = L'\0'; | 902 memset(szClassName, 0, MAX_PATH); |
| 904 // GetClassNameW returns the number of characters without '\0' | 903 GetClassName(hTabWnd, szClassName, MAX_PATH); |
| 905 int classNameLength = GetClassNameW(hTabWnd, className.data(), className.siz
e()); | |
| 906 | 904 |
| 907 if (classNameLength && (wcscmp(className.data(), L"TabWindowClass") == 0 ||
wcscmp(className.data(), L"Frame Tab") == 0)) | 905 if (wcscmp(szClassName, L"TabWindowClass") == 0 || wcscmp(szClassName,L"Fram
e Tab") == 0) |
| 908 { | 906 { |
| 909 // IE8 support | 907 // IE8 support |
| 910 HWND hTabWnd2 = hTabWnd; | 908 HWND hTabWnd2 = hTabWnd; |
| 911 if (wcscmp(className.data(), L"Frame Tab") == 0) | 909 if (wcscmp(szClassName,L"Frame Tab") == 0) |
| 912 { | 910 { |
| 913 hTabWnd2 = ::FindWindowEx(hTabWnd2, NULL, L"TabWindowClass", NULL); | 911 hTabWnd2 = ::FindWindowEx(hTabWnd2, NULL, L"TabWindowClass", NULL); |
| 914 } | 912 } |
| 915 | 913 |
| 916 if (hTabWnd2) | 914 if (hTabWnd2) |
| 917 { | 915 { |
| 918 DWORD nProcessId; | 916 DWORD nProcessId; |
| 919 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); | 917 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); |
| 920 if (::GetCurrentProcessId() == nProcessId) | 918 if (::GetCurrentProcessId() == nProcessId) |
| 921 { | 919 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 948 } | 946 } |
| 949 } | 947 } |
| 950 } | 948 } |
| 951 | 949 |
| 952 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 950 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 953 } | 951 } |
| 954 | 952 |
| 955 HWND hWnd = ::GetWindow(hBrowserWnd, GW_CHILD); | 953 HWND hWnd = ::GetWindow(hBrowserWnd, GW_CHILD); |
| 956 while (hWnd) | 954 while (hWnd) |
| 957 { | 955 { |
| 958 className[0] = L'\0'; | 956 memset(szClassName, 0, MAX_PATH); |
| 959 int classNameLength = GetClassNameW(hWnd, className.data(), className.size()
); | 957 ::GetClassName(hWnd, szClassName, MAX_PATH); |
| 960 | 958 |
| 961 if (classNameLength && wcscmp(className.data(), L"msctls_statusbar32") == 0) | 959 if (wcscmp(szClassName,L"msctls_statusbar32") == 0) |
| 962 { | 960 { |
| 963 hWndStatusBar = hWnd; | 961 hWndStatusBar = hWnd; |
| 964 break; | 962 break; |
| 965 } | 963 } |
| 966 | 964 |
| 967 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); | 965 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); |
| 968 } | 966 } |
| 969 | 967 |
| 970 if (!hWndStatusBar) | 968 if (!hWndStatusBar) |
| 971 { | 969 { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 std::wstring ctext; | 1274 std::wstring ctext; |
| 1277 | 1275 |
| 1278 s_criticalSectionLocal.Lock(); | 1276 s_criticalSectionLocal.Lock(); |
| 1279 { | 1277 { |
| 1280 s_menuDomains.clear(); | 1278 s_menuDomains.clear(); |
| 1281 } | 1279 } |
| 1282 s_criticalSectionLocal.Unlock(); | 1280 s_criticalSectionLocal.Unlock(); |
| 1283 | 1281 |
| 1284 Dictionary* dictionary = Dictionary::GetInstance(); | 1282 Dictionary* dictionary = Dictionary::GetInstance(); |
| 1285 | 1283 |
| 1286 MENUITEMINFOW fmii = {}; | 1284 MENUITEMINFOW fmii; |
| 1287 fmii.cbSize = sizeof(fmii); | 1285 memset(&fmii, 0, sizeof(MENUITEMINFO)); |
| 1286 fmii.cbSize = sizeof(MENUITEMINFO); |
| 1288 | 1287 |
| 1289 MENUITEMINFOW miiSep = {}; | 1288 MENUITEMINFOW miiSep; |
| 1290 miiSep.cbSize = sizeof(miiSep); | 1289 memset(&miiSep, 0, sizeof(MENUITEMINFO)); |
| 1290 miiSep.cbSize = sizeof(MENUITEMINFO); |
| 1291 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE; | 1291 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE; |
| 1292 miiSep.fType = MFT_SEPARATOR; | 1292 miiSep.fType = MFT_SEPARATOR; |
| 1293 | 1293 |
| 1294 CPluginClient* client = CPluginClient::GetInstance(); | 1294 CPluginClient* client = CPluginClient::GetInstance(); |
| 1295 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1295 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1296 { | 1296 { |
| 1297 ctext = dictionary->Lookup("menu", "menu-disable-on-site"); | 1297 ctext = dictionary->Lookup("menu", "menu-disable-on-site"); |
| 1298 // Is domain in white list? | 1298 // Is domain in white list? |
| 1299 ReplaceString(ctext, L"?1?", client->GetHostFromUrl(to_wstring(url))); | 1299 ReplaceString(ctext, L"?1?", client->GetHostFromUrl(to_wstring(url))); |
| 1300 if (client->IsWhitelistedUrl(to_wstring(GetTab()->GetDocumentUrl()))) | 1300 if (client->IsWhitelistedUrl(to_wstring(GetTab()->GetDocumentUrl()))) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 DWORD nProcessId; | 1375 DWORD nProcessId; |
| 1376 ::GetWindowThreadProcessId(hWndToolBar, &nProcessId); | 1376 ::GetWindowThreadProcessId(hWndToolBar, &nProcessId); |
| 1377 | 1377 |
| 1378 if (hWndToolBar && ::GetCurrentProcessId() == nProcessId) | 1378 if (hWndToolBar && ::GetCurrentProcessId() == nProcessId) |
| 1379 { | 1379 { |
| 1380 ::ScreenToClient(hWndToolBar, &pt); | 1380 ::ScreenToClient(hWndToolBar, &pt); |
| 1381 int nButton = (int)::SendMessage(hWndToolBar, TB_HITTEST, 0, (LPARAM)&pt); | 1381 int nButton = (int)::SendMessage(hWndToolBar, TB_HITTEST, 0, (LPARAM)&pt); |
| 1382 | 1382 |
| 1383 if (nButton > 0) | 1383 if (nButton > 0) |
| 1384 { | 1384 { |
| 1385 TBBUTTON pTBBtn = {}; | 1385 TBBUTTON pTBBtn; |
| 1386 memset(&pTBBtn, 0, sizeof(TBBUTTON)); |
| 1386 | 1387 |
| 1387 if (SendMessage(hWndToolBar, TB_GETBUTTON, nButton, (LPARAM)&pTBBtn)) | 1388 if (SendMessage(hWndToolBar, TB_GETBUTTON, nButton, (LPARAM)&pTBBtn)) |
| 1388 { | 1389 { |
| 1389 RECT rcButton; | 1390 RECT rcButton; |
| 1390 nIDCommand = pTBBtn.idCommand; | 1391 nIDCommand = pTBBtn.idCommand; |
| 1391 | 1392 |
| 1392 if (SendMessage(hWndToolBar, TB_GETRECT, nIDCommand, (LPARAM)&rcButton)) | 1393 if (SendMessage(hWndToolBar, TB_GETRECT, nIDCommand, (LPARAM)&rcButton)) |
| 1393 { | 1394 { |
| 1394 pt.x = rcButton.left; | 1395 pt.x = rcButton.left; |
| 1395 pt.y = rcButton.bottom; | 1396 pt.y = rcButton.bottom; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 return icon; | 1798 return icon; |
| 1798 } | 1799 } |
| 1799 | 1800 |
| 1800 ATOM CPluginClass::GetAtomPaneClass() | 1801 ATOM CPluginClass::GetAtomPaneClass() |
| 1801 { | 1802 { |
| 1802 return s_atomPaneClass; | 1803 return s_atomPaneClass; |
| 1803 } | 1804 } |
| 1804 | 1805 |
| 1805 HWND CPluginClass::GetTabHWND() const | 1806 HWND CPluginClass::GetTabHWND() const |
| 1806 { | 1807 { |
| 1807 std::array<wchar_t, MAX_PATH> className; | 1808 wchar_t szClassName[MAX_PATH]; |
| 1808 // Get browser window and url | 1809 // Get browser window and url |
| 1809 HWND hBrowserWnd = GetBrowserHWND(); | 1810 HWND hBrowserWnd = GetBrowserHWND(); |
| 1810 if (!hBrowserWnd) | 1811 if (!hBrowserWnd) |
| 1811 { | 1812 { |
| 1812 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C
lass::GetTabWindow - No tab window") | 1813 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C
lass::GetTabWindow - No tab window") |
| 1813 s_criticalSectionWindow.Unlock(); | 1814 s_criticalSectionWindow.Unlock(); |
| 1814 | 1815 |
| 1815 return false; | 1816 return false; |
| 1816 } | 1817 } |
| 1817 | 1818 |
| 1818 // Looking for a TabWindowClass window in IE7 | 1819 // Looking for a TabWindowClass window in IE7 |
| 1819 | 1820 |
| 1820 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); | 1821 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); |
| 1821 while (hTabWnd) | 1822 while (hTabWnd) |
| 1822 { | 1823 { |
| 1823 className[0] = L'\0'; | 1824 memset(szClassName, 0, MAX_PATH); |
| 1824 int classNameLength = GetClassNameW(hTabWnd, className.data(), className.siz
e()); | 1825 GetClassName(hTabWnd, szClassName, MAX_PATH); |
| 1825 | 1826 |
| 1826 if (classNameLength && (wcscmp(className.data(), L"TabWindowClass") == 0 ||
wcscmp(className.data(), L"Frame Tab") == 0)) | 1827 if (wcscmp(szClassName, L"TabWindowClass") == 0 || wcscmp(szClassName, L"Fra
me Tab") == 0) |
| 1827 { | 1828 { |
| 1828 // IE8 support | 1829 // IE8 support |
| 1829 HWND hTabWnd2 = hTabWnd; | 1830 HWND hTabWnd2 = hTabWnd; |
| 1830 if (wcscmp(className.data(), L"Frame Tab") == 0) | 1831 if (wcscmp(szClassName, L"Frame Tab") == 0) |
| 1831 { | 1832 { |
| 1832 hTabWnd2 = ::FindWindowEx(hTabWnd2, NULL, L"TabWindowClass", NULL); | 1833 hTabWnd2 = ::FindWindowEx(hTabWnd2, NULL, L"TabWindowClass", NULL); |
| 1833 } | 1834 } |
| 1834 | 1835 |
| 1835 if (hTabWnd2) | 1836 if (hTabWnd2) |
| 1836 { | 1837 { |
| 1837 DWORD nProcessId; | 1838 DWORD nProcessId; |
| 1838 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); | 1839 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); |
| 1839 if (::GetCurrentProcessId() == nProcessId) | 1840 if (::GetCurrentProcessId() == nProcessId) |
| 1840 { | 1841 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1864 } | 1865 } |
| 1865 } | 1866 } |
| 1866 } | 1867 } |
| 1867 | 1868 |
| 1868 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1869 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 1869 } | 1870 } |
| 1870 | 1871 |
| 1871 return hTabWnd; | 1872 return hTabWnd; |
| 1872 | 1873 |
| 1873 } | 1874 } |
| OLD | NEW |