diff options
Diffstat (limited to 'shell/source/win32/shlxthandler/propsheets/propsheets.cxx')
-rwxr-xr-x[-rw-r--r--] | shell/source/win32/shlxthandler/propsheets/propsheets.cxx | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index b57a21c1cf82..a45c7967f233 100644..100755 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -48,6 +48,7 @@ #include <string> #include <vector> #include <utility> +#include <strsafe.h> /*--------------------------------------------- @@ -67,6 +68,7 @@ CPropertySheet::CPropertySheet(long RefCnt) : m_RefCnt(RefCnt) { + OutputDebugStringFormat("CPropertySheet::CTor [%d], [%d]", m_RefCnt, g_DllRefCnt ); InterlockedIncrement(&g_DllRefCnt); } @@ -76,6 +78,7 @@ CPropertySheet::CPropertySheet(long RefCnt) : CPropertySheet::~CPropertySheet() { + OutputDebugStringFormat("CPropertySheet::DTor [%d], [%d]", m_RefCnt, g_DllRefCnt ); InterlockedDecrement(&g_DllRefCnt); } @@ -113,6 +116,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::QueryInterface( ULONG STDMETHODCALLTYPE CPropertySheet::AddRef(void) { + OutputDebugStringFormat("CPropertySheet::AddRef [%d]", m_RefCnt ); return InterlockedIncrement(&m_RefCnt); } @@ -122,6 +126,7 @@ ULONG STDMETHODCALLTYPE CPropertySheet::AddRef(void) ULONG STDMETHODCALLTYPE CPropertySheet::Release(void) { + OutputDebugStringFormat("CPropertySheet::Release [%d]", m_RefCnt ); long refcnt = InterlockedDecrement(&m_RefCnt); if (0 == refcnt) @@ -174,41 +179,51 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) { - PROPSHEETPAGE psp; + // Get OS version (we don't need the summary page on Windows Vista or later) + OSVERSIONINFO sInfoOS; - // add the summary property page + ZeroMemory( &sInfoOS, sizeof(OSVERSIONINFO) ); + sInfoOS.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); + GetVersionEx( &sInfoOS ); + bool bIsVistaOrLater = (sInfoOS.dwMajorVersion >= 6); - ZeroMemory(&psp, sizeof(PROPSHEETPAGEA)); + std::wstring proppage_header; - std::wstring proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE); + PROPSHEETPAGE psp; + ZeroMemory(&psp, sizeof(PROPSHEETPAGEA)); + // add the summary property page psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USECALLBACK; psp.hInstance = GetModuleHandle(MODULE_NAME); - psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY); - psp.pszTitle = proppage_header.c_str(); - psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc); psp.lParam = reinterpret_cast<LPARAM>(this); psp.pfnCallback = reinterpret_cast<LPFNPSPCALLBACK>(CPropertySheet::PropPageSummaryCallback); - HPROPSHEETPAGE hPage = CreatePropertySheetPage(&psp); - - // keep this instance alive - // will be released when the - // the page is about to be - // destroyed in the callback - // function + HPROPSHEETPAGE hPage = NULL; - if (hPage) + if ( !bIsVistaOrLater ) { - if (lpfnAddPage(hPage, lParam)) - AddRef(); - else - DestroyPropertySheetPage(hPage); + proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE); + + psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY); + psp.pszTitle = proppage_header.c_str(); + psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc); + + hPage = CreatePropertySheetPage(&psp); + + // keep this instance alive, will be released when the + // the page is about to be destroyed in the callback function + + if (hPage) + { + if (lpfnAddPage(hPage, lParam)) + AddRef(); + else + DestroyPropertySheetPage(hPage); + } } // add the statistics property page - proppage_header = GetResString(IDS_PROPPAGE_STATISTICS_TITLE); psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_STATISTICS); |