mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:43:00 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 deletions
33
lib/sdk/crt/direct/getcwd.c
Normal file
33
lib/sdk/crt/direct/getcwd.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <precomp.h>
|
||||
#include <direct.h>
|
||||
#include <stdlib.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
_TCHAR* _tgetcwd(_TCHAR* buf, int size)
|
||||
{
|
||||
_TCHAR dir[MAX_PATH];
|
||||
DWORD dir_len = GetCurrentDirectory(MAX_PATH,dir);
|
||||
|
||||
if (dir_len == 0)
|
||||
{
|
||||
_dosmaperr(GetLastError());
|
||||
return NULL; /* FIXME: Real return value untested */
|
||||
}
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
return _tcsdup(dir);
|
||||
}
|
||||
|
||||
if (dir_len >= (DWORD)size)
|
||||
{
|
||||
__set_errno(ERANGE);
|
||||
return NULL; /* buf too small */
|
||||
}
|
||||
|
||||
_tcscpy(buf,dir);
|
||||
return buf;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue