The 'le' is an integer value and not a bitwise value. This means it could have only one error condition at a time. The condition:
if ((le != ERROR_NO_MORE_FILES) && (le != ERROR_FILE_NOT_FOUND)) return LB_ERR;
Could never return LB_ERR even if file was not found. Hence we have changed to the logical OR condition which could trigger error either if no more files or file not found:
if ((le != ERROR_NO_MORE_FILES) || (le != ERROR_FILE_NOT_FOUND)) return LB_ERR;
Please find attached sample executable (DIRLIST.exe.zip has the executable), which demonstrate the behavior change between windows and wine. Run the sample and enter invalid path name or file name and press enter (click on Display button). On windows it displays error message "DlgDirList Failed...". Same steps when repeated on wine, it does not display this error message because of the above logical error.
Krishna
-----Original Message-----
From: Alexandre Julliard [mailto:julliard@winehq.org]
Sent: Friday, June 18, 2004 11:20 AM
To: Krishna Murthy
Cc: wine-devel@winehq.org
Subject: Re: LISTBOX_Directory() returns LB_OKAY for invalid directory / filen ame
Krishna Murthy <Krishna.Murthy@guptaworldwide.com> writes:
> diff -u -r1.103 listbox.c
> --- wine/controls/listbox.c 1 Apr 2004 04:57:12 -0000 1.103
> +++ wine/controls/listbox.c 17 Jun 2004 21:50:20 -0000
> @@ -1760,7 +1760,7 @@
> if ((handle = FindFirstFileW(filespec, &entry)) == INVALID_HANDLE_VALUE)
> {
> int le = GetLastError();
> - if ((le != ERROR_NO_MORE_FILES) && (le != ERROR_FILE_NOT_FOUND)) return LB_ERR;
> + if ((le != ERROR_NO_MORE_FILES) || (le !=
> + ERROR_FILE_NOT_FOUND)) return LB_ERR;
This makes the test completely useless, it can't be right.
--
Alexandre Julliard
julliard@winehq.org