You have now described the intended behavior. The test is now: if ((lpdi->size != LSH_DLGINFO_EX_V1_SZ && lpdi->size < sizeof(LSH_DLGINFO_EX)) || lpdi->dlgtype != DLGTYPE_PASSWD) { MessageBox(hDialog, "An incorrect initialization data structure was provided.", "AuthenticateProc()", MB_OK | MB_ICONSTOP); return FALSE; }