Commit cc6d2f90 authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Don't use the template member unless the corresponding flag is set.

parent fd40e89f
/* TODO : WS_CLIPCHILDREN in cdlg*.h
fix CHOOSECOLORW (lpCustColor) */
/* /*
* COMMDLG - Color Dialog * COMMDLG - Color Dialog
* *
...@@ -1451,9 +1449,7 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol ) ...@@ -1451,9 +1449,7 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
{ {
BOOL ret; BOOL ret;
WCHAR *wstr = NULL; LPCHOOSECOLORW lpcc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW));
LPCHOOSECOLORW lpcc = HeapAlloc( GetProcessHeap(), 0, sizeof(CHOOSECOLORW));
lpcc->lStructSize = sizeof(*lpcc); lpcc->lStructSize = sizeof(*lpcc);
lpcc->hwndOwner = lpChCol->hwndOwner; lpcc->hwndOwner = lpChCol->hwndOwner;
lpcc->hInstance = lpChCol->hInstance; lpcc->hInstance = lpChCol->hInstance;
...@@ -1462,15 +1458,14 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol ) ...@@ -1462,15 +1458,14 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
lpcc->Flags = lpChCol->Flags; lpcc->Flags = lpChCol->Flags;
lpcc->lCustData = lpChCol->lCustData; lpcc->lCustData = lpChCol->lCustData;
lpcc->lpfnHook = (LPCCHOOKPROC) lpChCol->lpfnHook; lpcc->lpfnHook = (LPCCHOOKPROC) lpChCol->lpfnHook;
if (lpChCol->lpTemplateName) if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName))
wstr = HEAP_strdupAtoW( GetProcessHeap(), 0, lpChCol->lpTemplateName); lpcc->lpTemplateName = HEAP_strdupAtoW(GetProcessHeap(), 0, lpChCol->lpTemplateName);
lpcc->lpTemplateName = wstr;
ret = ChooseColorW(lpcc); ret = ChooseColorW(lpcc);
if ( ret ) if (ret)
lpChCol->rgbResult = lpcc->rgbResult; lpChCol->rgbResult = lpcc->rgbResult;
if ( wstr ) HeapFree( GetProcessHeap(), 0, wstr); if (lpcc->lpTemplateName) HeapFree(GetProcessHeap(), 0, lpcc->lpTemplateName);
HeapFree( GetProcessHeap(), 0, lpcc ); HeapFree(GetProcessHeap(), 0, lpcc);
return ret; return ret;
} }
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