Commit 225c6d2c authored by Alexandre Julliard's avatar Alexandre Julliard

Check for non-existent directory in INT21_SetCurrentDirectory to

return a proper error when the directory is not on the current drive.
parent 1d9672ec
...@@ -790,6 +790,7 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context ) ...@@ -790,6 +790,7 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context )
{ {
WCHAR dirW[MAX_PATH]; WCHAR dirW[MAX_PATH];
WCHAR env_var[4]; WCHAR env_var[4];
DWORD attr;
char *dirA = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx); char *dirA = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
BYTE drive = INT21_GetCurrentDrive(); BYTE drive = INT21_GetCurrentDrive();
BOOL result; BOOL result;
...@@ -799,6 +800,13 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context ) ...@@ -799,6 +800,13 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context )
MultiByteToWideChar(CP_OEMCP, 0, dirA, -1, dirW, MAX_PATH); MultiByteToWideChar(CP_OEMCP, 0, dirA, -1, dirW, MAX_PATH);
if (!GetFullPathNameW( dirW, MAX_PATH, dirW, NULL )) return FALSE; 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[0] = '=';
env_var[1] = dirW[0]; env_var[1] = dirW[0];
env_var[2] = ':'; env_var[2] = ':';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment