ReactOS
0.4.16-dev-1-gcf26321
getcwd.c
Go to the documentation of this file.
1
#include <precomp.h>
2
#include <
direct.h
>
3
#include <process.h>
4
#include <tchar.h>
5
6
/*
7
* @implemented
8
*/
9
_TCHAR
*
_tgetcwd
(
_TCHAR
*
buf
,
int
size
)
10
{
11
_TCHAR
dir
[
MAX_PATH
];
12
DWORD
dir_len =
GetCurrentDirectory
(
MAX_PATH
,
dir
);
13
14
if
(dir_len == 0)
15
{
16
_dosmaperr
(
GetLastError
());
17
return
NULL
;
/* FIXME: Real return value untested */
18
}
19
20
if
(!
buf
)
21
{
22
return
_tcsdup
(
dir
);
23
}
24
25
if
(dir_len >= (
DWORD
)
size
)
26
{
27
_set_errno
(
ERANGE
);
28
return
NULL
;
/* buf too small */
29
}
30
31
_tcscpy
(
buf
,
dir
);
32
return
buf
;
33
}
ERANGE
#define ERANGE
Definition:
acclib.h:92
dir
unsigned int dir
Definition:
maze.c:112
direct.h
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
size
GLsizeiptr size
Definition:
glext.h:5919
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition:
glext.h:7751
_tcscpy
#define _tcscpy
Definition:
tchar.h:623
_tgetcwd
#define _tgetcwd
Definition:
tchar.h:673
_tcsdup
#define _tcsdup
Definition:
tchar.h:625
_TCHAR
char _TCHAR
Definition:
tchar.h:1392
_dosmaperr
void _dosmaperr(unsigned long oserrcode)
Definition:
errno.c:79
_set_errno
errno_t __cdecl _set_errno(_In_ int _Value)
GetLastError
DWORD WINAPI GetLastError(void)
Definition:
except.c:1042
GetCurrentDirectory
#define GetCurrentDirectory
Definition:
winbase.h:3805
sdk
lib
crt
direct
getcwd.c
Generated on Wed Sep 11 2024 06:13:10 for ReactOS by
1.9.6