mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:21:38 +00:00
Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
This commit is contained in:
parent
a28e798006
commit
c424146e2c
20602 changed files with 0 additions and 1140137 deletions
27
lib/sdk/crt/direct/chdir.c
Normal file
27
lib/sdk/crt/direct/chdir.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <precomp.h>
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _tchdir(const _TCHAR* _path)
|
||||
{
|
||||
WCHAR newdir[MAX_PATH];
|
||||
|
||||
if (!SetCurrentDirectory(_path))
|
||||
{
|
||||
_dosmaperr(_path ? GetLastError() : 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update the drive-specific current directory variable */
|
||||
if (GetCurrentDirectoryW(MAX_PATH, newdir) && newdir[1] == L':')
|
||||
{
|
||||
WCHAR envvar[4] = { L'=', towupper(newdir[0]), L':', L'\0' };
|
||||
SetEnvironmentVariableW(envvar, newdir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
45
lib/sdk/crt/direct/chdrive.c
Normal file
45
lib/sdk/crt/direct/chdrive.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crt/chdrive.c
|
||||
* PURPOSE: Change the current drive.
|
||||
* PROGRAMER: WINE
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
* _chdrive (MSVCRT.@)
|
||||
*
|
||||
* Change the current drive.
|
||||
*
|
||||
* PARAMS
|
||||
* newdrive [I] Drive number to change to (1 = 'A', 2 = 'B', ...)
|
||||
*
|
||||
* RETURNS
|
||||
* Success: 0. The current drive is set to newdrive.
|
||||
* Failure: -1. errno indicates the error.
|
||||
*
|
||||
* NOTES
|
||||
* See SetCurrentDirectoryA.
|
||||
*/
|
||||
int _chdrive(int newdrive)
|
||||
{
|
||||
WCHAR buffer[] = L"A:";
|
||||
|
||||
buffer[0] += newdrive - 1;
|
||||
if (!SetCurrentDirectoryW( buffer ))
|
||||
{
|
||||
_dosmaperr(GetLastError());
|
||||
if (newdrive <= 0)
|
||||
{
|
||||
__set_errno(EACCES);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
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;
|
||||
}
|
62
lib/sdk/crt/direct/getdcwd.c
Normal file
62
lib/sdk/crt/direct/getdcwd.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
#include <precomp.h>
|
||||
#include <direct.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
* _getdcwd (MSVCRT.@)
|
||||
*
|
||||
* Get the current working directory on a given disk.
|
||||
*
|
||||
* PARAMS
|
||||
* drive [I] Drive letter to get the current working directory from.
|
||||
* buf [O] Destination for the current working directory.
|
||||
* size [I] Length of drive in characters.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: If drive is NULL, returns an allocated string containing the path.
|
||||
* Otherwise populates drive with the path and returns it.
|
||||
* Failure: NULL. errno indicates the error.
|
||||
*/
|
||||
_TCHAR* _tgetdcwd(int drive, _TCHAR * buf, int size)
|
||||
{
|
||||
static _TCHAR* dummy;
|
||||
|
||||
TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size);
|
||||
|
||||
if (!drive || drive == _getdrive())
|
||||
return _tgetcwd(buf,size); /* current */
|
||||
else
|
||||
{
|
||||
_TCHAR dir[MAX_PATH];
|
||||
_TCHAR drivespec[] = _T("A:");
|
||||
int dir_len;
|
||||
|
||||
drivespec[0] += drive - 1;
|
||||
if (GetDriveType(drivespec) < DRIVE_REMOVABLE)
|
||||
{
|
||||
__set_errno(EACCES);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* GetFullPathName for X: means "get working directory on drive X",
|
||||
* just like passing X: to SetCurrentDirectory means "switch to working
|
||||
* directory on drive X". -Gunnar */
|
||||
dir_len = GetFullPathName(drivespec,MAX_PATH,dir,&dummy);
|
||||
if (dir_len >= size || dir_len < 1)
|
||||
{
|
||||
__set_errno(ERANGE);
|
||||
return NULL; /* buf too small */
|
||||
}
|
||||
|
||||
TRACE(":returning '%s'\n", dir);
|
||||
if (!buf)
|
||||
return _tcsdup(dir); /* allocate */
|
||||
|
||||
_tcscpy(buf,dir);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
23
lib/sdk/crt/direct/getdfree.c
Normal file
23
lib/sdk/crt/direct/getdfree.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <precomp.h>
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t* _diskspace)
|
||||
{
|
||||
char RootPathName[10];
|
||||
|
||||
RootPathName[0] = toupper(_drive +'@');
|
||||
RootPathName[1] = ':';
|
||||
RootPathName[2] = '\\';
|
||||
RootPathName[3] = 0;
|
||||
if (_diskspace == NULL)
|
||||
return 0;
|
||||
if (!GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
|
||||
(LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters))
|
||||
return 0;
|
||||
return _diskspace->avail_clusters;
|
||||
}
|
35
lib/sdk/crt/direct/getdrive.c
Normal file
35
lib/sdk/crt/direct/getdrive.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <precomp.h>
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
* _getdrive (MSVCRT.@)
|
||||
*
|
||||
* Get the current drive number.
|
||||
*
|
||||
* PARAMS
|
||||
* None.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: The drive letter number from 1 to 26 ("A:" to "Z:").
|
||||
* Failure: 0.
|
||||
*/
|
||||
int _getdrive(void)
|
||||
{
|
||||
WCHAR buffer[MAX_PATH];
|
||||
if (GetCurrentDirectoryW( MAX_PATH, buffer ) &&
|
||||
buffer[0] >= 'A' && buffer[0] <= 'z' && buffer[1] == ':')
|
||||
return towupper(buffer[0]) - 'A' + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned long _getdrives(void)
|
||||
{
|
||||
return GetLogicalDrives();
|
||||
}
|
15
lib/sdk/crt/direct/mkdir.c
Normal file
15
lib/sdk/crt/direct/mkdir.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <precomp.h>
|
||||
#include <direct.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _tmkdir(const _TCHAR* _path)
|
||||
{
|
||||
if (!CreateDirectory(_path, NULL)) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
15
lib/sdk/crt/direct/rmdir.c
Normal file
15
lib/sdk/crt/direct/rmdir.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <precomp.h>
|
||||
#include <direct.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _trmdir(const _TCHAR* _path)
|
||||
{
|
||||
if (!RemoveDirectory(_path)) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
4
lib/sdk/crt/direct/wchdir.c
Normal file
4
lib/sdk/crt/direct/wchdir.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "chdir.c"
|
5
lib/sdk/crt/direct/wgetcwd.c
Normal file
5
lib/sdk/crt/direct/wgetcwd.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "getcwd.c"
|
||||
|
5
lib/sdk/crt/direct/wgetdcwd.c
Normal file
5
lib/sdk/crt/direct/wgetdcwd.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "getdcwd.c"
|
||||
|
4
lib/sdk/crt/direct/wmkdir.c
Normal file
4
lib/sdk/crt/direct/wmkdir.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "mkdir.c"
|
4
lib/sdk/crt/direct/wrmdir.c
Normal file
4
lib/sdk/crt/direct/wrmdir.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "rmdir.c"
|
Loading…
Add table
Add a link
Reference in a new issue