:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / msvcrt / direct / getdcwd.c
1 #include <windows.h>
2 #include <msvcrt/direct.h>
3
4 char* _getdcwd (int nDrive, char* caBuffer, int nBufLen)
5 {
6         int i =0;
7         int dr = _getdrive();
8         
9         if ( nDrive < 1 || nDrive > 26 )
10                 return NULL;
11         
12         if ( dr != nDrive )
13                 _chdrive(nDrive);
14         
15         i = GetCurrentDirectoryA(nBufLen,caBuffer);
16         if ( i  == nBufLen )
17                 return NULL;
18         
19         if ( dr != nDrive )
20                 _chdrive(dr);
21         
22         return caBuffer;
23 }
24
25 wchar_t* _wgetdcwd (int nDrive, wchar_t* caBuffer, int nBufLen)
26 {
27         int i =0;
28         int dr = _getdrive();
29         
30         if ( nDrive < 1 || nDrive > 26 )
31                 return NULL;
32         
33         if ( dr != nDrive )
34                 _chdrive(nDrive);
35         
36         i = GetCurrentDirectoryW(nBufLen,caBuffer);
37         if ( i  == nBufLen )
38                 return NULL;
39         
40         if ( dr != nDrive )
41                 _chdrive(dr);
42         
43         return caBuffer;
44 }