update for HEAD-2003091401
[reactos.git] / lib / msvcrt / direct / wgetcwd.c
1 #include <windows.h>
2 #include <msvcrt/direct.h>
3 #include <msvcrt/stdlib.h>
4
5
6 /*
7  * @implemented
8  */
9 wchar_t* _wgetcwd(wchar_t* buffer, int maxlen)
10 {
11     wchar_t *cwd;
12     int len;
13     if (buffer == NULL) {
14         cwd = malloc(MAX_PATH * sizeof(wchar_t));
15         len = MAX_PATH;
16     } else {
17         cwd = buffer;
18         len = maxlen;
19     }
20     if (GetCurrentDirectoryW(len, cwd) == 0 )
21         return NULL;
22     return cwd;
23 }