Use W32API.

svn path=/trunk/; revision=15957
This commit is contained in:
Filip Navara 2005-06-17 09:46:21 +00:00
parent 204dc0088b
commit a50fde81ae
7 changed files with 146 additions and 135 deletions

View file

@ -48,7 +48,7 @@ static SHORT yScreen = 0;
NTSTATUS NTSTATUS
GetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo); ConGetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -56,7 +56,7 @@ GetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo);
NTSTATUS NTSTATUS
AllocConsole(VOID) ConAllocConsole(VOID)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
@ -98,7 +98,7 @@ AllocConsole(VOID)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
GetConsoleScreenBufferInfo(&csbi); ConGetConsoleScreenBufferInfo(&csbi);
xScreen = csbi.dwSize.X; xScreen = csbi.dwSize.X;
yScreen = csbi.dwSize.Y; yScreen = csbi.dwSize.Y;
@ -108,7 +108,7 @@ AllocConsole(VOID)
VOID VOID
FreeConsole(VOID) ConFreeConsole(VOID)
{ {
DPRINT("FreeConsole() called\n"); DPRINT("FreeConsole() called\n");
@ -125,7 +125,7 @@ FreeConsole(VOID)
NTSTATUS NTSTATUS
WriteConsole(PCHAR Buffer, ConWriteConsole(PCHAR Buffer,
ULONG NumberOfCharsToWrite, ULONG NumberOfCharsToWrite,
PULONG NumberOfCharsWritten) PULONG NumberOfCharsWritten)
{ {
@ -192,7 +192,7 @@ ReadConsoleA(HANDLE hConsoleInput,
NTSTATUS NTSTATUS
ReadConsoleInput(PINPUT_RECORD Buffer) ConReadConsoleInput(PINPUT_RECORD Buffer)
{ {
IO_STATUS_BLOCK Iosb; IO_STATUS_BLOCK Iosb;
NTSTATUS Status; NTSTATUS Status;
@ -220,7 +220,7 @@ ReadConsoleInput(PINPUT_RECORD Buffer)
NTSTATUS NTSTATUS
ReadConsoleOutputCharacters(LPSTR lpCharacter, ConReadConsoleOutputCharacters(LPSTR lpCharacter,
ULONG nLength, ULONG nLength,
COORD dwReadCoord, COORD dwReadCoord,
PULONG lpNumberOfCharsRead) PULONG lpNumberOfCharsRead)
@ -252,7 +252,7 @@ ReadConsoleOutputCharacters(LPSTR lpCharacter,
NTSTATUS NTSTATUS
ReadConsoleOutputAttributes(PUSHORT lpAttribute, ConReadConsoleOutputAttributes(PUSHORT lpAttribute,
ULONG nLength, ULONG nLength,
COORD dwReadCoord, COORD dwReadCoord,
PULONG lpNumberOfAttrsRead) PULONG lpNumberOfAttrsRead)
@ -284,7 +284,7 @@ ReadConsoleOutputAttributes(PUSHORT lpAttribute,
NTSTATUS NTSTATUS
WriteConsoleOutputCharacters(LPCSTR lpCharacter, ConWriteConsoleOutputCharacters(LPCSTR lpCharacter,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord) COORD dwWriteCoord)
{ {
@ -323,7 +323,7 @@ WriteConsoleOutputCharacters(LPCSTR lpCharacter,
NTSTATUS NTSTATUS
WriteConsoleOutputCharactersW(LPCWSTR lpCharacter, ConWriteConsoleOutputCharactersW(LPCWSTR lpCharacter,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord) COORD dwWriteCoord)
{ {
@ -367,7 +367,7 @@ WriteConsoleOutputCharactersW(LPCWSTR lpCharacter,
NTSTATUS NTSTATUS
WriteConsoleOutputAttributes(CONST USHORT *lpAttribute, ConWriteConsoleOutputAttributes(CONST USHORT *lpAttribute,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord, COORD dwWriteCoord,
PULONG lpNumberOfAttrsWritten) PULONG lpNumberOfAttrsWritten)
@ -407,7 +407,7 @@ WriteConsoleOutputAttributes(CONST USHORT *lpAttribute,
NTSTATUS NTSTATUS
FillConsoleOutputAttribute(USHORT wAttribute, ConFillConsoleOutputAttribute(USHORT wAttribute,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord, COORD dwWriteCoord,
PULONG lpNumberOfAttrsWritten) PULONG lpNumberOfAttrsWritten)
@ -441,7 +441,7 @@ FillConsoleOutputAttribute(USHORT wAttribute,
NTSTATUS NTSTATUS
FillConsoleOutputCharacter(CHAR Character, ConFillConsoleOutputCharacter(CHAR Character,
ULONG Length, ULONG Length,
COORD WriteCoord, COORD WriteCoord,
PULONG NumberOfCharsWritten) PULONG NumberOfCharsWritten)
@ -562,7 +562,7 @@ SetConsoleMode(HANDLE hConsoleHandle,
NTSTATUS NTSTATUS
GetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo) ConGetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo)
{ {
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status; NTSTATUS Status;
@ -583,7 +583,7 @@ GetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo)
NTSTATUS NTSTATUS
SetConsoleCursorInfo(PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) ConSetConsoleCursorInfo(PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
{ {
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status; NTSTATUS Status;
@ -604,13 +604,13 @@ SetConsoleCursorInfo(PCONSOLE_CURSOR_INFO lpConsoleCursorInfo)
NTSTATUS NTSTATUS
SetConsoleCursorPosition(COORD dwCursorPosition) ConSetConsoleCursorPosition(COORD dwCursorPosition)
{ {
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status; NTSTATUS Status;
Status = GetConsoleScreenBufferInfo(&ConsoleScreenBufferInfo); Status = ConGetConsoleScreenBufferInfo(&ConsoleScreenBufferInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
@ -633,7 +633,7 @@ SetConsoleCursorPosition(COORD dwCursorPosition)
NTSTATUS NTSTATUS
SetConsoleTextAttribute(USHORT wAttributes) ConSetConsoleTextAttribute(USHORT wAttributes)
{ {
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status; NTSTATUS Status;
@ -661,7 +661,7 @@ ConInKey(PINPUT_RECORD Buffer)
while (TRUE) while (TRUE)
{ {
ReadConsoleInput(Buffer); ConReadConsoleInput(Buffer);
if ((Buffer->EventType == KEY_EVENT) && if ((Buffer->EventType == KEY_EVENT) &&
(Buffer->Event.KeyEvent.bKeyDown == TRUE)) (Buffer->Event.KeyEvent.bKeyDown == TRUE))
@ -675,7 +675,7 @@ ConOutChar(CHAR c)
{ {
ULONG Written; ULONG Written;
WriteConsole(&c, ConWriteConsole(&c,
1, 1,
&Written); &Written);
} }
@ -686,10 +686,10 @@ ConOutPuts(LPSTR szText)
{ {
ULONG Written; ULONG Written;
WriteConsole(szText, ConWriteConsole(szText,
strlen(szText), strlen(szText),
&Written); &Written);
WriteConsole("\n", ConWriteConsole("\n",
1, 1,
&Written); &Written);
} }
@ -706,7 +706,7 @@ ConOutPrintf(LPSTR szFormat, ...)
vsprintf(szOut, szFormat, arg_ptr); vsprintf(szOut, szFormat, arg_ptr);
va_end(arg_ptr); va_end(arg_ptr);
WriteConsole(szOut, ConWriteConsole(szOut,
strlen(szOut), strlen(szOut),
&dwWritten); &dwWritten);
} }
@ -720,7 +720,7 @@ GetCursorX(VOID)
{ {
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(&csbi); ConGetConsoleScreenBufferInfo(&csbi);
return(csbi.dwCursorPosition.X); return(csbi.dwCursorPosition.X);
} }
@ -731,7 +731,7 @@ GetCursorY(VOID)
{ {
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(&csbi); ConGetConsoleScreenBufferInfo(&csbi);
return(csbi.dwCursorPosition.Y); return(csbi.dwCursorPosition.Y);
} }
@ -743,7 +743,7 @@ GetScreenSize(SHORT *maxx,
{ {
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(&csbi); ConGetConsoleScreenBufferInfo(&csbi);
if (maxx) if (maxx)
*maxx = csbi.dwSize.X; *maxx = csbi.dwSize.X;
@ -762,7 +762,7 @@ SetCursorType(BOOL bInsert,
cci.dwSize = bInsert ? 10 : 99; cci.dwSize = bInsert ? 10 : 99;
cci.bVisible = bVisible; cci.bVisible = bVisible;
SetConsoleCursorInfo(&cci); ConSetConsoleCursorInfo(&cci);
} }
@ -774,7 +774,7 @@ SetCursorXY(SHORT x,
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
SetConsoleCursorPosition(coPos); ConSetConsoleCursorPosition(coPos);
} }
@ -896,17 +896,17 @@ SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text)
Length = len - 1; Length = len - 1;
} }
FillConsoleOutputAttribute(0x70, ConFillConsoleOutputAttribute(0x70,
len, len,
coPos, coPos,
&Written); &Written);
WriteConsoleOutputCharactersW(Text, ConWriteConsoleOutputCharactersW(Text,
Length, Length,
coPos); coPos);
coPos.X += Length; coPos.X += Length;
FillConsoleOutputCharacter('_', ConFillConsoleOutputCharacter('_',
1, 1,
coPos, coPos,
&Written); &Written);
@ -914,7 +914,7 @@ SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text)
if (len > Length + 1) if (len > Length + 1)
{ {
coPos.X++; coPos.X++;
FillConsoleOutputCharacter(' ', ConFillConsoleOutputCharacter(' ',
len - Length - 1, len - Length - 1,
coPos, coPos,
&Written); &Written);
@ -934,12 +934,12 @@ SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text)
Length = strlen(Text); Length = strlen(Text);
WriteConsoleOutputCharacters(Text, ConWriteConsoleOutputCharacters(Text,
Length, Length,
coPos); coPos);
coPos.Y++; coPos.Y++;
FillConsoleOutputCharacter(0xCD, ConFillConsoleOutputCharacter(0xCD,
Length, Length,
coPos, coPos,
&Written); &Written);
@ -958,12 +958,12 @@ SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text)
Length = strlen(Text); Length = strlen(Text);
FillConsoleOutputAttribute(0x71, ConFillConsoleOutputAttribute(0x71,
Length, Length,
coPos, coPos,
&Written); &Written);
WriteConsoleOutputCharacters(Text, ConWriteConsoleOutputCharacters(Text,
Length, Length,
coPos); coPos);
} }
@ -981,12 +981,12 @@ SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text)
Length = strlen(Text); Length = strlen(Text);
FillConsoleOutputAttribute(0x1F, ConFillConsoleOutputAttribute(0x1F,
Length, Length,
coPos, coPos,
&Written); &Written);
WriteConsoleOutputCharacters(Text, ConWriteConsoleOutputCharacters(Text,
Length, Length,
coPos); coPos);
} }
@ -1006,7 +1006,7 @@ PrintTextXY(SHORT x, SHORT y, char* fmt, ...)
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
WriteConsoleOutputCharacters(buffer, ConWriteConsoleOutputCharacters(buffer,
strlen(buffer), strlen(buffer),
coPos); coPos);
} }
@ -1034,7 +1034,7 @@ PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...)
Length = len - 1; Length = len - 1;
} }
WriteConsoleOutputCharacters(buffer, ConWriteConsoleOutputCharacters(buffer,
Length, Length,
coPos); coPos);
@ -1042,7 +1042,7 @@ PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...)
if (len > Length) if (len > Length)
{ {
FillConsoleOutputCharacter(' ', ConFillConsoleOutputCharacter(' ',
len - Length, len - Length,
coPos, coPos,
&Written); &Written);

View file

@ -29,44 +29,53 @@
#include <ntos/keyboard.h> #include <ntos/keyboard.h>
#define AllocConsole ConAllocConsole
#define FreeConsole ConFreeConsole
#define ReadConsoleOutputCharacters ConReadConsoleOutputCharacters
#define ReadConsoleOutputAttributes ConReadConsoleOutputAttributes
#define WriteConsoleOutputCharacters ConWriteConsoleOutputCharacters
#define WriteConsoleOutputAttributes ConWriteConsoleOutputAttributes
#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute
#undef FillConsoleOutputCharacter
#define FillConsoleOutputCharacter ConFillConsoleOutputCharacter
NTSTATUS NTSTATUS
AllocConsole(VOID); ConAllocConsole(VOID);
VOID VOID
FreeConsole(VOID); ConFreeConsole(VOID);
NTSTATUS NTSTATUS
ReadConsoleOutputCharacters(LPSTR lpCharacter, ConReadConsoleOutputCharacters(LPSTR lpCharacter,
ULONG nLength, ULONG nLength,
COORD dwReadCoord, COORD dwReadCoord,
PULONG lpNumberOfCharsRead); PULONG lpNumberOfCharsRead);
NTSTATUS NTSTATUS
ReadConsoleOutputAttributes(PUSHORT lpAttribute, ConReadConsoleOutputAttributes(PUSHORT lpAttribute,
ULONG nLength, ULONG nLength,
COORD dwReadCoord, COORD dwReadCoord,
PULONG lpNumberOfAttrsRead); PULONG lpNumberOfAttrsRead);
NTSTATUS NTSTATUS
WriteConsoleOutputCharacters(LPCSTR lpCharacter, ConWriteConsoleOutputCharacters(LPCSTR lpCharacter,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord); COORD dwWriteCoord);
NTSTATUS NTSTATUS
WriteConsoleOutputAttributes(CONST USHORT *lpAttribute, ConWriteConsoleOutputAttributes(CONST USHORT *lpAttribute,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord, COORD dwWriteCoord,
PULONG lpNumberOfAttrsWritten); PULONG lpNumberOfAttrsWritten);
NTSTATUS NTSTATUS
FillConsoleOutputAttribute(USHORT wAttribute, ConFillConsoleOutputAttribute(USHORT wAttribute,
ULONG nLength, ULONG nLength,
COORD dwWriteCoord, COORD dwWriteCoord,
PULONG lpNumberOfAttrsWritten); PULONG lpNumberOfAttrsWritten);
NTSTATUS NTSTATUS
FillConsoleOutputCharacter(CHAR Character, ConFillConsoleOutputCharacter(CHAR Character,
ULONG Length, ULONG Length,
COORD WriteCoord, COORD WriteCoord,
PULONG NumberOfCharsWritten); PULONG NumberOfCharsWritten);

View file

@ -44,7 +44,7 @@ static BOOLEAN HasCurrentCabinet = FALSE;
static WCHAR CurrentCabinetName[MAX_PATH]; static WCHAR CurrentCabinetName[MAX_PATH];
NTSTATUS NTSTATUS
CreateDirectory(PWCHAR DirectoryName) SetupCreateDirectory(PWCHAR DirectoryName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;

View file

@ -28,7 +28,7 @@
#define __FILESUP_H__ #define __FILESUP_H__
NTSTATUS NTSTATUS
CreateDirectory(PWCHAR DirectoryName); SetupCreateDirectory(PWCHAR DirectoryName);
NTSTATUS NTSTATUS
SetupCopyFile(PWCHAR SourceFileName, SetupCopyFile(PWCHAR SourceFileName,

View file

@ -1 +1 @@
#include <ddk/ntddk.h> #include <ntos.h>

View file

@ -536,7 +536,7 @@ CheckUnattendedSetup(VOID)
* Number of the next page. * Number of the next page.
*/ */
static PAGE_NUMBER static PAGE_NUMBER
StartPage(PINPUT_RECORD Ir) SetupStartPage(PINPUT_RECORD Ir)
{ {
SYSTEM_DEVICE_INFORMATION Sdi; SYSTEM_DEVICE_INFORMATION Sdi;
NTSTATUS Status; NTSTATUS Status;
@ -2896,7 +2896,7 @@ PrepareCopyPageInfFile(HINF InfFile,
} }
/* Create the install directory */ /* Create the install directory */
Status = CreateDirectory(PathBuffer); Status = SetupCreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION) if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
@ -2967,7 +2967,7 @@ PrepareCopyPageInfFile(HINF InfFile,
DPRINT("FullPath: '%S'\n", PathBuffer); DPRINT("FullPath: '%S'\n", PathBuffer);
Status = CreateDirectory(PathBuffer); Status = SetupCreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION) if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
@ -3808,7 +3808,7 @@ NtProcessStartup(PPEB Peb)
{ {
/* Start page */ /* Start page */
case START_PAGE: case START_PAGE:
Page = StartPage(&Ir); Page = SetupStartPage(&Ir);
break; break;
/* License page */ /* License page */

View file

@ -2,7 +2,9 @@
<bootstrap base="reactos/system32" nameoncd="smss.exe" /> <bootstrap base="reactos/system32" nameoncd="smss.exe" />
<include base="usetup">.</include> <include base="usetup">.</include>
<include base="zlib">.</include> <include base="zlib">.</include>
<define name="__USE_W32API" />
<define name="_DISABLE_TIDENTS" /> <define name="_DISABLE_TIDENTS" />
<define name="_WIN32_WINNT">0x0502</define>
<linkerflag>-lgcc</linkerflag> <linkerflag>-lgcc</linkerflag>
<library>zlib</library> <library>zlib</library>
<library>vfatlib</library> <library>vfatlib</library>