mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
compatibility fixes
svn path=/trunk/; revision=403
This commit is contained in:
parent
94f82b0796
commit
73a193b7fe
16 changed files with 243 additions and 110 deletions
|
@ -316,8 +316,14 @@ INT cmd_attrib (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if (argc == 0)
|
||||
{
|
||||
GetCurrentDirectory (MAX_PATH, szPath);
|
||||
_tcscat (szPath, _T("\\"));
|
||||
DWORD len;
|
||||
|
||||
len = GetCurrentDirectory (MAX_PATH, szPath);
|
||||
if (szPath[len-1] != _T('\\'))
|
||||
{
|
||||
szPath[len] = _T('\\');
|
||||
szPath[len + 1] = 0;
|
||||
}
|
||||
_tcscpy (szFileName, _T("*.*"));
|
||||
PrintAttribute (szPath, szFileName, bRecurse);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
|
|||
#ifndef __REACTOS__
|
||||
_tcsnset (str, _T('\0'), maxlen);
|
||||
#else
|
||||
memset (str, 0, maxlen * sizeof(TCHAR));
|
||||
memset (str, 0, maxlen * sizeof(TCHAR));
|
||||
#endif
|
||||
SetCursorXY (orgx, orgy);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
|
||||
|
||||
|
||||
/* internal variables for paged output */
|
||||
SHORT sLineCount;
|
||||
SHORT sMaxLines;
|
||||
BOOL bPageable;
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
VOID DebugPrintf (LPTSTR szFormat, ...)
|
||||
{
|
||||
|
@ -38,7 +31,9 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
|
|||
va_end (arg_ptr);
|
||||
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
|
||||
// OutputDebugString (szOut);
|
||||
#if 0
|
||||
OutputDebugString (szOut);
|
||||
#endif
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
@ -70,9 +65,6 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
|
|||
|
||||
do
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
WaitForSingleObject (hInput, INFINITE);
|
||||
#endif
|
||||
ReadConsoleInput (hInput, lpBuffer, 1, &dwRead);
|
||||
if ((lpBuffer->EventType == KEY_EVENT) &&
|
||||
(lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
|
||||
|
@ -127,8 +119,10 @@ VOID ConOutPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
|
||||
// WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
#if 0
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
#endif
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,8 +153,10 @@ VOID ConErrPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
|
||||
// WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
#if 0
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
#endif
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,8 +174,6 @@ VOID ConErrPrintf (LPTSTR szFormat, ...)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
VOID SetCursorXY (SHORT x, SHORT y)
|
||||
{
|
||||
COORD coPos;
|
||||
|
@ -241,5 +235,5 @@ VOID SetCursorType (BOOL bInsert, BOOL bVisible)
|
|||
cci.dwSize = bInsert ? 10 : 100;
|
||||
cci.bVisible = bVisible;
|
||||
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ TCHAR cgetchar (VOID)
|
|||
|
||||
do
|
||||
{
|
||||
WaitForSingleObject (hInput, INFINITE);
|
||||
ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
|
||||
if ((irBuffer.EventType == KEY_EVENT) &&
|
||||
(irBuffer.Event.KeyEvent.bKeyDown == TRUE))
|
||||
|
|
|
@ -63,7 +63,10 @@
|
|||
*
|
||||
* 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||
* Replaced find_which() by SearchForExecutable().
|
||||
* Now files are serched with the right order of extensions.
|
||||
* Now files are searched using the right extension order.
|
||||
*
|
||||
* 20-Apr-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||
* Some minor changes and improvements.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -89,25 +92,20 @@ BOOL
|
|||
SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||
{
|
||||
TCHAR szPathBuffer[MAX_PATH];
|
||||
LPTSTR pszBuffer = NULL;
|
||||
DWORD dwBuffer;
|
||||
LPTSTR pszBuffer = NULL;
|
||||
DWORD dwBuffer, len;
|
||||
INT n;
|
||||
LPTSTR p,s,f;
|
||||
|
||||
/* load environment varable PATH into buffer */
|
||||
pszBuffer = (LPTSTR)malloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer == 0)
|
||||
{
|
||||
ConErrPrintf (_T("No PATH environment variable found!\n"));
|
||||
}
|
||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
{
|
||||
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
|
||||
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer * sizeof (TCHAR));
|
||||
}
|
||||
|
||||
|
||||
/* initialize full name buffer */
|
||||
*pFullName = _T('\0');
|
||||
|
||||
|
@ -120,9 +118,12 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
#endif
|
||||
|
||||
/* search in current directory */
|
||||
GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
p = szPathBuffer + _tcslen (szPathBuffer);
|
||||
|
@ -134,7 +135,6 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
|
||||
#endif
|
||||
ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
||||
|
||||
if (IsValidFileName (szPathBuffer))
|
||||
{
|
||||
|
@ -165,8 +165,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
s = NULL;
|
||||
}
|
||||
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = _tcslen(szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
p = szPathBuffer + _tcslen (szPathBuffer);
|
||||
|
@ -200,9 +204,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
#endif
|
||||
|
||||
/* search in current directory */
|
||||
GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -237,8 +244,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
s = NULL;
|
||||
}
|
||||
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = _tcslen(szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -9,13 +9,16 @@ int _findfirst(const char *_name, struct _finddata_t *result)
|
|||
{
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
char dir[MAX_PATH];
|
||||
|
||||
|
||||
long hFindFile;
|
||||
int len = 0;
|
||||
|
||||
if ( _name == NULL || _name[0] == 0 ) {
|
||||
GetCurrentDirectory(MAX_PATH,dir);
|
||||
strcat(dir,"\\*.*");
|
||||
len = GetCurrentDirectory(MAX_PATH,dir);
|
||||
if (dir[len-1] != '\\') {
|
||||
dir[len] = '\\';
|
||||
dir[len+1] = 0;
|
||||
}
|
||||
strcat(dir,"*.*");
|
||||
}
|
||||
else
|
||||
strcpy(dir,_name);
|
||||
|
@ -48,9 +51,8 @@ int _findnext(int handle, struct _finddata_t *result)
|
|||
strncpy(result->name,FindFileData.cFileName,260);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _findclose(int handle)
|
||||
{
|
||||
return FindClose((void *)handle);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
@ -79,6 +81,11 @@ DWORD STDCALL GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
|
|||
lpBuffer[2] = 0;
|
||||
lstrcpyW(&lpBuffer[2], DriveDirectoryW[CurrentDrive]);
|
||||
}
|
||||
if (uSize > 3 && lpBuffer[uSize - 1] == L'\\')
|
||||
{
|
||||
lpBuffer[uSize - 1] = 0;
|
||||
uSize--;
|
||||
}
|
||||
DPRINT("GetCurrentDirectoryW() = '%w'\n",lpBuffer);
|
||||
return uSize;
|
||||
}
|
||||
|
@ -164,7 +171,12 @@ WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
GetCurrentDirectoryW(MAX_PATH, PathName);
|
||||
len = GetCurrentDirectoryW(MAX_PATH, PathName);
|
||||
if (PathName[len-1] != '\\')
|
||||
{
|
||||
PathName[len] = '\\';
|
||||
PathName[len+1] = 0;
|
||||
}
|
||||
lstrcatW(PathName, lpPathName);
|
||||
len = lstrlenW(PathName);
|
||||
if (PathName[len-1] != '\\')
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -168,7 +168,84 @@ DWORD STDCALL GetFullPathNameA(LPCSTR lpFileName,
|
|||
LPSTR lpBuffer,
|
||||
LPSTR *lpFilePart)
|
||||
{
|
||||
|
||||
PSTR p;
|
||||
PSTR prev = NULL;
|
||||
|
||||
DPRINT("GetFullPathNameA(lpFileName %s, nBufferLength %d, lpBuffer %s, "
|
||||
"lpFilePart %x)\n",lpFileName,nBufferLength,lpBuffer,lpFilePart);
|
||||
|
||||
if (!lpFileName || !lpBuffer)
|
||||
return 0;
|
||||
|
||||
if (isalpha(lpFileName[0]) && lpFileName[1] == ':')
|
||||
{
|
||||
lstrcpyA(lpBuffer, lpFileName);
|
||||
}
|
||||
else if (lpFileName[0] == '\\')
|
||||
{
|
||||
GetCurrentDirectoryA(nBufferLength, lpBuffer);
|
||||
lstrcpyA(&lpBuffer[2], lpFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD len;
|
||||
len = GetCurrentDirectoryA(nBufferLength, lpBuffer);
|
||||
if (lpBuffer[len - 1] != '\\')
|
||||
{
|
||||
lpBuffer[len] = '\\';
|
||||
lpBuffer[len + 1] = 0;
|
||||
}
|
||||
lstrcatA(lpBuffer, lpFileName);
|
||||
}
|
||||
|
||||
DPRINT("lpBuffer %s\n",lpBuffer);
|
||||
|
||||
p = lpBuffer + 2;
|
||||
|
||||
while ((*p) != 0)
|
||||
{
|
||||
DPRINT("prev %s p %s\n",prev,p);
|
||||
if (p[1] == '.' && (p[2] == '\\' || p[2] == 0))
|
||||
{
|
||||
lstrcpyA(p, p+2);
|
||||
}
|
||||
else if (p[1] == '.' && p[2] == '.' && (p[3] == '\\' || p[3] == 0) &&
|
||||
prev != NULL)
|
||||
{
|
||||
lstrcpyA(prev, p+3);
|
||||
p = prev;
|
||||
if (prev == (lpBuffer+2))
|
||||
{
|
||||
prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != '\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = p;
|
||||
do
|
||||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != '\\');
|
||||
}
|
||||
}
|
||||
|
||||
if (lpFilePart != NULL)
|
||||
{
|
||||
(*lpFilePart) = prev;
|
||||
}
|
||||
|
||||
DPRINT("lpBuffer %s\n",lpBuffer);
|
||||
|
||||
return strlen(lpBuffer);
|
||||
}
|
||||
|
||||
DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
||||
|
@ -182,7 +259,8 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
DPRINT("GetFullPathNameW(lpFileName %w, nBufferLength %d, lpBuffer %w, "
|
||||
"lpFilePart %x)\n",lpFileName,nBufferLength,lpBuffer,lpFilePart);
|
||||
|
||||
if (!lpFileName || !lpBuffer) return 0;
|
||||
if (!lpFileName || !lpBuffer)
|
||||
return 0;
|
||||
|
||||
if (isalpha(lpFileName[0]) && lpFileName[1] == ':')
|
||||
{
|
||||
|
@ -190,10 +268,18 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
}
|
||||
else if (lpFileName[0] == '\\')
|
||||
{
|
||||
GetCurrentDirectoryW(nBufferLength, lpBuffer);
|
||||
lstrcpyW(&lpBuffer[2], lpFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD len;
|
||||
len = GetCurrentDirectoryW(nBufferLength, lpBuffer);
|
||||
if (lpBuffer[len - 1] != L'\\')
|
||||
{
|
||||
lpBuffer[len] = L'\\';
|
||||
lpBuffer[len + 1] = 0;
|
||||
}
|
||||
lstrcatW(lpBuffer, lpFileName);
|
||||
}
|
||||
|
||||
|
@ -247,13 +333,6 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
return wcslen(lpBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetShortPathNameA(
|
||||
|
|
|
@ -419,7 +419,7 @@ DWORD STDCALL GetFileAttributesW(LPCWSTR lpFileName)
|
|||
{
|
||||
CloseHandle(hFile);
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
return (DWORD)FileBasic.FileAttributes;
|
||||
|
|
|
@ -112,11 +112,20 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING DirectoryNameStr;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
DWORD Len = 0;
|
||||
|
||||
DPRINT("FindFirstFileW(lpFileName %w, lpFindFileData %x)\n",
|
||||
lpFileName, lpFindFileData);
|
||||
|
||||
GetCurrentDirectoryW(MAX_PATH, CurrentDirectory);
|
||||
|
||||
/*
|
||||
Len = GetCurrentDirectoryW(MAX_PATH, CurrentDirectory);
|
||||
if (CurrentDirectory[Len - 1] != L'\\')
|
||||
{
|
||||
CurrentDirectory[Len] = L'\\';
|
||||
CurrentDirectory[Len + 1] = 0;
|
||||
}
|
||||
*/
|
||||
GetFullPathNameW(lpFileName, MAX_PATH, CurrentDirectory, NULL);
|
||||
Directory[0] = '\\';
|
||||
Directory[1] = '?';
|
||||
Directory[2] = '?';
|
||||
|
@ -125,8 +134,8 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
DPRINT("Directory %w\n",Directory);
|
||||
wcscat(Directory, CurrentDirectory);
|
||||
DPRINT("Directory %w\n",Directory);
|
||||
wcscat(Directory, lpFileName);
|
||||
DPRINT("Directory %w\n",Directory);
|
||||
// wcscat(Directory, lpFileName);
|
||||
// DPRINT("Directory %w\n",Directory);
|
||||
End = wcsrchr(Directory, '\\');
|
||||
*End = 0;
|
||||
|
||||
|
@ -270,7 +279,12 @@ BOOL FindClose(HANDLE hFindFile)
|
|||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
||||
DPRINT("FindClose(hFindFile %x)\n",hFindFile);
|
||||
|
||||
|
||||
if (hFindFile || hFindFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
SetLastError (ERROR_INVALID_HANDLE);
|
||||
return(FALSE);
|
||||
}
|
||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||
CloseHandle(IData->DirectoryHandle);
|
||||
HeapFree(GetProcessHeap(), 0, IData);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <ntdll/ldr.h>
|
||||
#include <internal/teb.h>
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
@ -218,7 +218,8 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName,
|
|||
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||
NTSTATUS Status;
|
||||
HANDLE hSection;
|
||||
|
||||
DWORD len = 0;
|
||||
|
||||
hFile = NULL;
|
||||
|
||||
/*
|
||||
|
@ -250,7 +251,12 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName,
|
|||
}
|
||||
if (TempFileName[1] != ':')
|
||||
{
|
||||
GetCurrentDirectoryW(MAX_PATH,TempDirectoryName);
|
||||
len = GetCurrentDirectoryW(MAX_PATH,TempDirectoryName);
|
||||
if (TempDirectoryName[len - 1] != L'\\')
|
||||
{
|
||||
TempDirectoryName[len] = L'\\';
|
||||
TempDirectoryName[len + 1] = 0;
|
||||
}
|
||||
wcscat(TempApplicationName,TempDirectoryName);
|
||||
}
|
||||
wcscat(TempApplicationName,TempFileName);
|
||||
|
|
|
@ -316,8 +316,14 @@ INT cmd_attrib (LPTSTR cmd, LPTSTR param)
|
|||
|
||||
if (argc == 0)
|
||||
{
|
||||
GetCurrentDirectory (MAX_PATH, szPath);
|
||||
_tcscat (szPath, _T("\\"));
|
||||
DWORD len;
|
||||
|
||||
len = GetCurrentDirectory (MAX_PATH, szPath);
|
||||
if (szPath[len-1] != _T('\\'))
|
||||
{
|
||||
szPath[len] = _T('\\');
|
||||
szPath[len + 1] = 0;
|
||||
}
|
||||
_tcscpy (szFileName, _T("*.*"));
|
||||
PrintAttribute (szPath, szFileName, bRecurse);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
|
|||
#ifndef __REACTOS__
|
||||
_tcsnset (str, _T('\0'), maxlen);
|
||||
#else
|
||||
memset (str, 0, maxlen * sizeof(TCHAR));
|
||||
memset (str, 0, maxlen * sizeof(TCHAR));
|
||||
#endif
|
||||
SetCursorXY (orgx, orgy);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
|
||||
|
||||
|
||||
/* internal variables for paged output */
|
||||
SHORT sLineCount;
|
||||
SHORT sMaxLines;
|
||||
BOOL bPageable;
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
VOID DebugPrintf (LPTSTR szFormat, ...)
|
||||
{
|
||||
|
@ -38,7 +31,9 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
|
|||
va_end (arg_ptr);
|
||||
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
|
||||
// OutputDebugString (szOut);
|
||||
#if 0
|
||||
OutputDebugString (szOut);
|
||||
#endif
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
@ -70,9 +65,6 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
|
|||
|
||||
do
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
WaitForSingleObject (hInput, INFINITE);
|
||||
#endif
|
||||
ReadConsoleInput (hInput, lpBuffer, 1, &dwRead);
|
||||
if ((lpBuffer->EventType == KEY_EVENT) &&
|
||||
(lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
|
||||
|
@ -127,8 +119,10 @@ VOID ConOutPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
|
||||
// WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
#if 0
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
#endif
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,8 +153,10 @@ VOID ConErrPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
|
||||
// WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
#if 0
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
|
||||
#endif
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,8 +174,6 @@ VOID ConErrPrintf (LPTSTR szFormat, ...)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
VOID SetCursorXY (SHORT x, SHORT y)
|
||||
{
|
||||
COORD coPos;
|
||||
|
@ -241,5 +235,5 @@ VOID SetCursorType (BOOL bInsert, BOOL bVisible)
|
|||
cci.dwSize = bInsert ? 10 : 100;
|
||||
cci.bVisible = bVisible;
|
||||
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ TCHAR cgetchar (VOID)
|
|||
|
||||
do
|
||||
{
|
||||
WaitForSingleObject (hInput, INFINITE);
|
||||
ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
|
||||
if ((irBuffer.EventType == KEY_EVENT) &&
|
||||
(irBuffer.Event.KeyEvent.bKeyDown == TRUE))
|
||||
|
|
|
@ -63,7 +63,10 @@
|
|||
*
|
||||
* 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||
* Replaced find_which() by SearchForExecutable().
|
||||
* Now files are serched with the right order of extensions.
|
||||
* Now files are searched using the right extension order.
|
||||
*
|
||||
* 20-Apr-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||
* Some minor changes and improvements.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -89,25 +92,20 @@ BOOL
|
|||
SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||
{
|
||||
TCHAR szPathBuffer[MAX_PATH];
|
||||
LPTSTR pszBuffer = NULL;
|
||||
DWORD dwBuffer;
|
||||
LPTSTR pszBuffer = NULL;
|
||||
DWORD dwBuffer, len;
|
||||
INT n;
|
||||
LPTSTR p,s,f;
|
||||
|
||||
/* load environment varable PATH into buffer */
|
||||
pszBuffer = (LPTSTR)malloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer == 0)
|
||||
{
|
||||
ConErrPrintf (_T("No PATH environment variable found!\n"));
|
||||
}
|
||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
{
|
||||
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
|
||||
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer * sizeof (TCHAR));
|
||||
}
|
||||
|
||||
|
||||
/* initialize full name buffer */
|
||||
*pFullName = _T('\0');
|
||||
|
||||
|
@ -120,9 +118,12 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
#endif
|
||||
|
||||
/* search in current directory */
|
||||
GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
p = szPathBuffer + _tcslen (szPathBuffer);
|
||||
|
@ -134,7 +135,6 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
|||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
|
||||
#endif
|
||||
ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
||||
|
||||
if (IsValidFileName (szPathBuffer))
|
||||
{
|
||||
|
@ -165,8 +165,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
s = NULL;
|
||||
}
|
||||
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = _tcslen(szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
p = szPathBuffer + _tcslen (szPathBuffer);
|
||||
|
@ -200,9 +204,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
#endif
|
||||
|
||||
/* search in current directory */
|
||||
GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -237,8 +244,12 @@ ConOutPrintf(_T("Testing: \'%s\'\n"), szPathBuffer);
|
|||
s = NULL;
|
||||
}
|
||||
|
||||
if (szPathBuffer[_tcslen(szPathBuffer)-1] != _T('\\'))
|
||||
_tcscat (szPathBuffer, _T("\\"));
|
||||
len = _tcslen(szPathBuffer);
|
||||
if (szPathBuffer[len - 1] != _T('\\'))
|
||||
{
|
||||
szPathBuffer[len] = _T('\\');
|
||||
szPathBuffer[len + 1] = _T('\0');
|
||||
}
|
||||
_tcscat (szPathBuffer, pFileName);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
Loading…
Reference in a new issue