Commit 5b0ace1c authored by Slava Monich's avatar Slava Monich Committed by Alexandre Julliard

On Windows property sheet has DWL_USER dword pointing to a structure

that starts with HWND and PROPSHEETHEADER fields.
parent fb8934d4
...@@ -46,10 +46,11 @@ typedef struct tagPropPageInfo ...@@ -46,10 +46,11 @@ typedef struct tagPropPageInfo
typedef struct tagPropSheetInfo typedef struct tagPropSheetInfo
{ {
HWND hwnd;
PROPSHEETHEADERA ppshheader;
LPSTR strPropertiesFor; LPSTR strPropertiesFor;
int nPages; int nPages;
int active_page; int active_page;
LPPROPSHEETHEADERA ppshheader;
BOOL isModeless; BOOL isModeless;
BOOL hasHelp; BOOL hasHelp;
BOOL hasApply; BOOL hasApply;
...@@ -143,6 +144,7 @@ DEFAULT_DEBUG_CHANNEL(propsheet) ...@@ -143,6 +144,7 @@ DEFAULT_DEBUG_CHANNEL(propsheet)
static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh, static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh,
PropSheetInfo * psInfo) PropSheetInfo * psInfo)
{ {
DWORD dwSize = min(lppsh->dwSize,sizeof(PROPSHEETHEADERA));
DWORD dwFlags = lppsh->dwFlags; DWORD dwFlags = lppsh->dwFlags;
psInfo->hasHelp = dwFlags & PSH_HASHELP; psInfo->hasHelp = dwFlags & PSH_HASHELP;
...@@ -150,11 +152,10 @@ static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh, ...@@ -150,11 +152,10 @@ static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh,
psInfo->useCallback = dwFlags & PSH_USECALLBACK; psInfo->useCallback = dwFlags & PSH_USECALLBACK;
psInfo->isModeless = dwFlags & PSH_MODELESS; psInfo->isModeless = dwFlags & PSH_MODELESS;
psInfo->ppshheader = COMCTL32_Alloc(sizeof(PROPSHEETHEADERA)); memcpy(&psInfo->ppshheader,lppsh,dwSize);
*psInfo->ppshheader = *lppsh;
if (HIWORD(lppsh->pszCaption)) if (HIWORD(lppsh->pszCaption))
psInfo->ppshheader->pszCaption = HEAP_strdupA( GetProcessHeap(), psInfo->ppshheader.pszCaption = HEAP_strdupA( GetProcessHeap(),
0, lppsh->pszCaption ); 0, lppsh->pszCaption );
psInfo->nPages = lppsh->nPages; psInfo->nPages = lppsh->nPages;
...@@ -395,7 +396,7 @@ BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo) ...@@ -395,7 +396,7 @@ BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
DWORD resSize; DWORD resSize;
WORD resID = IDD_PROPSHEET; WORD resID = IDD_PROPSHEET;
if (psInfo->ppshheader->dwFlags & PSH_WIZARD) if (psInfo->ppshheader.dwFlags & PSH_WIZARD)
resID = IDD_WIZARD; resID = IDD_WIZARD;
if(!(hRes = FindResourceA(COMCTL32_hModule, if(!(hRes = FindResourceA(COMCTL32_hModule,
...@@ -419,16 +420,16 @@ BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo) ...@@ -419,16 +420,16 @@ BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
memcpy(temp, template, resSize); memcpy(temp, template, resSize);
if (psInfo->useCallback) if (psInfo->useCallback)
(*(psInfo->ppshheader->pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp); (*(psInfo->ppshheader.pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp);
ret = CreateDialogIndirectParamA(psInfo->ppshheader->hInstance, ret = CreateDialogIndirectParamA(psInfo->ppshheader.hInstance,
(LPDLGTEMPLATEA) temp, (LPDLGTEMPLATEA) temp,
psInfo->ppshheader->hwndParent, psInfo->ppshheader.hwndParent,
(DLGPROC) PROPSHEET_DialogProc, (DLGPROC) PROPSHEET_DialogProc,
(LPARAM)psInfo); (LPARAM)psInfo);
if (!(psInfo->ppshheader->dwFlags & PSH_MODELESS)) if (!(psInfo->ppshheader.dwFlags & PSH_MODELESS))
ret = PROPSHEET_DoDialogBox((HWND)ret, psInfo->ppshheader->hwndParent); ret = PROPSHEET_DoDialogBox((HWND)ret, psInfo->ppshheader.hwndParent);
COMCTL32_Free(temp); COMCTL32_Free(temp);
...@@ -1052,7 +1053,7 @@ static int PROPSHEET_CreatePage(HWND hwndParent, ...@@ -1052,7 +1053,7 @@ static int PROPSHEET_CreatePage(HWND hwndParent,
pageWidth = rc.right - rc.left; pageWidth = rc.right - rc.left;
pageHeight = rc.bottom - rc.top; pageHeight = rc.bottom - rc.top;
if (psInfo->ppshheader->dwFlags & PSH_WIZARD) if (psInfo->ppshheader.dwFlags & PSH_WIZARD)
padding = PROPSHEET_GetPaddingInfoWizard(hwndParent); padding = PROPSHEET_GetPaddingInfoWizard(hwndParent);
else else
{ {
...@@ -1114,7 +1115,7 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo) ...@@ -1114,7 +1115,7 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
ShowWindow(psInfo->proppage[index].hwndPage, SW_SHOW); ShowWindow(psInfo->proppage[index].hwndPage, SW_SHOW);
if (!(psInfo->ppshheader->dwFlags & PSH_WIZARD)) if (!(psInfo->ppshheader.dwFlags & PSH_WIZARD))
{ {
HWND hwndTabCtrl; HWND hwndTabCtrl;
...@@ -1563,7 +1564,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText) ...@@ -1563,7 +1564,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
char szTitle[256]; char szTitle[256];
if (HIWORD(lpszText) == 0) { if (HIWORD(lpszText) == 0) {
if (!LoadStringA(psInfo->ppshheader->hInstance, if (!LoadStringA(psInfo->ppshheader.hInstance,
LOWORD(lpszText), szTitle, sizeof(szTitle)-1)) LOWORD(lpszText), szTitle, sizeof(szTitle)-1))
return; return;
lpszText = szTitle; lpszText = szTitle;
...@@ -1869,10 +1870,8 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) ...@@ -1869,10 +1870,8 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
PropSheetInfoStr); PropSheetInfoStr);
TRACE("\n"); TRACE("\n");
if (HIWORD(psInfo->ppshheader->pszCaption)) if (HIWORD(psInfo->ppshheader.pszCaption))
HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->ppshheader->pszCaption); HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->ppshheader.pszCaption);
COMCTL32_Free((LPVOID)psInfo->ppshheader);
for (i = 0; i < psInfo->nPages; i++) for (i = 0; i < psInfo->nPages; i++)
{ {
...@@ -1912,12 +1911,12 @@ INT WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) ...@@ -1912,12 +1911,12 @@ INT WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
psInfo->proppage = (PropPageInfo*) COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->proppage = (PropPageInfo*) COMCTL32_Alloc(sizeof(PropPageInfo) *
lppsh->nPages); lppsh->nPages);
pByte = (BYTE*) psInfo->ppshheader->u3.ppsp; pByte = (BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++) for (n = i = 0; i < lppsh->nPages; i++, n++)
{ {
if (!(lppsh->dwFlags & PSH_PROPSHEETPAGE)) if (!(lppsh->dwFlags & PSH_PROPSHEETPAGE))
psInfo->proppage[n].hpage = psInfo->ppshheader->u3.phpage[i]; psInfo->proppage[n].hpage = psInfo->ppshheader.u3.phpage[i];
else else
{ {
psInfo->proppage[n].hpage = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)pByte); psInfo->proppage[n].hpage = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)pByte);
...@@ -2079,29 +2078,38 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -2079,29 +2078,38 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo); SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
/* /*
* psInfo->hwnd is not being used by WINE code - it exists
* for compatibility with "real" Windoze. The same about
* SetWindowLong - WINE is only using the PropSheetInfoStr
* property.
*/
psInfo->hwnd = hwnd;
SetWindowLongA(hwnd,DWL_USER,(LONG)psInfo);
/*
* Small icon in the title bar. * Small icon in the title bar.
*/ */
if ((psInfo->ppshheader->dwFlags & PSH_USEICONID) || if ((psInfo->ppshheader.dwFlags & PSH_USEICONID) ||
(psInfo->ppshheader->dwFlags & PSH_USEHICON)) (psInfo->ppshheader.dwFlags & PSH_USEHICON))
{ {
HICON hIcon; HICON hIcon;
int icon_cx = GetSystemMetrics(SM_CXSMICON); int icon_cx = GetSystemMetrics(SM_CXSMICON);
int icon_cy = GetSystemMetrics(SM_CYSMICON); int icon_cy = GetSystemMetrics(SM_CYSMICON);
if (psInfo->ppshheader->dwFlags & PSH_USEICONID) if (psInfo->ppshheader.dwFlags & PSH_USEICONID)
hIcon = LoadImageA(psInfo->ppshheader->hInstance, hIcon = LoadImageA(psInfo->ppshheader.hInstance,
psInfo->ppshheader->u1.pszIcon, psInfo->ppshheader.u1.pszIcon,
IMAGE_ICON, IMAGE_ICON,
icon_cx, icon_cy, icon_cx, icon_cy,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
else else
hIcon = psInfo->ppshheader->u1.hIcon; hIcon = psInfo->ppshheader.u1.hIcon;
SendMessageA(hwnd, WM_SETICON, 0, hIcon); SendMessageA(hwnd, WM_SETICON, 0, hIcon);
} }
if (psInfo->ppshheader->dwFlags & PSH_USEHICON) if (psInfo->ppshheader.dwFlags & PSH_USEHICON)
SendMessageA(hwnd, WM_SETICON, 0, psInfo->ppshheader->u1.hIcon); SendMessageA(hwnd, WM_SETICON, 0, psInfo->ppshheader.u1.hIcon);
psInfo->strPropertiesFor = strCaption; psInfo->strPropertiesFor = strCaption;
...@@ -2109,7 +2117,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -2109,7 +2117,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PROPSHEET_CreateTabControl(hwnd, psInfo); PROPSHEET_CreateTabControl(hwnd, psInfo);
if (psInfo->ppshheader->dwFlags & PSH_WIZARD) if (psInfo->ppshheader.dwFlags & PSH_WIZARD)
{ {
if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo)) if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo))
{ {
...@@ -2127,7 +2135,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -2127,7 +2135,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
if (psInfo->useCallback) if (psInfo->useCallback)
(*(psInfo->ppshheader->pfnCallback))(hwnd, (*(psInfo->ppshheader.pfnCallback))(hwnd,
PSCB_INITIALIZED, (LPARAM)0); PSCB_INITIALIZED, (LPARAM)0);
idx = psInfo->active_page; idx = psInfo->active_page;
...@@ -2136,22 +2144,22 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -2136,22 +2144,22 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PROPSHEET_SetCurSel(hwnd, idx, psInfo->proppage[idx].hpage); PROPSHEET_SetCurSel(hwnd, idx, psInfo->proppage[idx].hpage);
if (!(psInfo->ppshheader->dwFlags & PSH_WIZARD)) if (!(psInfo->ppshheader.dwFlags & PSH_WIZARD))
SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0); SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
if (!HIWORD(psInfo->ppshheader->pszCaption) && if (!HIWORD(psInfo->ppshheader.pszCaption) &&
psInfo->ppshheader->hInstance) psInfo->ppshheader.hInstance)
{ {
char szText[256]; char szText[256];
if (LoadStringA(psInfo->ppshheader->hInstance, if (LoadStringA(psInfo->ppshheader.hInstance,
(UINT)psInfo->ppshheader->pszCaption, szText, 255)) (UINT)psInfo->ppshheader.pszCaption, szText, 255))
PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader->dwFlags, szText); PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader.dwFlags, szText);
} }
else else
{ {
PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader->dwFlags, PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader.dwFlags,
psInfo->ppshheader->pszCaption); psInfo->ppshheader.pszCaption);
} }
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment