Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
bd1fdedd
Commit
bd1fdedd
authored
Apr 16, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the drive environment strings when changing the current
directory from 16-bit or DOS code.
parent
b3f32d96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
14 deletions
+42
-14
file16.c
dlls/kernel/file16.c
+10
-0
int21.c
dlls/winedos/int21.c
+32
-14
No files found.
dlls/kernel/file16.c
View file @
bd1fdedd
...
...
@@ -580,6 +580,16 @@ BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
*/
BOOL16
WINAPI
SetCurrentDirectory16
(
LPCSTR
dir
)
{
char
fulldir
[
MAX_PATH
];
if
(
!
GetFullPathNameA
(
dir
,
MAX_PATH
,
fulldir
,
NULL
))
return
FALSE
;
if
(
fulldir
[
0
]
&&
fulldir
[
1
]
==
':'
)
{
char
env_var
[
4
]
=
"=A:"
;
env_var
[
1
]
=
fulldir
[
0
];
SetEnvironmentVariableA
(
env_var
,
fulldir
);
}
return
SetCurrentDirectoryA
(
dir
);
}
...
...
dlls/winedos/int21.c
View file @
bd1fdedd
...
...
@@ -666,16 +666,15 @@ static BOOL INT21_FillDrivePB( BYTE drive )
static
BOOL
INT21_GetCurrentDirectory
(
CONTEXT86
*
context
,
BOOL
islong
)
{
char
*
buffer
=
CTX_SEG_OFF_TO_LIN
(
context
,
context
->
SegDs
,
context
->
Esi
);
BYTE
new_drive
=
INT21_MapDrive
(
DL_reg
(
context
)
);
BYTE
old_drive
=
INT21_GetCurrentDrive
();
BYTE
drive
=
INT21_MapDrive
(
DL_reg
(
context
)
);
WCHAR
pathW
[
MAX_PATH
];
char
pathA
[
MAX_PATH
];
WCHAR
*
ptr
=
pathW
;
TRACE
(
"drive %d
\n
"
,
DL_reg
(
context
)
);
if
(
new_
drive
==
MAX_DOS_DRIVES
)
{
if
(
drive
==
MAX_DOS_DRIVES
)
{
SetLastError
(
ERROR_INVALID_DRIVE
);
return
FALSE
;
}
...
...
@@ -684,13 +683,25 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context, BOOL islong )
* Grab current directory.
*/
INT21_SetCurrentDrive
(
new_drive
);
if
(
!
GetCurrentDirectoryW
(
MAX_PATH
,
pathW
))
{
INT21_SetCurrentDrive
(
old_drive
);
return
FALSE
;
if
(
!
GetCurrentDirectoryW
(
MAX_PATH
,
pathW
))
return
FALSE
;
if
(
toupperW
(
pathW
[
0
])
-
'A'
!=
drive
||
pathW
[
1
]
!=
':'
)
{
/* cwd is not on the requested drive, get the environment string instead */
WCHAR
env_var
[
4
];
env_var
[
0
]
=
'='
;
env_var
[
1
]
=
'A'
+
drive
;
env_var
[
2
]
=
':'
;
env_var
[
3
]
=
0
;
if
(
!
GetEnvironmentVariableW
(
env_var
,
pathW
,
MAX_PATH
))
{
/* return empty path */
buffer
[
0
]
=
0
;
return
TRUE
;
}
}
INT21_SetCurrentDrive
(
old_drive
);
/*
* Convert into short format.
...
...
@@ -761,7 +772,7 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context, BOOL islong )
pathA
[
63
]
=
0
;
}
TRACE
(
"%c:=%s
\n
"
,
'A'
+
new_
drive
,
pathA
);
TRACE
(
"%c:=%s
\n
"
,
'A'
+
drive
,
pathA
);
strcpy
(
buffer
,
pathA
);
return
TRUE
;
...
...
@@ -778,6 +789,7 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context, BOOL islong )
static
BOOL
INT21_SetCurrentDirectory
(
CONTEXT86
*
context
)
{
WCHAR
dirW
[
MAX_PATH
];
WCHAR
env_var
[
4
];
char
*
dirA
=
CTX_SEG_OFF_TO_LIN
(
context
,
context
->
SegDs
,
context
->
Edx
);
BYTE
drive
=
INT21_GetCurrentDrive
();
BOOL
result
;
...
...
@@ -785,10 +797,16 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context )
TRACE
(
"SET CURRENT DIRECTORY %s
\n
"
,
dirA
);
MultiByteToWideChar
(
CP_OEMCP
,
0
,
dirA
,
-
1
,
dirW
,
MAX_PATH
);
result
=
SetCurrentDirectoryW
(
dirW
);
if
(
!
GetFullPathNameW
(
dirW
,
MAX_PATH
,
dirW
,
NULL
))
return
FALSE
;
env_var
[
0
]
=
'='
;
env_var
[
1
]
=
dirW
[
0
];
env_var
[
2
]
=
':'
;
env_var
[
3
]
=
0
;
result
=
SetEnvironmentVariableW
(
env_var
,
dirW
);
/*
This function must not change current drive.
*/
INT21_SetCurrentDrive
(
drive
);
/*
only set current directory if on the current drive
*/
if
(
result
&&
(
toupperW
(
dirW
[
0
])
-
'A'
==
drive
))
result
=
SetCurrentDirectoryW
(
dirW
);
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment