comdlg32: Fix PrintDlg(NULL) and reenable a test that was in an '#if 0'.

Fix the test so it compiles without warnings.
This commit is contained in:
Francois Gouget 2006-12-14 18:13:01 +01:00 committed by Alexandre Julliard
parent 458ebf423d
commit 2c531ade2e
2 changed files with 20 additions and 11 deletions

View File

@ -1994,9 +1994,16 @@ static BOOL PRINTDLG_CreateDCW(LPPRINTDLGW lppd)
BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd) BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
{ {
BOOL bRet = FALSE; BOOL bRet = FALSE;
LPVOID ptr; LPVOID ptr;
HINSTANCE hInst = (HINSTANCE)GetWindowLongPtrA( lppd->hwndOwner, GWLP_HINSTANCE ); HINSTANCE hInst;
if (!lppd)
{
COMDLG32_SetCommDlgExtendedError(CDERR_INITIALIZATION);
return FALSE;
}
hInst = (HINSTANCE)GetWindowLongPtrA( lppd->hwndOwner, GWLP_HINSTANCE );
if(TRACE_ON(commdlg)) { if(TRACE_ON(commdlg)) {
char flagstr[1000] = ""; char flagstr[1000] = "";
const struct pd_flags *pflag = pd_flags; const struct pd_flags *pflag = pd_flags;
@ -2131,14 +2138,19 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
* *
* See PrintDlgA. * See PrintDlgA.
*/ */
BOOL WINAPI PrintDlgW( BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
LPPRINTDLGW lppd /* [in/out] ptr to PRINTDLG32 struct */
)
{ {
BOOL bRet = FALSE; BOOL bRet = FALSE;
LPVOID ptr; LPVOID ptr;
HINSTANCE hInst = (HINSTANCE)GetWindowLongPtrW( lppd->hwndOwner, GWLP_HINSTANCE ); HINSTANCE hInst;
if (!lppd)
{
COMDLG32_SetCommDlgExtendedError(CDERR_INITIALIZATION);
return FALSE;
}
hInst = (HINSTANCE)GetWindowLongPtrW( lppd->hwndOwner, GWLP_HINSTANCE );
if(TRACE_ON(commdlg)) { if(TRACE_ON(commdlg)) {
char flagstr[1000] = ""; char flagstr[1000] = "";
const struct pd_flags *pflag = pd_flags; const struct pd_flags *pflag = pd_flags;

View File

@ -46,15 +46,12 @@ static void test_PrintDlgA(void)
if (!pDlg) return; if (!pDlg) return;
#if 0
/* will crash with unpatched wine */ /* will crash with unpatched wine */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = PrintDlgA(NULL); res = PrintDlgA(NULL);
ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION), ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),
"returned %ld with 0x%lx and 0x%lx (expected '0' and " \ "returned %d with 0x%x and 0x%x (expected '0' and " \
"CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError()); "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
}
#endif
ZeroMemory(pDlg, sizeof(PRINTDLGA)); ZeroMemory(pDlg, sizeof(PRINTDLGA));
pDlg->lStructSize = sizeof(PRINTDLGA) - 1; pDlg->lStructSize = sizeof(PRINTDLGA) - 1;