mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
add a new interal function call GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size) it get the a driver current path without change the current driver directory, it is not in use yet, prep for copy, cd, rm, and all other commands.
svn path=/trunk/; revision=16636
This commit is contained in:
parent
ce7fb8c1b9
commit
07a3a7ec8e
3 changed files with 44 additions and 0 deletions
|
@ -291,6 +291,7 @@ INT CommandMemory (LPTSTR, LPTSTR);
|
|||
|
||||
|
||||
/* Prototypes for MISC.C */
|
||||
INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size);
|
||||
TCHAR cgetchar (VOID);
|
||||
BOOL CheckCtrlBreak (INT);
|
||||
LPTSTR *split (LPTSTR, LPINT, BOOL);
|
||||
|
|
|
@ -148,6 +148,46 @@ VOID FreeLastPath (VOID)
|
|||
free (lpLastPath);
|
||||
}
|
||||
|
||||
/* help functions for getting current path from driver
|
||||
without changing driver. Return code 0 = ok, 1 = fail.
|
||||
INT GetRootPath("C:",outbuffer,chater size of outbuffer);
|
||||
the frist param can have any size, if the the two frist
|
||||
letter are not a drive with : it will get Currentpath on
|
||||
current drive exacly as GetCurrentDirectory does.
|
||||
*/
|
||||
|
||||
INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size)
|
||||
{
|
||||
INT retcode = 1;
|
||||
INT t;
|
||||
|
||||
for (t=0;t<32;t++)
|
||||
{
|
||||
if (_tgetdcwd(t,OutPath,size) != NULL)
|
||||
{
|
||||
if (_tcsncicmp(InPath,OutPath,2))
|
||||
{
|
||||
retcode = 0;
|
||||
return retcode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* fail to getting path devic did not exists */
|
||||
if (_tcslen(InPath)>1)
|
||||
{
|
||||
if (InPath[1]==_T(':'))
|
||||
return 1;
|
||||
}
|
||||
|
||||
retcode = GetCurrentDirectory(size,OutPath);
|
||||
if (retcode==0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CD / CHDIR
|
||||
*
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <shellapi.h>
|
||||
|
||||
#include <tchar.h>
|
||||
#include <direct.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -15,3 +17,4 @@
|
|||
#include "cmd.h"
|
||||
#include "config.h"
|
||||
#include "batch.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue