mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:52:57 +00:00
- Make dp0 give the directory the batch was run from instead of the current directory.
svn path=/trunk/; revision=32074
This commit is contained in:
parent
cf39f6646d
commit
4e8df678d2
3 changed files with 5 additions and 4 deletions
|
@ -220,6 +220,7 @@ VOID ExitBatch (LPTSTR msg)
|
||||||
BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
LPTSTR tmp;
|
||||||
SetLastError(0);
|
SetLastError(0);
|
||||||
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
|
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
||||||
|
@ -269,6 +270,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
}
|
}
|
||||||
|
|
||||||
bc->hBatchFile = hFile;
|
bc->hBatchFile = hFile;
|
||||||
|
tmp = _tcsrchr(fullname, '\\');
|
||||||
|
_tcsncpy(bc->BatchFilePath, fullname, ((_tcslen(fullname) - _tcslen(tmp)) + 1));
|
||||||
SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
|
SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
|
||||||
bc->bEcho = bEcho; /* Preserve echo across batch calls */
|
bc->bEcho = bEcho; /* Preserve echo across batch calls */
|
||||||
bc->shiftlevel = 0;
|
bc->shiftlevel = 0;
|
||||||
|
|
|
@ -12,6 +12,7 @@ typedef struct tagBATCHCONTEXT
|
||||||
struct tagBATCHCONTEXT *prev;
|
struct tagBATCHCONTEXT *prev;
|
||||||
LPWIN32_FIND_DATA ffind;
|
LPWIN32_FIND_DATA ffind;
|
||||||
HANDLE hBatchFile;
|
HANDLE hBatchFile;
|
||||||
|
TCHAR BatchFilePath[MAX_PATH];
|
||||||
LPTSTR forproto;
|
LPTSTR forproto;
|
||||||
LPTSTR params;
|
LPTSTR params;
|
||||||
LPTSTR raw_params; /* Holds the raw params given by the input */
|
LPTSTR raw_params; /* Holds the raw params given by the input */
|
||||||
|
|
|
@ -1300,11 +1300,8 @@ GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA )
|
||||||
if ( varNameLen )
|
if ( varNameLen )
|
||||||
*varNameLen = 4;
|
*varNameLen = 4;
|
||||||
varName += 2;
|
varName += 2;
|
||||||
if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
|
return bc->BatchFilePath;
|
||||||
return NULL;
|
|
||||||
GetCurrentDirectory(MAX_PATH, ret);
|
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
case _T('0'):
|
case _T('0'):
|
||||||
case _T('1'):
|
case _T('1'):
|
||||||
case _T('2'):
|
case _T('2'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue