ReactOS 0.4.16-dev-2104-gb84fa49
direct.h File Reference
#include <corecrt_wdirect.h>
#include <pshpack8.h>
#include <poppack.h>
Include dependency graph for direct.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _diskfree_t
 

Macros

#define _DISKFREE_T_DEFINED
 

Functions

_ACRTIMP int __cdecl _chdir (const char *)
 
_ACRTIMP int __cdecl _chdrive (int)
 
_ACRTIMP char *__cdecl _getcwd (char *, int)
 
_ACRTIMP char *__cdecl _getdcwd (int, char *, int)
 
_ACRTIMP int __cdecl _getdrive (void)
 
_ACRTIMP __msvcrt_ulong __cdecl _getdrives (void)
 
_ACRTIMP int __cdecl _mkdir (const char *)
 
_ACRTIMP int __cdecl _rmdir (const char *)
 
static int chdir (const char *newdir)
 
static chargetcwd (char *buf, int size)
 
static int mkdir (const char *newdir)
 
static int rmdir (const char *dir)
 

Macro Definition Documentation

◆ _DISKFREE_T_DEFINED

#define _DISKFREE_T_DEFINED

Definition at line 20 of file direct.h.

Function Documentation

◆ _chdir()

_ACRTIMP int __cdecl _chdir ( const char newdir)

Definition at line 215 of file dir.c.

216{
217 wchar_t *newdirW = NULL;
218 int ret;
219
220 if (newdir && !(newdirW = wstrdupa_utf8(newdir))) return -1;
221 ret = _wchdir(newdirW);
222 free(newdirW);
223 return ret;
224}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
int CDECL _wchdir(const wchar_t *newdir)
Definition: dir.c:231
static wchar_t * wstrdupa_utf8(const char *str)
Definition: msvcrt.h:440
return ret
Definition: mutex.c:146

Referenced by chdir(), and test_utf8().

◆ _chdrive()

_ACRTIMP int __cdecl _chdrive ( int  newdrive)

Definition at line 268 of file dir.c.

269{
270 WCHAR buffer[] = L"A:";
271
272 buffer[0] += newdrive - 1;
274 {
276 if (newdrive <= 0)
277 *_errno() = EACCES;
278 return -1;
279 }
280 return 0;
281}
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
int *CDECL _errno(void)
Definition: errno.c:215
#define EACCES
Definition: errno.h:36
#define L(x)
Definition: resources.c:13
GLuint buffer
Definition: glext.h:5915
#define msvcrt_set_errno
Definition: heap.c:50
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ _getcwd()

_ACRTIMP char *__cdecl _getcwd ( char buf,
int  size 
)

Definition at line 761 of file dir.c.

762{
763 wchar_t dirW[MAX_PATH];
764 int len;
765
766 if (!_wgetcwd(dirW, ARRAY_SIZE(dirW))) return NULL;
767
768 if (!buf) return astrdupw_utf8(dirW);
769 len = convert_wcs_to_acp_utf8(dirW, NULL, 0);
770 if (!len) return NULL;
771 if (len > size)
772 {
773 *_errno() = ERANGE;
774 return NULL;
775 }
777 return buf;
778}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MAX_PATH
Definition: compat.h:34
wchar_t *CDECL _wgetcwd(wchar_t *buf, int size)
Definition: dir.c:785
#define ERANGE
Definition: errno.h:55
static char * astrdupw_utf8(const wchar_t *wstr)
Definition: msvcrt.h:452
static int convert_wcs_to_acp_utf8(const wchar_t *wstr, char *str, int len)
Definition: msvcrt.h:435
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722

Referenced by getcwd(), and test_utf8().

◆ _getdcwd()

_ACRTIMP char *__cdecl _getdcwd ( int  drive,
char buf,
int  size 
)

Definition at line 843 of file dir.c.

844{
845 wchar_t dirW[MAX_PATH];
846 int len;
847
848 if (!_wgetdcwd(drive, dirW, ARRAY_SIZE(dirW))) return NULL;
849
850 if (!buf) return astrdupw_utf8(dirW);
851 len = convert_wcs_to_acp_utf8(dirW, NULL, 0);
852 if (!len) return NULL;
853 if (len > size)
854 {
855 *_errno() = ERANGE;
856 return NULL;
857 }
859 return buf;
860}
wchar_t *CDECL _wgetdcwd(int drive, wchar_t *buf, int size)
Definition: dir.c:867

Referenced by test_utf8().

◆ _getdrive()

_ACRTIMP int __cdecl _getdrive ( void  )

Definition at line 819 of file dir.c.

820{
823 buffer[0] >= 'A' && buffer[0] <= 'z' && buffer[1] == ':')
824 return towupper(buffer[0]) - 'A' + 1;
825 return 0;
826}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define towupper(c)
Definition: wctype.h:99

◆ _getdrives()

_ACRTIMP __msvcrt_ulong __cdecl _getdrives ( void  )

Definition at line 35 of file getdrive.c.

36{
37 return GetLogicalDrives();
38}
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
Definition: volume.c:513

◆ _mkdir()

_ACRTIMP int __cdecl _mkdir ( const char newdir)

Definition at line 958 of file dir.c.

959{
960 wchar_t *newdirW = NULL;
961 int ret;
962
963 if (newdir && !(newdirW = wstrdupa_utf8(newdir))) return -1;
964 ret = _wmkdir(newdirW);
965 free(newdirW);
966 return ret;
967}
int CDECL _wmkdir(const wchar_t *newdir)
Definition: dir.c:974

Referenced by mkdir(), rd_pstcache_mkdir(), test___getmainargs_parent(), and test_utf8().

◆ _rmdir()

_ACRTIMP int __cdecl _rmdir ( const char dir)

Definition at line 997 of file dir.c.

998{
999 wchar_t *dirW = NULL;
1000 int ret;
1001
1002 if (dir && !(dirW = wstrdupa_utf8(dir))) return -1;
1003 ret = _wrmdir(dirW);
1004 free(dirW);
1005 return ret;
1006}
unsigned int dir
Definition: maze.c:112
int CDECL _wrmdir(const wchar_t *dir)
Definition: dir.c:1013

Referenced by rmdir(), and test___getmainargs_parent().

◆ chdir()

static int chdir ( const char newdir)
inlinestatic

Definition at line 43 of file direct.h.

43{ return _chdir(newdir); }
_ACRTIMP int __cdecl _chdir(const char *)
Definition: dir.c:215

◆ getcwd()

static char * getcwd ( char buf,
int  size 
)
inlinestatic

Definition at line 44 of file direct.h.

44{ return _getcwd(buf, size); }
_ACRTIMP char *__cdecl _getcwd(char *, int)
Definition: dir.c:761

Referenced by MDIMainFrame::Command(), EnumFilesInDirectory(), FTPGetLocalCWD(), CCabinet::GetAttributesOnFile(), CCabinet::GetFileTimes(), lcd(), MakeDirectory(), and process_directory().

◆ mkdir()

static int mkdir ( const char newdir)
inlinestatic

Definition at line 45 of file direct.h.

45{ return _mkdir(newdir); }
_ACRTIMP int __cdecl _mkdir(const char *)
Definition: dir.c:958

◆ rmdir()

static int rmdir ( const char dir)
inlinestatic

Definition at line 46 of file direct.h.

46{ return _rmdir(dir); }
_ACRTIMP int __cdecl _rmdir(const char *)
Definition: dir.c:997