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
5d2f0688
Commit
5d2f0688
authored
Jun 30, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add _splitpath_s.
Implementation copied from msvcrt. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0db689ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
22 deletions
+60
-22
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
string.c
dlls/ntdll/string.c
+59
-22
No files found.
dlls/ntdll/ntdll.spec
View file @
5d2f0688
...
...
@@ -1524,6 +1524,7 @@
@ varargs _snwprintf_s(ptr long long wstr)
@ varargs _swprintf(ptr wstr) NTDLL_swprintf
@ cdecl _splitpath(str ptr ptr ptr ptr)
@ cdecl _splitpath_s(str ptr long ptr long ptr long ptr long)
@ cdecl _strcmpi(str str) _stricmp
@ cdecl _stricmp(str str)
@ cdecl _strlwr(str)
...
...
dlls/ntdll/string.c
View file @
5d2f0688
...
...
@@ -1852,37 +1852,37 @@ int WINAPIV sscanf( const char *str, const char *format, ... )
}
/*********************************************************************
* _splitpath (NTDLL.@)
*
* Split a path into its component pieces.
*
* PARAMS
* inpath [I] Path to split
* drv [O] Destination for drive component (e.g. "A:"). Must be at least 3 characters.
* dir [O] Destination for directory component. Should be at least MAX_PATH characters.
* fname [O] Destination for File name component. Should be at least MAX_PATH characters.
* ext [O] Destination for file extension component. Should be at least MAX_PATH characters.
*
* RETURNS
* Nothing.
/******************************************************************
* _splitpath_s (NTDLL.@)
*/
void
__cdecl
_splitpath
(
const
char
*
inpath
,
char
*
drv
,
char
*
dir
,
char
*
fname
,
char
*
ext
)
errno_t
__cdecl
_splitpath_s
(
const
char
*
inpath
,
char
*
drive
,
size_t
sz_drive
,
char
*
dir
,
size_t
sz_dir
,
char
*
fname
,
size_t
sz_fname
,
char
*
ext
,
size_t
sz_ext
)
{
const
char
*
p
,
*
end
;
if
(
!
inpath
||
(
!
drive
&&
sz_drive
)
||
(
drive
&&
!
sz_drive
)
||
(
!
dir
&&
sz_dir
)
||
(
dir
&&
!
sz_dir
)
||
(
!
fname
&&
sz_fname
)
||
(
fname
&&
!
sz_fname
)
||
(
!
ext
&&
sz_ext
)
||
(
ext
&&
!
sz_ext
))
return
EINVAL
;
if
(
inpath
[
0
]
&&
inpath
[
1
]
==
':'
)
{
if
(
dr
v
)
if
(
dr
ive
)
{
drv
[
0
]
=
inpath
[
0
];
drv
[
1
]
=
inpath
[
1
];
drv
[
2
]
=
0
;
if
(
sz_drive
<=
2
)
goto
error
;
drive
[
0
]
=
inpath
[
0
];
drive
[
1
]
=
inpath
[
1
];
drive
[
2
]
=
0
;
}
inpath
+=
2
;
}
else
if
(
dr
v
)
drv
[
0
]
=
0
;
else
if
(
dr
ive
)
drive
[
0
]
=
'\0'
;
/* look for end of directory part */
end
=
NULL
;
...
...
@@ -1892,6 +1892,7 @@ void __cdecl _splitpath(const char* inpath, char * drv, char * dir,
{
if
(
dir
)
{
if
(
sz_dir
<=
end
-
inpath
)
goto
error
;
memcpy
(
dir
,
inpath
,
end
-
inpath
);
dir
[
end
-
inpath
]
=
0
;
}
...
...
@@ -1907,8 +1908,44 @@ void __cdecl _splitpath(const char* inpath, char * drv, char * dir,
if
(
fname
)
{
if
(
sz_fname
<=
end
-
inpath
)
goto
error
;
memcpy
(
fname
,
inpath
,
end
-
inpath
);
fname
[
end
-
inpath
]
=
0
;
}
if
(
ext
)
strcpy
(
ext
,
end
);
if
(
ext
)
{
if
(
sz_ext
<=
strlen
(
end
))
goto
error
;
strcpy
(
ext
,
end
);
}
return
0
;
error:
if
(
drive
)
drive
[
0
]
=
0
;
if
(
dir
)
dir
[
0
]
=
0
;
if
(
fname
)
fname
[
0
]
=
0
;
if
(
ext
)
ext
[
0
]
=
0
;
return
ERANGE
;
}
/*********************************************************************
* _splitpath (NTDLL.@)
*
* Split a path into its component pieces.
*
* PARAMS
* inpath [I] Path to split
* drv [O] Destination for drive component (e.g. "A:"). Must be at least 3 characters.
* dir [O] Destination for directory component. Should be at least MAX_PATH characters.
* fname [O] Destination for File name component. Should be at least MAX_PATH characters.
* ext [O] Destination for file extension component. Should be at least MAX_PATH characters.
*
* RETURNS
* Nothing.
*/
void
__cdecl
_splitpath
(
const
char
*
inpath
,
char
*
drv
,
char
*
dir
,
char
*
fname
,
char
*
ext
)
{
_splitpath_s
(
inpath
,
drv
,
drv
?
_MAX_DRIVE
:
0
,
dir
,
dir
?
_MAX_DIR
:
0
,
fname
,
fname
?
_MAX_FNAME
:
0
,
ext
,
ext
?
_MAX_EXT
:
0
);
}
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