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
017438cd
Commit
017438cd
authored
Apr 14, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed handling of \\?\ prefix in RtlDosPathNameToNtPathName_U.
Fixed parsing of UNC file names in RtlGetFullPathName_U.
parent
1a833442
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
+37
-28
path.c
dlls/ntdll/path.c
+37
-28
No files found.
dlls/ntdll/path.c
View file @
017438cd
...
@@ -301,7 +301,7 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
...
@@ -301,7 +301,7 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
CURDIR
*
cd
)
CURDIR
*
cd
)
{
{
static
const
WCHAR
LongFileNamePfxW
[
4
]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
};
static
const
WCHAR
LongFileNamePfxW
[
4
]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
};
ULONG
sz
,
ptr_sz
,
offset
;
ULONG
sz
,
offset
;
WCHAR
local
[
MAX_PATH
];
WCHAR
local
[
MAX_PATH
];
LPWSTR
ptr
;
LPWSTR
ptr
;
...
@@ -316,20 +316,21 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
...
@@ -316,20 +316,21 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
if
(
!
dos_path
||
!*
dos_path
)
return
FALSE
;
if
(
!
dos_path
||
!*
dos_path
)
return
FALSE
;
if
(
!
memcmp
(
dos_path
,
LongFileNamePfxW
,
sizeof
(
LongFileNamePfxW
)
))
if
(
!
strncmpW
(
dos_path
,
LongFileNamePfxW
,
4
))
{
{
dos_path
+=
sizeof
(
LongFileNamePfxW
)
/
sizeof
(
WCHAR
);
ntpath
->
Length
=
strlenW
(
dos_path
)
*
sizeof
(
WCHAR
);
ptr
=
NULL
;
ntpath
->
MaximumLength
=
ntpath
->
Length
+
sizeof
(
WCHAR
);
ptr_sz
=
0
;
ntpath
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
ntpath
->
MaximumLength
);
}
if
(
!
ntpath
->
Buffer
)
return
FALSE
;
else
memcpy
(
ntpath
->
Buffer
,
dos_path
,
ntpath
->
MaximumLength
);
{
ntpath
->
Buffer
[
1
]
=
'?'
;
/* change \\?\ to \??\ */
ptr
=
local
;
return
TRUE
;
ptr_sz
=
sizeof
(
local
);
}
}
sz
=
RtlGetFullPathName_U
(
dos_path
,
ptr_sz
,
ptr
,
file_part
);
ptr
=
local
;
sz
=
RtlGetFullPathName_U
(
dos_path
,
sizeof
(
local
),
ptr
,
file_part
);
if
(
sz
==
0
)
return
FALSE
;
if
(
sz
==
0
)
return
FALSE
;
if
(
sz
>
ptr_sz
)
if
(
sz
>
sizeof
(
local
)
)
{
{
ptr
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sz
);
ptr
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sz
);
sz
=
RtlGetFullPathName_U
(
dos_path
,
sz
,
ptr
,
file_part
);
sz
=
RtlGetFullPathName_U
(
dos_path
,
sz
,
ptr
,
file_part
);
...
@@ -348,16 +349,14 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
...
@@ -348,16 +349,14 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR dos_path,
switch
(
RtlDetermineDosPathNameType_U
(
ptr
))
switch
(
RtlDetermineDosPathNameType_U
(
ptr
))
{
{
case
UNC_PATH
:
/* \\foo */
case
UNC_PATH
:
/* \\foo */
if
(
ptr
[
2
]
!=
'?'
)
offset
=
2
;
{
strcatW
(
ntpath
->
Buffer
,
UncPfxW
);
offset
=
2
;
strcatW
(
ntpath
->
Buffer
,
UncPfxW
);
}
break
;
break
;
case
DEVICE_PATH
:
/* \\.\foo */
case
DEVICE_PATH
:
/* \\.\foo */
offset
=
4
;
offset
=
4
;
break
;
break
;
default:
break
;
/* needed to keep gcc quiet */
default:
break
;
/* needed to keep gcc quiet */
}
}
strcatW
(
ntpath
->
Buffer
,
ptr
+
offset
);
strcatW
(
ntpath
->
Buffer
,
ptr
+
offset
);
...
@@ -508,6 +507,23 @@ static inline void collapse_path( WCHAR *path, UINT mark )
...
@@ -508,6 +507,23 @@ static inline void collapse_path( WCHAR *path, UINT mark )
}
}
}
}
/******************************************************************
* skip_unc_prefix
*
* Skip the \\share\dir\ part of a file name. Helper for RtlGetFullPathName_U.
*/
static
const
WCHAR
*
skip_unc_prefix
(
const
WCHAR
*
ptr
)
{
ptr
+=
2
;
while
(
*
ptr
&&
!
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
/* share name */
while
(
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
while
(
*
ptr
&&
!
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
/* dir name */
while
(
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
return
ptr
;
}
/******************************************************************
/******************************************************************
* get_full_path_helper
* get_full_path_helper
*
*
...
@@ -530,10 +546,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
...
@@ -530,10 +546,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
switch
(
type
=
RtlDetermineDosPathNameType_U
(
name
))
switch
(
type
=
RtlDetermineDosPathNameType_U
(
name
))
{
{
case
UNC_PATH
:
/* \\foo */
case
UNC_PATH
:
/* \\foo */
ptr
=
name
+
2
;
ptr
=
skip_unc_prefix
(
name
);
while
(
*
ptr
&&
!
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
/* share name */
while
(
*
ptr
&&
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
while
(
*
ptr
&&
!
IS_SEPARATOR
(
*
ptr
))
ptr
++
;
/* dir name */
mark
=
(
ptr
-
name
);
mark
=
(
ptr
-
name
);
break
;
break
;
...
@@ -601,9 +614,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
...
@@ -601,9 +614,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
ins_str
=
cd
->
Buffer
;
ins_str
=
cd
->
Buffer
;
if
(
cd
->
Buffer
[
1
]
!=
':'
)
if
(
cd
->
Buffer
[
1
]
!=
':'
)
{
{
ptr
=
strchrW
(
cd
->
Buffer
+
2
,
'\\'
);
ptr
=
skip_unc_prefix
(
cd
->
Buffer
);
if
(
ptr
)
ptr
=
strchrW
(
ptr
+
1
,
'\\'
);
if
(
!
ptr
)
ptr
=
cd
->
Buffer
+
strlenW
(
cd
->
Buffer
);
mark
=
ptr
-
cd
->
Buffer
;
mark
=
ptr
-
cd
->
Buffer
;
}
}
else
mark
=
3
;
else
mark
=
3
;
...
@@ -636,9 +647,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
...
@@ -636,9 +647,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
}
}
else
else
{
{
ptr
=
strchrW
(
cd
->
Buffer
+
2
,
'\\'
);
ptr
=
skip_unc_prefix
(
cd
->
Buffer
);
if
(
ptr
)
ptr
=
strchrW
(
ptr
+
1
,
'\\'
);
if
(
!
ptr
)
ptr
=
cd
->
Buffer
+
strlenW
(
cd
->
Buffer
);
reqsize
=
(
ptr
-
cd
->
Buffer
)
*
sizeof
(
WCHAR
);
reqsize
=
(
ptr
-
cd
->
Buffer
)
*
sizeof
(
WCHAR
);
mark
=
reqsize
/
sizeof
(
WCHAR
);
mark
=
reqsize
/
sizeof
(
WCHAR
);
ins_str
=
cd
->
Buffer
;
ins_str
=
cd
->
Buffer
;
...
...
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