From 225c6d2cee1368bd7ec593292d8007c4243779b5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 17 Jun 2004 04:26:17 +0000 Subject: [PATCH] Check for non-existent directory in INT21_SetCurrentDirectory to return a proper error when the directory is not on the current drive. --- dlls/winedos/int21.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c index 1ea756c8ca7..3e487102d84 100644 --- a/dlls/winedos/int21.c +++ b/dlls/winedos/int21.c @@ -790,6 +790,7 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context ) { WCHAR dirW[MAX_PATH]; WCHAR env_var[4]; + DWORD attr; char *dirA = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx); BYTE drive = INT21_GetCurrentDrive(); BOOL result; @@ -799,6 +800,13 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context ) MultiByteToWideChar(CP_OEMCP, 0, dirA, -1, dirW, MAX_PATH); if (!GetFullPathNameW( dirW, MAX_PATH, dirW, NULL )) return FALSE; + attr = GetFileAttributesW( dirW ); + if (attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY)) + { + SetLastError( ERROR_PATH_NOT_FOUND ); + return FALSE; + } + env_var[0] = '='; env_var[1] = dirW[0]; env_var[2] = ':';