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