reactos/lib/sdk/crt/direct/getcwd.c
Cameron Gutman 29fa274d6d - Create another branch for networking fixes
- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers)
 - If someone wants to delete aicom-network-fixes, they are welcome to
 - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea

svn path=/branches/aicom-network-branch/; revision=44353
2009-12-02 03:23:19 +00:00

33 lines
525 B
C

#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;
}