ReactOS
0.4.16-dev-1025-gd3456f5
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
fullpath.c
Go to the documentation of this file.
1
/*
2
* COPYRIGHT: See COPYING in the top level directory
3
* PROJECT: ReactOS CRT library
4
* FILE: lib/sdk/crt/stdlib/fullpath.c
5
* PURPOSE: Gets the fullpathname
6
* PROGRAMER: Pierre Schweitzer (pierre.schweitzer@reactos.org)
7
*/
8
9
#include <precomp.h>
10
#include <tchar.h>
11
12
/*
13
* @implemented
14
*/
15
_TCHAR
*
_tfullpath
(
_TCHAR
* absPath,
const
_TCHAR
* relPath,
size_t
maxLength
)
16
{
17
_TCHAR
*
lpBuffer
;
18
_TCHAR
*
lpFilePart
;
19
DWORD
retval
;
20
21
/* First check if entry relative path was given */
22
if
(!relPath || relPath[0] == 0)
23
{
24
/* If not, just try to return current dir */
25
return
_tgetcwd
(absPath,
maxLength
);
26
}
27
28
/* If no output buffer was given */
29
if
(!absPath)
30
{
31
/* Allocate one with fixed length */
32
maxLength
=
MAX_PATH
;
33
lpBuffer
=
malloc
(
maxLength
);
34
if
(!
lpBuffer
)
35
{
36
errno
=
ENOMEM
;
37
return
NULL
;
38
}
39
}
40
else
41
{
42
lpBuffer
= absPath;
43
}
44
45
/* Really get full path */
46
retval
=
GetFullPathName
(relPath, (
DWORD
)
maxLength
,
lpBuffer
, &
lpFilePart
);
47
/* Check for failures */
48
if
(
retval
>
maxLength
)
49
{
50
/* Path too long, free (if needed) and return */
51
if
(!absPath)
52
{
53
free
(
lpBuffer
);
54
}
55
56
errno
=
ERANGE
;
57
return
NULL
;
58
}
59
else
if
(!
retval
)
60
{
61
/* Other error, free (if needed), translate error, and return */
62
if
(!absPath)
63
{
64
free
(
lpBuffer
);
65
}
66
67
_dosmaperr
(
GetLastError
());
68
return
NULL
;
69
}
70
71
/* Return buffer. Up to the caller to free if needed */
72
return
lpBuffer
;
73
}
ENOMEM
#define ENOMEM
Definition:
acclib.h:84
ERANGE
#define ERANGE
Definition:
acclib.h:92
lpBuffer
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition:
db.cpp:175
free
#define free
Definition:
debug_ros.c:5
malloc
#define malloc
Definition:
debug_ros.c:4
NULL
#define NULL
Definition:
types.h:112
MAX_PATH
#define MAX_PATH
Definition:
compat.h:34
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
maxLength
GLsizei maxLength
Definition:
glext.h:6877
_tfullpath
#define _tfullpath
Definition:
tchar.h:679
_tgetcwd
#define _tgetcwd
Definition:
tchar.h:673
_TCHAR
char _TCHAR
Definition:
tchar.h:1392
_dosmaperr
void _dosmaperr(unsigned long oserrcode)
Definition:
errno.c:79
errno
#define errno
Definition:
errno.h:18
retval
int retval
Definition:
wcstombs.cpp:91
GetLastError
DWORD WINAPI GetLastError(void)
Definition:
except.c:1042
lpFilePart
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition:
winbase.h:3106
GetFullPathName
#define GetFullPathName
Definition:
winbase.h:3852
sdk
lib
crt
stdlib
fullpath.c
Generated on Wed Apr 23 2025 06:14:12 for ReactOS by
1.9.6