SearchPathA needs to set the last error to ERROR_FILE_NOT_FOUND when
it does not find the file.
diff --git a/files/directory.c b/files/directory.c
index f20adcf..4280f20 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -649,7 +649,8 @@
* Failure: Zero
*
* NOTES
- * Should call SetLastError(but currently doesn't).
+ * If the file is not found, calls SetLastError(ERROR_FILE_NOT_FOUND)
+ * (tested on NT 4.0)
*/
DWORD WINAPI SearchPathA( LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
LPSTR buffer, LPSTR *lastpart )
@@ -657,7 +658,11 @@
LPSTR p, res;
DOS_FULL_NAME full_name;
- if (!DIR_SearchPath( path, name, ext, &full_name, TRUE )) return 0;
+ if (!DIR_SearchPath( path, name, ext, &full_name, TRUE ))
+ {
+ SetLastError(ERROR_FILE_NOT_FOUND);
+ return 0;
+ }
lstrcpynA( buffer, full_name.short_name, buflen );
res = full_name.long_name +
strlen(DRIVE_GetRoot( full_name.short_name[0] - 'A' ));