From d83d2d26f661a7967b3cbbdb37bc4bc62f644803 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Thu, 21 Nov 2002 23:55:10 +0000 Subject: [PATCH] Make commdlg compile with -DSTRICT. --- dlls/commdlg/Makefile.in | 1 - dlls/commdlg/cdlg.h | 3 ++- dlls/commdlg/cdlg32.c | 2 +- dlls/commdlg/colordlg.c | 4 ++-- dlls/commdlg/filedlg.c | 14 +++++++------- dlls/commdlg/filedlg95.c | 6 +++--- dlls/commdlg/finddlg32.c | 2 +- dlls/commdlg/fontdlg.c | 6 +++--- dlls/commdlg/printdlg.c | 34 ++++++++++++++++++---------------- 9 files changed, 37 insertions(+), 35 deletions(-) diff --git a/dlls/commdlg/Makefile.in b/dlls/commdlg/Makefile.in index dfa0c64e083..4d369cfc7b8 100644 --- a/dlls/commdlg/Makefile.in +++ b/dlls/commdlg/Makefile.in @@ -1,4 +1,3 @@ -EXTRADEFS = -DWINE_NO_STRICT TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ diff --git a/dlls/commdlg/cdlg.h b/dlls/commdlg/cdlg.h index 3f5898cc3cc..fe7d625f6a8 100644 --- a/dlls/commdlg/cdlg.h +++ b/dlls/commdlg/cdlg.h @@ -39,7 +39,8 @@ extern HINSTANCE COMDLG32_hInstance; void COMDLG32_SetCommDlgExtendedError(DWORD err); LPVOID COMDLG32_AllocMem(int size); - +/* handle<-handle16 conversion */ +#define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) /* Find/Replace local definitions */ diff --git a/dlls/commdlg/cdlg32.c b/dlls/commdlg/cdlg32.c index 3f2f5f33afc..4f7dd02290c 100644 --- a/dlls/commdlg/cdlg32.c +++ b/dlls/commdlg/cdlg32.c @@ -70,7 +70,7 @@ static char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n"; BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) { - TRACE("(%08x, %08lx, %p)\n", hInstance, Reason, Reserved); + TRACE("(%p, %08lx, %p)\n", hInstance, Reason, Reserved); switch(Reason) { diff --git a/dlls/commdlg/colordlg.c b/dlls/commdlg/colordlg.c index 5c6a5baf4ad..5b2dc49170a 100644 --- a/dlls/commdlg/colordlg.c +++ b/dlls/commdlg/colordlg.c @@ -1474,14 +1474,14 @@ BOOL WINAPI ChooseColorW( LPCHOOSECOLORW lpChCol ) else if (lpChCol->Flags & CC_ENABLETEMPLATE) { HRSRC hResInfo; - if (!(hResInfo = FindResourceW(lpChCol->hInstance, + if (!(hResInfo = FindResourceW((HINSTANCE)lpChCol->hInstance, lpChCol->lpTemplateName, RT_DIALOGW))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; } - if (!(hDlgTmpl = LoadResource(lpChCol->hInstance, hResInfo)) || + if (!(hDlgTmpl = LoadResource((HINSTANCE)lpChCol->hInstance, hResInfo)) || !(template = LockResource(hDlgTmpl))) { COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index e068f7290a2..71df5b3f408 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -1148,7 +1148,7 @@ void FILEDLG_MapOfnStruct16(LPOPENFILENAME16 ofn16, LPOPENFILENAMEW ofnW, BOOL o memset(&ofnA, 0, sizeof(OPENFILENAMEA)); ofnA.lStructSize = sizeof(OPENFILENAMEA); ofnA.hwndOwner = HWND_32(ofn16->hwndOwner); - ofnA.hInstance = ofn16->hInstance; + ofnA.hInstance = HINSTANCE_32(ofn16->hInstance); if (ofn16->lpstrFilter) ofnA.lpstrFilter = MapSL(ofn16->lpstrFilter); if (ofn16->lpstrCustomFilter) @@ -1299,7 +1299,7 @@ BOOL WINAPI GetFileName31A( lfs = FILEDLG_AllocPrivate((LPARAM) lpofn, LFS32A, dlgType); if (lfs) { - hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); + hInst = (HINSTANCE)GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner, FileOpenDlgProc, (LPARAM)lfs); FILEDLG_DestroyPrivate(lfs); @@ -1329,7 +1329,7 @@ BOOL WINAPI GetFileName31W( lfs = FILEDLG_AllocPrivate((LPARAM) lpofn, LFS32W, dlgType); if (lfs) { - hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); + hInst = (HINSTANCE)GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner, FileOpenDlgProc, (LPARAM)lfs); FILEDLG_DestroyPrivate(lfs); @@ -1508,7 +1508,7 @@ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn /* [in/out] address of structure with data*/ ) { - HINSTANCE hInst; + HINSTANCE16 hInst; BOOL bRet = FALSE; LPOPENFILENAME16 lpofn = MapSL(ofn); LFSPRIVATE lfs; @@ -1519,7 +1519,7 @@ BOOL16 WINAPI GetOpenFileName16( lfs = FILEDLG_AllocPrivate((LPARAM) ofn, LFS16, OPEN_DIALOG); if (lfs) { - hInst = GetWindowLongA( HWND_32(lpofn->hwndOwner), GWL_HINSTANCE ); + hInst = GetWindowWord( HWND_32(lpofn->hwndOwner), GWL_HINSTANCE ); ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 6); bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, (DLGPROC16) ptr, (LPARAM) lfs); @@ -1546,7 +1546,7 @@ BOOL16 WINAPI GetSaveFileName16( SEGPTR ofn /* [in/out] addess of structure with data*/ ) { - HINSTANCE hInst; + HINSTANCE16 hInst; BOOL bRet = FALSE; LPOPENFILENAME16 lpofn = MapSL(ofn); LFSPRIVATE lfs; @@ -1557,7 +1557,7 @@ BOOL16 WINAPI GetSaveFileName16( lfs = FILEDLG_AllocPrivate((LPARAM) ofn, LFS16, SAVE_DIALOG); if (lfs) { - hInst = GetWindowLongA( HWND_32(lpofn->hwndOwner), GWL_HINSTANCE ); + hInst = GetWindowWord( HWND_32(lpofn->hwndOwner), GWL_HINSTANCE ); ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 7); bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, (DLGPROC16) ptr, (LPARAM) lfs); diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c index 506cbb48344..1ebdb7039ca 100644 --- a/dlls/commdlg/filedlg95.c +++ b/dlls/commdlg/filedlg95.c @@ -769,7 +769,7 @@ HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) { FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndParentDlg,FileOpenDlgInfosStr); - TRACE("0x%04x 0x%04x\n",hwndParentDlg, uCode); + TRACE("0x%p 0x%04x\n",hwndParentDlg, uCode); if(!fodInfos) return 0; @@ -1587,7 +1587,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) int nOpenAction; FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); - TRACE("hwnd=0x%04x\n", hwnd); + TRACE("hwnd=0x%p\n", hwnd); /* get the files from the edit control */ nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed); @@ -1974,7 +1974,7 @@ static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb) FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); IContextMenu * pcm; - TRACE("(0x%08x,%p)\n", hwnd, lpVerb); + TRACE("(0x%p,%p)\n", hwnd, lpVerb); if(SUCCEEDED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_BACKGROUND, diff --git a/dlls/commdlg/finddlg32.c b/dlls/commdlg/finddlg32.c index 7975e41e998..259fe1fb5dc 100644 --- a/dlls/commdlg/finddlg32.c +++ b/dlls/commdlg/finddlg32.c @@ -373,7 +373,7 @@ static HWND COMDLG32_FR_DoFindReplace( DWORD error; LPDLGTEMPLATEW rcs; - TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags); + TRACE("hInst=%p, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags); if(!(pdata->fr.Flags & FR_ENABLETEMPLATEHANDLE)) { diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c index 45b363cd578..e50a4a94cc9 100644 --- a/dlls/commdlg/fontdlg.c +++ b/dlls/commdlg/fontdlg.c @@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #include "cdlg.h" -static HBITMAP16 hBitmapTT = 0; +static HBITMAP hBitmapTT = 0; INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, @@ -71,14 +71,14 @@ static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a) { chf32a->lStructSize=sizeof(CHOOSEFONTA); chf32a->hwndOwner=HWND_32(chf16->hwndOwner); - chf32a->hDC=chf16->hDC; + chf32a->hDC=HDC_32(chf16->hDC); chf32a->iPointSize=chf16->iPointSize; chf32a->Flags=chf16->Flags; chf32a->rgbColors=chf16->rgbColors; chf32a->lCustData=chf16->lCustData; chf32a->lpfnHook=NULL; chf32a->lpTemplateName=MapSL(chf16->lpTemplateName); - chf32a->hInstance=chf16->hInstance; + chf32a->hInstance=HINSTANCE_32(chf16->hInstance); chf32a->lpszStyle=MapSL(chf16->lpszStyle); chf32a->nFontType=chf16->nFontType; chf32a->nSizeMax=chf16->nSizeMax; diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c index 2087e17a38c..e88f25dd037 100644 --- a/dlls/commdlg/printdlg.c +++ b/dlls/commdlg/printdlg.c @@ -2014,7 +2014,7 @@ INT_PTR CALLBACK PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, return FALSE; } else { PrintStructures = (PRINT_PTRA*) lParam; - SetPropA(hDlg,"__WINE_PRINTDLGDATA",lParam); + SetPropA(hDlg,"__WINE_PRINTDLGDATA",PrintStructures); res = PRINTDLG_WMInitDialog(hDlg, wParam, PrintStructures); if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) @@ -2352,8 +2352,8 @@ BOOL WINAPI PrintDlgA( if(lppd->Flags & pflag->flag) strcat(flagstr, pflag->name); } - TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" - "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n" + TRACE("(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n" + "pp. %d-%d, min p %d, max p %d, copies %d, hinst %p\n" "flags %08lx (%s)\n", lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames, lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage, @@ -2508,8 +2508,8 @@ BOOL WINAPI PrintDlgW( if(lppd->Flags & pflag->flag) strcat(flagstr, pflag->name); } - TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" - "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n" + TRACE("(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n" + "pp. %d-%d, min p %d, max p %d, copies %d, hinst %p\n" "flags %08lx (%s)\n", lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames, lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage, @@ -2666,7 +2666,7 @@ BOOL16 WINAPI PrintDlg16( ) { BOOL bRet = FALSE; LPVOID ptr; - HINSTANCE hInst = (HINSTANCE)GetWindowLongA( HWND_32(lppd->hwndOwner), GWL_HINSTANCE ); + HINSTANCE16 hInst = GetWindowWord( HWND_32(lppd->hwndOwner), GWL_HINSTANCE ); if(TRACE_ON(commdlg)) { char flagstr[1000] = ""; @@ -2732,7 +2732,7 @@ BOOL16 WINAPI PrintDlg16( HeapFree(GetProcessHeap(), 0, dbuf); bRet = TRUE; } else { - HGLOBAL hDlgTmpl; + HGLOBAL16 hDlgTmpl; PRINT_PTRA *PrintStructures; /* load Dialog resources, @@ -2751,9 +2751,11 @@ BOOL16 WINAPI PrintDlg16( #define MVAL(x) PrintStructures->dlg.lpPrintDlg->x = MapSL(lppd->x); CVAL(Flags); PrintStructures->dlg.lpPrintDlg->hwndOwner = HWND_32(lppd->hwndOwner); - CVAL(hDC); + PrintStructures->dlg.lpPrintDlg->hDC = HDC_32(lppd->hDC); CVAL(nFromPage);CVAL(nToPage);CVAL(nMinPage);CVAL(nMaxPage); - CVAL(nCopies);CVAL(hInstance);CVAL(lCustData); + CVAL(nCopies); + PrintStructures->dlg.lpPrintDlg->hInstance = HINSTANCE_32(lppd->hInstance); + CVAL(lCustData); MVAL(lpPrintTemplateName);MVAL(lpSetupTemplateName); /* Don't copy rest, it is 16 bit specific */ #undef MVAL @@ -3172,7 +3174,7 @@ PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg==WM_INITDIALOG) { res = TRUE; pda = (PageSetupDataA*)lParam; - SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",lParam); + SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",pda); if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam); if (!res) { @@ -3254,7 +3256,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg==WM_INITDIALOG) { res = TRUE; pda = (PageSetupDataW*)lParam; - SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",lParam); + SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",pda); if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam); if (!res) { @@ -3346,8 +3348,8 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) { strcat(flagstr, "|"); } } - TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" - "hinst %08x, flags %08lx (%s)\n", + TRACE("(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n" + "hinst %p, flags %08lx (%s)\n", setupdlg, setupdlg->hwndOwner, setupdlg->hDevMode, setupdlg->hDevNames, setupdlg->hInstance, setupdlg->Flags, flagstr); @@ -3412,8 +3414,8 @@ BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW setupdlg) { strcat(flagstr, "|"); } } - TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" - "hinst %08x, flags %08lx (%s)\n", + TRACE("(%p): hwndOwner = %p, hDevMode = %p, hDevNames = %p\n" + "hinst %p, flags %08lx (%s)\n", setupdlg, setupdlg->hwndOwner, setupdlg->hDevMode, setupdlg->hDevNames, setupdlg->hInstance, setupdlg->Flags, flagstr); @@ -3482,7 +3484,7 @@ BOOL16 CALLBACK PrintDlgProc16(HWND16 hDlg16, UINT16 uMsg, WPARAM16 wParam, return FALSE; } else { PrintStructures = (PRINT_PTRA*) lParam; - SetPropA(hDlg,"__WINE_PRINTDLGDATA",lParam); + SetPropA(hDlg,"__WINE_PRINTDLGDATA",PrintStructures); res = PRINTDLG_WMInitDialog16(hDlg, wParam, PrintStructures); if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) {