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
ca9f3576
Commit
ca9f3576
authored
Jun 30, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add _makepath_s.
Implementation copied from msvcrt. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0c986b2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
string.c
dlls/ntdll/string.c
+77
-0
No files found.
dlls/ntdll/ntdll.spec
View file @
ca9f3576
...
@@ -1516,6 +1516,7 @@
...
@@ -1516,6 +1516,7 @@
@ cdecl _ltoa_s(long ptr long long)
@ cdecl _ltoa_s(long ptr long long)
@ cdecl _ltow(long ptr long)
@ cdecl _ltow(long ptr long)
@ cdecl _ltow_s(long ptr long long)
@ cdecl _ltow_s(long ptr long long)
@ cdecl _makepath_s(ptr long str str str str)
@ cdecl _memccpy(ptr ptr long long)
@ cdecl _memccpy(ptr ptr long long)
@ cdecl _memicmp(str str long)
@ cdecl _memicmp(str str long)
@ varargs _snprintf(ptr long str) NTDLL__snprintf
@ varargs _snprintf(ptr long str) NTDLL__snprintf
...
...
dlls/ntdll/string.c
View file @
ca9f3576
...
@@ -1949,3 +1949,80 @@ void __cdecl _splitpath(const char* inpath, char * drv, char * dir,
...
@@ -1949,3 +1949,80 @@ void __cdecl _splitpath(const char* inpath, char * drv, char * dir,
_splitpath_s
(
inpath
,
drv
,
drv
?
_MAX_DRIVE
:
0
,
dir
,
dir
?
_MAX_DIR
:
0
,
_splitpath_s
(
inpath
,
drv
,
drv
?
_MAX_DRIVE
:
0
,
dir
,
dir
?
_MAX_DIR
:
0
,
fname
,
fname
?
_MAX_FNAME
:
0
,
ext
,
ext
?
_MAX_EXT
:
0
);
fname
,
fname
?
_MAX_FNAME
:
0
,
ext
,
ext
?
_MAX_EXT
:
0
);
}
}
/*********************************************************************
* _makepath_s (NTDLL.@)
*/
errno_t
__cdecl
_makepath_s
(
char
*
path
,
size_t
size
,
const
char
*
drive
,
const
char
*
directory
,
const
char
*
filename
,
const
char
*
extension
)
{
char
*
p
=
path
;
if
(
!
path
||
!
size
)
return
EINVAL
;
if
(
drive
&&
drive
[
0
])
{
if
(
size
<=
2
)
goto
range
;
*
p
++
=
drive
[
0
];
*
p
++
=
':'
;
size
-=
2
;
}
if
(
directory
&&
directory
[
0
])
{
unsigned
int
len
=
strlen
(
directory
);
unsigned
int
needs_separator
=
directory
[
len
-
1
]
!=
'/'
&&
directory
[
len
-
1
]
!=
'\\'
;
unsigned
int
copylen
=
min
(
size
-
1
,
len
);
if
(
size
<
2
)
goto
range
;
memmove
(
p
,
directory
,
copylen
);
if
(
size
<=
len
)
goto
range
;
p
+=
copylen
;
size
-=
copylen
;
if
(
needs_separator
)
{
if
(
size
<
2
)
goto
range
;
*
p
++
=
'\\'
;
size
-=
1
;
}
}
if
(
filename
&&
filename
[
0
])
{
unsigned
int
len
=
strlen
(
filename
);
unsigned
int
copylen
=
min
(
size
-
1
,
len
);
if
(
size
<
2
)
goto
range
;
memmove
(
p
,
filename
,
copylen
);
if
(
size
<=
len
)
goto
range
;
p
+=
len
;
size
-=
len
;
}
if
(
extension
&&
extension
[
0
])
{
unsigned
int
len
=
strlen
(
extension
);
unsigned
int
needs_period
=
extension
[
0
]
!=
'.'
;
unsigned
int
copylen
;
if
(
size
<
2
)
goto
range
;
if
(
needs_period
)
{
*
p
++
=
'.'
;
size
-=
1
;
}
copylen
=
min
(
size
-
1
,
len
);
memcpy
(
p
,
extension
,
copylen
);
if
(
size
<=
len
)
goto
range
;
p
+=
copylen
;
}
*
p
=
0
;
return
0
;
range:
path
[
0
]
=
0
;
return
ERANGE
;
}
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