Titles in wizards

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

The title of Cygwin Setup utility (http://www.cygwin.com/setup.exe) is
displayed as garbage.  I've traced the problem to property sheets.

MSDN says that pszCaption should be ignored for wizards, which wasn't
done.  Since the PROPSHEETHEADER structure is copied, it's safe to replace
pszCaption with NULL afterward, as if that part of the structure wasn't
copied.  I think it's the safest approach because setup.exe actually puts
garbage there, and it's unsafe to dereference.

That's the changes in PROPSHEET_CollectSheetInfo[AW].  Also, the title is
not updated when the pages are changed.  It turns out that the titles for
individual pages are prepared in PROPSHEET_CollectPageInfo() but never
get displayed.  With this patch, they are displayed in
PROPSHEET_ShowPage().

ChangeLog:
	* dlls/comctl32/propsheet.c:
	Ignore window caption from PROPSHEETHEADER in wizards.  Update
	window caption when changing pages.

-- 
Regards,
Pavel Roskin
--- dlls/comctl32/propsheet.c
+++ dlls/comctl32/propsheet.c
@@ -305,12 +305,17 @@ static BOOL PROPSHEET_CollectSheetInfoA(
 
   PROPSHEET_UnImplementedFlags(lppsh->dwFlags);
 
-  if (HIWORD(lppsh->pszCaption))
+  if (lppsh->dwFlags & INTRNL_ANY_WIZARD)
+     psInfo->ppshheader.pszCaption = NULL;
+  else
   {
-     int len = strlen(lppsh->pszCaption);
-     psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) );
-     MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len+1);
-     /* strcpy( (char *)psInfo->ppshheader.pszCaption, lppsh->pszCaption ); */
+     if (HIWORD(lppsh->pszCaption))
+     {
+        int len = strlen(lppsh->pszCaption);
+        psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) );
+        MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len+1);
+        /* strcpy( (char *)psInfo->ppshheader.pszCaption, lppsh->pszCaption ); */
+     }
   }
   psInfo->nPages = lppsh->nPages;
 
@@ -355,11 +360,16 @@ static BOOL PROPSHEET_CollectSheetInfoW(
 
   PROPSHEET_UnImplementedFlags(lppsh->dwFlags);
 
-  if (HIWORD(lppsh->pszCaption))
+  if (lppsh->dwFlags & INTRNL_ANY_WIZARD)
+     psInfo->ppshheader.pszCaption = NULL;
+  else
   {
-     int len = strlenW(lppsh->pszCaption);
-     psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
-     strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption );
+     if (!(lppsh->dwFlags & INTRNL_ANY_WIZARD) && HIWORD(lppsh->pszCaption))
+     {
+        int len = strlenW(lppsh->pszCaption);
+        psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
+        strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption );
+     }
   }
   psInfo->nPages = lppsh->nPages;
 
@@ -1554,6 +1564,9 @@ static BOOL PROPSHEET_ShowPage(HWND hwnd
      PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
   }
 
+  PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
+                      psInfo->proppage[index].pszText);
+
   if (psInfo->active_page != -1)
      ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE);
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux