Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
aebcbf0f
Commit
aebcbf0f
authored
Feb 27, 2008
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Feb 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Return upper cased drive letters in paths, some applications depend on it.
parent
91016652
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
2 deletions
+85
-2
process.c
dlls/kernel32/process.c
+1
-1
path.c
dlls/kernel32/tests/path.c
+83
-0
path.c
dlls/ntdll/path.c
+1
-1
No files found.
dlls/kernel32/process.c
View file @
aebcbf0f
...
...
@@ -690,7 +690,7 @@ static void init_windows_dirs(void)
static
const
WCHAR
windirW
[]
=
{
'w'
,
'i'
,
'n'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
winsysdirW
[]
=
{
'w'
,
'i'
,
'n'
,
's'
,
'y'
,
's'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
default_windirW
[]
=
{
'
c
'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
static
const
WCHAR
default_windirW
[]
=
{
'
C
'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
static
const
WCHAR
default_sysdirW
[]
=
{
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
0
};
DWORD
len
;
...
...
dlls/kernel32/tests/path.c
View file @
aebcbf0f
...
...
@@ -727,6 +727,7 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive)
"GetFullPathNameA returned part '%s' instead of '%s'
\n
"
,
strptr
,
SHORTFILE
);
/* Otherwise insert the missing leading slash */
if
(
otherDrive
!=
NOT_A_VALID_DRIVE
)
{
/* FIXME: this test assumes that current directory on other drive is root */
sprintf
(
tmpstr
,
"%c:%s
\\
%s"
,
otherDrive
,
SHORTDIR
,
SHORTFILE
);
ok
(
GetFullPathNameA
(
tmpstr
,
MAX_PATH
,
tmpstr1
,
&
strptr
),
"GetFullPathNameA failed for %s
\n
"
,
tmpstr
);
sprintf
(
tmpstr
,
"%c:
\\
%s
\\
%s"
,
otherDrive
,
SHORTDIR
,
SHORTFILE
);
...
...
@@ -1157,6 +1158,87 @@ static void test_NeedCurrentDirectoryForExePathW(void)
ok
(
!
pNeedCurrentDirectoryForExePathW
(
cmdname
),
"returned TRUE for
\"
cmd.exe
\"\n
"
);
}
/* Call various path/file name retrieving APIs and check the case of
* the returned drive letter. Some apps (for instance Adobe Photoshop CS3
* installer) depend on the driver letter being in upper case.
*/
static
void
test_drive_letter_case
(
void
)
{
UINT
ret
;
char
buf
[
MAX_PATH
];
#define is_upper_case_letter(a) ((a) >= 'A' && (a) <= 'Z')
memset
(
buf
,
0
,
sizeof
(
buf
));
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowsDirectory
(
buf
,
sizeof
(
buf
));
ok
(
ret
,
"GetWindowsDirectory error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
/* re-use the buffer returned by GetFullPathName */
buf
[
2
]
=
'/'
;
SetLastError
(
0xdeadbeef
);
ret
=
GetFullPathName
(
buf
+
2
,
sizeof
(
buf
),
buf
,
NULL
);
ok
(
ret
,
"GetFullPathName error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
memset
(
buf
,
0
,
sizeof
(
buf
));
SetLastError
(
0xdeadbeef
);
ret
=
GetSystemDirectory
(
buf
,
sizeof
(
buf
));
ok
(
ret
,
"GetSystemDirectory error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
memset
(
buf
,
0
,
sizeof
(
buf
));
SetLastError
(
0xdeadbeef
);
ret
=
GetCurrentDirectory
(
sizeof
(
buf
),
buf
);
ok
(
ret
,
"GetCurrentDirectory error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
memset
(
buf
,
0
,
sizeof
(
buf
));
SetLastError
(
0xdeadbeef
);
ret
=
GetTempPath
(
sizeof
(
buf
),
buf
);
ok
(
ret
,
"GetTempPath error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
memset
(
buf
,
0
,
sizeof
(
buf
));
SetLastError
(
0xdeadbeef
);
ret
=
GetFullPathName
(
"."
,
sizeof
(
buf
),
buf
,
NULL
);
ok
(
ret
,
"GetFullPathName error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
/* re-use the buffer returned by GetFullPathName */
SetLastError
(
0xdeadbeef
);
ret
=
GetShortPathName
(
buf
,
buf
,
sizeof
(
buf
));
ok
(
ret
,
"GetShortPathName error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
if
(
pGetLongPathNameA
)
{
/* re-use the buffer returned by GetShortPathName */
SetLastError
(
0xdeadbeef
);
ret
=
pGetLongPathNameA
(
buf
,
buf
,
sizeof
(
buf
));
ok
(
ret
,
"GetLongPathNameA error %u
\n
"
,
GetLastError
());
ok
(
ret
<
sizeof
(
buf
),
"buffer should be %u bytes
\n
"
,
ret
);
ok
(
buf
[
1
]
==
':'
,
"expected buf[1] == ':' got %c
\n
"
,
buf
[
1
]);
ok
(
is_upper_case_letter
(
buf
[
0
]),
"expected buf[0] upper case letter got %c
\n
"
,
buf
[
0
]);
}
#undef is_upper_case_letter
}
START_TEST
(
path
)
{
CHAR
origdir
[
MAX_PATH
],
curdir
[
MAX_PATH
],
curDrive
,
otherDrive
;
...
...
@@ -1188,4 +1270,5 @@ START_TEST(path)
{
test_NeedCurrentDirectoryForExePathW
();
}
test_drive_letter_case
();
}
dlls/ntdll/path.c
View file @
aebcbf0f
...
...
@@ -1025,7 +1025,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
*/
NTSTATUS
wine_unix_to_nt_file_name
(
const
ANSI_STRING
*
name
,
UNICODE_STRING
*
nt
)
{
static
const
WCHAR
prefixW
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'
a
'
,
':'
,
'\\'
};
static
const
WCHAR
prefixW
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'
A
'
,
':'
,
'\\'
};
unsigned
int
lenW
,
lenA
=
name
->
Length
;
const
char
*
path
=
name
->
Buffer
;
char
*
cwd
;
...
...
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