Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

iostubs.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define SCREEN_BUFFER_POINTER(BASE, X, Y, XSIZE, CELLSIZE)   ((ULONG_PTR)BASE + ((XSIZE * (Y)) + (X)) * (ULONG)CELLSIZE)

Functions

BOOL APIENTRY GetConsoleInput (IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead, IN USHORT wFlags, IN BOOLEAN Unicode)
BOOL APIENTRY PeekConsoleInputA (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
 defined(BUILD_WOW6432)

BOOL APIENTRY PeekConsoleInputW (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
BOOL APIENTRY ReadConsoleInputA (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
BOOL APIENTRY ReadConsoleInputW (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
BOOL APIENTRY ReadConsoleInputExA (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead, USHORT wFlags)
BOOL APIENTRY ReadConsoleInputExW (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead, USHORT wFlags)
BOOL APIENTRY WriteConsoleInputInternal (IN HANDLE hConsoleInput, IN CONST INPUT_RECORD *lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten, IN BOOLEAN Unicode, IN BOOLEAN Append)
 defined(BUILD_WOW64)

BOOL APIENTRY WriteConsoleInputA (HANDLE hConsoleInput, CONST INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)
 defined(BUILD_WOW6432)

BOOL APIENTRY WriteConsoleInputW (HANDLE hConsoleInput, CONST INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)
VOID CopyRectangle (IN CONST CHAR_INFO *Source, IN COORD SourceSize, IN PSMALL_RECT SourceRect, OUT PCHAR_INFO Target, IN COORD TargetSize, IN COORD TargetPoint)
 defined(BUILD_WOW64)

BOOL APIENTRY ReadConsoleOutputInternal (IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion, IN BOOLEAN Unicode)
BOOL APIENTRY ReadConsoleOutputW (HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion)
 defined(BUILD_WOW6432)

BOOL APIENTRY ReadConsoleOutputA (HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion)
BOOL APIENTRY WriteConsoleOutputInternal (IN HANDLE hConsoleOutput, IN CONST CHAR_INFO *lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN PSMALL_RECT lpWriteRegion, IN BOOLEAN Unicode)
 defined(BUILD_WOW64)

BOOL APIENTRY WriteConsoleOutputW (HANDLE hConsoleOutput, CONST CHAR_INFO *lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion)
 defined(BUILD_WOW6432)

BOOL APIENTRY WriteConsoleOutputA (HANDLE hConsoleOutput, CONST CHAR_INFO *lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion)
BOOL APIENTRY ReadConsoleOutputString (IN HANDLE hConsoleOutput, OUT LPVOID lpString, IN DWORD nLength, IN DWORD nSize, IN DWORD fFlags, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfElementsRead)
BOOL APIENTRY ReadConsoleOutputCharacterA (HANDLE hConsoleOutput, LPSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead)
 defined(BUILD_WOW6432)

BOOL APIENTRY ReadConsoleOutputCharacterW (HANDLE hConsoleOutput, LPWSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead)
BOOL APIENTRY ReadConsoleOutputAttribute (HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead)
BOOL APIENTRY WriteConsoleOutputString (IN HANDLE hConsoleOutput, IN CONST VOID *lpString, IN DWORD nLength, IN DWORD nSize, IN DWORD fFlags, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfElementsWritten)
 defined(BUILD_WOW64)

BOOL APIENTRY WriteConsoleOutputCharacterA (HANDLE hConsoleOutput, LPCSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten)
 defined(BUILD_WOW6432)

BOOL APIENTRY WriteConsoleOutputCharacterW (HANDLE hConsoleOutput, LPCWSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten)
BOOL APIENTRY WriteConsoleOutputAttribute (HANDLE hConsoleOutput, CONST WORD *lpAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten)
BOOL APIENTRY FillConsoleOutput (IN HANDLE hConsoleOutput, IN WORD Element, IN DWORD nLength, IN DWORD fFlags, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfElementsWritten)
 defined(BUILD_WOW64)

BOOL APIENTRY FillConsoleOutputCharacterA (HANDLE hConsoleOutput, CHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten)
 defined(BUILD_WOW6432)

BOOL APIENTRY FillConsoleOutputCharacterW (HANDLE hConsoleOutput, WCHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten)
BOOL APIENTRY FillConsoleOutputAttribute (HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten)
HANDLE WINAPI CreateConsoleScreenBuffer (IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN CONST SECURITY_ATTRIBUTES *lpSecurityAttributes, IN DWORD dwFlags, IN PVOID lpScreenBufferData OPTIONAL)
 defined(BUILD_WOW64)

BOOL WINAPI InvalidateConsoleDIBits (IN HANDLE hConsoleOutput, IN PSMALL_RECT lpRect)


Define Documentation

#define SCREEN_BUFFER_POINTER BASE,
X,
Y,
XSIZE,
CELLSIZE   )     ((ULONG_PTR)BASE + ((XSIZE * (Y)) + (X)) * (ULONG)CELLSIZE)
 

Referenced by CopyRectangle(), FE_WriteRegionToScreenHW(), FsVgaCopyFrameBuffer(), FsVgaReverseMousePointer(), FsVgaWriteToFrameBuffer(), ReadRectFromScreenBuffer(), and WWSB_WriteRectToScreenBuffer().


Function Documentation

VOID CopyRectangle IN CONST CHAR_INFO *  Source,
IN COORD  SourceSize,
IN PSMALL_RECT  SourceRect,
OUT PCHAR_INFO  Target,
IN COORD  TargetSize,
IN COORD  TargetPoint
 

defined(BUILD_WOW64)

Definition at line 472 of file iostubs.c.

References ASSERT, CONSOLE_RECT_SIZE_X, CONSOLE_RECT_SIZE_Y, FALSE, SCREEN_BUFFER_POINTER, SHORT, and TRUE.

00483 : 00484 00485 This routine copies a rectangular region, doing any necessary clipping. 00486 00487 Arguments: 00488 00489 Source - pointer to source buffer 00490 00491 SourceSize - dimensions of source buffer 00492 00493 SourceRect - rectangle in source buffer to copy 00494 00495 Target - pointer to target buffer 00496 00497 TargetSize - dimensions of target buffer 00498 00499 TargetPoint - upper left coordinates of target rectangle 00500 00501 Return Value: 00502 00503 00504 --*/ 00505 00506 { 00507 00508 #define SCREEN_BUFFER_POINTER(BASE,X,Y,XSIZE,CELLSIZE) ((ULONG_PTR)BASE + ((XSIZE * (Y)) + (X)) * (ULONG)CELLSIZE) 00509 00510 CONST CHAR_INFO *SourcePtr; 00511 PCHAR_INFO TargetPtr; 00512 SHORT i,j; 00513 SHORT XSize,YSize; 00514 BOOLEAN WholeSource,WholeTarget; 00515 00516 XSize = (SHORT)CONSOLE_RECT_SIZE_X(SourceRect); 00517 YSize = (SHORT)CONSOLE_RECT_SIZE_Y(SourceRect); 00518 00519 // do clipping. we only clip for target, not source. 00520 00521 if (XSize > (SHORT)(TargetSize.X - TargetPoint.X + 1)) { 00522 XSize = (SHORT)(TargetSize.X - TargetPoint.X + 1); 00523 } 00524 if (YSize > (SHORT)(TargetSize.Y - TargetPoint.Y + 1)) { 00525 YSize = (SHORT)(TargetSize.Y - TargetPoint.Y + 1); 00526 } 00527 00528 WholeSource = WholeTarget = FALSE; 00529 if (XSize == SourceSize.X) { 00530 ASSERT (SourceRect->Left == 0); 00531 if (SourceRect->Top == 0) { 00532 SourcePtr = Source; 00533 } 00534 else { 00535 SourcePtr = (PCHAR_INFO) SCREEN_BUFFER_POINTER(Source, 00536 SourceRect->Left, 00537 SourceRect->Top, 00538 SourceSize.X, 00539 sizeof(CHAR_INFO)); 00540 } 00541 WholeSource = TRUE; 00542 } 00543 if (XSize == TargetSize.X) { 00544 ASSERT (TargetPoint.X == 0); 00545 if (TargetPoint.Y == 0) { 00546 TargetPtr = Target; 00547 } 00548 else { 00549 TargetPtr = (PCHAR_INFO) SCREEN_BUFFER_POINTER(Target, 00550 TargetPoint.X, 00551 TargetPoint.Y, 00552 TargetSize.X, 00553 sizeof(CHAR_INFO)); 00554 } 00555 WholeTarget = TRUE; 00556 } 00557 if (WholeSource && WholeTarget) { 00558 memmove(TargetPtr,SourcePtr,XSize*YSize*sizeof(CHAR_INFO)); 00559 return; 00560 } 00561 00562 for (i=0;i<YSize;i++) { 00563 if (!WholeTarget) { 00564 TargetPtr = (PCHAR_INFO) SCREEN_BUFFER_POINTER(Target, 00565 TargetPoint.X, 00566 TargetPoint.Y+i, 00567 TargetSize.X, 00568 sizeof(CHAR_INFO)); 00569 } 00570 if (!WholeSource) { 00571 SourcePtr = (PCHAR_INFO) SCREEN_BUFFER_POINTER(Source, 00572 SourceRect->Left, 00573 SourceRect->Top+i, 00574 SourceSize.X, 00575 sizeof(CHAR_INFO)); 00576 } 00577 for (j=0;j<XSize;j++,SourcePtr++,TargetPtr++) { 00578 *TargetPtr = *SourcePtr; 00579 } 00580 } 00581 }

HANDLE WINAPI CreateConsoleScreenBuffer IN DWORD  dwDesiredAccess,
IN DWORD  dwShareMode,
IN CONST SECURITY_ATTRIBUTES *  lpSecurityAttributes,
IN DWORD  dwFlags,
IN PVOID lpScreenBufferData  OPTIONAL
 

defined(BUILD_WOW64)

Definition at line 1666 of file iostubs.c.

References CONSOLE_GRAPHICS_BUFFER, CONSOLE_TEXTMODE_BUFFER, _CONSOLE_CREATESCREENBUFFER_MSG::ConsoleHandle, ConsolepCreateScreenBuffer, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), _CONSOLE_CREATESCREENBUFFER_MSG::DesiredAccess, dwFlags, EXCEPTION_EXECUTE_HANDLER, FALSE, _CONSOLE_CREATESCREENBUFFER_MSG::Flags, GET_CONSOLE_HANDLE, _CONSOLE_CREATESCREENBUFFER_MSG::GraphicsBufferInfo, _CONSOLE_CREATESCREENBUFFER_MSG::InheritHandle, INVALID_HANDLE_VALUE, NT_SUCCESS, NULL, SET_LAST_ERROR, SET_LAST_NT_ERROR, _CONSOLE_CREATESCREENBUFFER_MSG::ShareMode, _CONSOLE_API_MSG::u, VALID_ACCESSES, and VALID_SHARE_ACCESSES.

Referenced by main().

01673 { 01674 CONSOLE_API_MSG m; 01675 PCONSOLE_CREATESCREENBUFFER_MSG a = &m.u.CreateConsoleScreenBuffer; 01676 PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo; 01677 PCSR_CAPTURE_HEADER CaptureBuffer=NULL; 01678 01679 if (dwDesiredAccess & ~VALID_ACCESSES || 01680 dwShareMode & ~VALID_SHARE_ACCESSES || 01681 (dwFlags != CONSOLE_TEXTMODE_BUFFER && 01682 dwFlags != CONSOLE_GRAPHICS_BUFFER)) { 01683 SET_LAST_ERROR(ERROR_INVALID_PARAMETER); 01684 return (HANDLE) INVALID_HANDLE_VALUE; 01685 } 01686 a->ConsoleHandle = GET_CONSOLE_HANDLE; 01687 a->DesiredAccess = dwDesiredAccess; 01688 if (ARGUMENT_PRESENT(lpSecurityAttributes)) { 01689 a->InheritHandle = lpSecurityAttributes->bInheritHandle; 01690 } 01691 else { 01692 a->InheritHandle = FALSE; 01693 } 01694 a->ShareMode = dwShareMode; 01695 a->Flags = dwFlags; 01696 if (dwFlags == CONSOLE_GRAPHICS_BUFFER) { 01697 if (a->InheritHandle || lpScreenBufferData == NULL) { 01698 SET_LAST_ERROR(ERROR_INVALID_PARAMETER); 01699 return (HANDLE) INVALID_HANDLE_VALUE; 01700 } 01701 GraphicsBufferInfo = lpScreenBufferData; 01702 try { 01703 a->GraphicsBufferInfo = *GraphicsBufferInfo; 01704 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 01705 a->GraphicsBufferInfo.dwBitMapInfoLength 01706 ); 01707 if (CaptureBuffer == NULL) { 01708 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 01709 return (HANDLE) INVALID_HANDLE_VALUE; 01710 } 01711 CsrCaptureMessageBuffer( CaptureBuffer, 01712 (PCHAR) GraphicsBufferInfo->lpBitMapInfo, 01713 a->GraphicsBufferInfo.dwBitMapInfoLength, 01714 (PVOID *) &a->GraphicsBufferInfo.lpBitMapInfo 01715 ); 01716 01717 } except( EXCEPTION_EXECUTE_HANDLER ) { 01718 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01719 return (HANDLE) INVALID_HANDLE_VALUE; 01720 } 01721 } 01722 CsrClientCallServer( (PCSR_API_MSG)&m, 01723 CaptureBuffer, 01724 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 01725 ConsolepCreateScreenBuffer 01726 ), 01727 sizeof( *a ) 01728 ); 01729 if (CaptureBuffer != NULL) { 01730 CsrFreeCaptureBuffer( CaptureBuffer ); 01731 } 01732 if (!NT_SUCCESS( m.ReturnValue)) { 01733 SET_LAST_NT_ERROR(m.ReturnValue); 01734 return (HANDLE) INVALID_HANDLE_VALUE; 01735 } 01736 else { 01737 if (dwFlags == CONSOLE_GRAPHICS_BUFFER) { 01738 try { 01739 GraphicsBufferInfo->hMutex = a->hMutex; 01740 GraphicsBufferInfo->lpBitMap = a->lpBitmap; 01741 } except( EXCEPTION_EXECUTE_HANDLER ) { 01742 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01743 return (HANDLE) INVALID_HANDLE_VALUE; 01744 } 01745 } 01746 return a->Handle; 01747 } 01748 }

BOOL APIENTRY FillConsoleOutput IN HANDLE  hConsoleOutput,
IN WORD  Element,
IN DWORD  nLength,
IN DWORD  fFlags,
IN COORD  dwWriteCoord,
OUT LPDWORD  lpNumberOfElementsWritten
 

defined(BUILD_WOW64)

Definition at line 1448 of file iostubs.c.

References _CONSOLE_FILLCONSOLEOUTPUT_MSG::ConsoleHandle, ConsolepFillConsoleOutput, CsrClientCallServer(), _CONSOLE_FILLCONSOLEOUTPUT_MSG::Element, _CONSOLE_FILLCONSOLEOUTPUT_MSG::ElementType, EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, _CONSOLE_FILLCONSOLEOUTPUT_MSG::Length, NT_SUCCESS, NULL, _CONSOLE_FILLCONSOLEOUTPUT_MSG::OutputHandle, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, _CONSOLE_API_MSG::u, and _CONSOLE_FILLCONSOLEOUTPUT_MSG::WriteCoord.

Referenced by FillConsoleOutputAttribute(), FillConsoleOutputCharacterA(), and FillConsoleOutputCharacterW().

01459 : 01460 01461 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01462 that is to be written. The handle must have been created with 01463 GENERIC_WRITE access. 01464 01465 Element - The attribute or character to write. 01466 01467 nLength - Number of times to write the element. 01468 01469 fFlags - flag indicating what type of element to write. 01470 01471 dwWriteCoord - Screen buffer coordinates to write the element to. 01472 01473 lpNumberOfElementsWritten - Pointer to number of elements written. 01474 01475 Return Value: 01476 01477 TRUE - The operation was successful. 01478 01479 FALSE/NULL - The operation failed. 01480 Extended error status is available using GetLastError. 01481 01482 --*/ 01483 01484 { 01485 01486 CONSOLE_API_MSG m; 01487 PCONSOLE_FILLCONSOLEOUTPUT_MSG a = &m.u.FillConsoleOutput; 01488 01489 a->ConsoleHandle = GET_CONSOLE_HANDLE; 01490 a->OutputHandle = hConsoleOutput; 01491 a->Length = nLength; 01492 a->ElementType = fFlags; 01493 a->Element = Element; 01494 a->WriteCoord = dwWriteCoord; 01495 CsrClientCallServer( (PCSR_API_MSG)&m, 01496 NULL, 01497 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 01498 ConsolepFillConsoleOutput 01499 ), 01500 sizeof( *a ) 01501 ); 01502 try { 01503 *lpNumberOfElementsWritten = a->Length; 01504 } except( EXCEPTION_EXECUTE_HANDLER ) { 01505 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01506 return FALSE; 01507 } 01508 if (!NT_SUCCESS(m.ReturnValue)) { 01509 SET_LAST_NT_ERROR(m.ReturnValue); 01510 return FALSE; 01511 } 01512 else { 01513 return TRUE; 01514 } 01515 01516 }

BOOL APIENTRY FillConsoleOutputAttribute HANDLE  hConsoleOutput,
WORD  wAttribute,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfAttrsWritten
 

Definition at line 1616 of file iostubs.c.

References CONSOLE_ATTRIBUTE, and FillConsoleOutput().

01626 : 01627 01628 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01629 that is to be written. The handle must have been created with 01630 GENERIC_WRITE access. 01631 01632 wAttribute - Supplies the attribute to write to the screen buffer. 01633 01634 nLength - Number of times to write the attribute. 01635 01636 dwWriteCoord - Screen buffer coordinates to begin writing the attribute 01637 to. 01638 01639 lpNumberOfAttrsWritten - Pointer to number of attrs written. 01640 01641 Return Value: 01642 01643 TRUE - The operation was successful. 01644 01645 FALSE/NULL - The operation failed. 01646 Extended error status is available using GetLastError. 01647 01648 --*/ 01649 01650 { 01651 return FillConsoleOutput(hConsoleOutput, 01652 wAttribute, 01653 nLength, 01654 CONSOLE_ATTRIBUTE, 01655 dwWriteCoord, 01656 lpNumberOfAttrsWritten 01657 ); 01658 }

BOOL APIENTRY FillConsoleOutputCharacterA HANDLE  hConsoleOutput,
CHAR  cCharacter,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfCharsWritten
 

defined(BUILD_WOW6432)

Definition at line 1524 of file iostubs.c.

References CONSOLE_ASCII, FillConsoleOutput(), and USHORT.

01534 : 01535 01536 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01537 that is to be written. The handle must have been created with 01538 GENERIC_WRITE access. 01539 01540 cCharacter - Supplies the ASCII character to write to the screen buffer. 01541 01542 nLength - Number of times to write the character. 01543 01544 dwWriteCoord - Screen buffer coordinates to begin writing the character 01545 to. 01546 01547 lpNumberOfCharsWritten - Pointer to number of chars written. 01548 01549 Return Value: 01550 01551 TRUE - The operation was successful. 01552 01553 FALSE/NULL - The operation failed. 01554 Extended error status is available using GetLastError. 01555 01556 --*/ 01557 01558 { 01559 return FillConsoleOutput(hConsoleOutput, 01560 (USHORT) cCharacter, 01561 nLength, 01562 CONSOLE_ASCII, 01563 dwWriteCoord, 01564 lpNumberOfCharsWritten 01565 ); 01566 }

BOOL APIENTRY FillConsoleOutputCharacterW HANDLE  hConsoleOutput,
WCHAR  cCharacter,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfCharsWritten
 

Definition at line 1570 of file iostubs.c.

References CONSOLE_REAL_UNICODE, FillConsoleOutput(), and USHORT.

01580 : 01581 01582 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01583 that is to be written. The handle must have been created with 01584 GENERIC_WRITE access. 01585 01586 cCharacter - Supplies the ASCII character to write to the screen buffer. 01587 01588 nLength - Number of times to write the character. 01589 01590 dwWriteCoord - Screen buffer coordinates to begin writing the character 01591 to. 01592 01593 lpNumberOfCharsWritten - Pointer to number of chars written. 01594 01595 Return Value: 01596 01597 TRUE - The operation was successful. 01598 01599 FALSE/NULL - The operation failed. 01600 Extended error status is available using GetLastError. 01601 01602 --*/ 01603 01604 { 01605 return FillConsoleOutput(hConsoleOutput, 01606 (USHORT) cCharacter, 01607 nLength, 01608 CONSOLE_REAL_UNICODE, 01609 dwWriteCoord, 01610 lpNumberOfCharsWritten 01611 ); 01612 }

BOOL APIENTRY GetConsoleInput IN HANDLE  hConsoleInput,
OUT PINPUT_RECORD  lpBuffer,
IN DWORD  nLength,
OUT LPDWORD  lpNumberOfEventsRead,
IN USHORT  wFlags,
IN BOOLEAN  Unicode
 

Definition at line 29 of file iostubs.c.

References _CONSOLE_GETCONSOLEINPUT_MSG::BufPtr, CONSOLE_HANDLE, _CONSOLE_GETCONSOLEINPUT_MSG::ConsoleHandle, ConsolepGetConsoleInput, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, _CONSOLE_GETCONSOLEINPUT_MSG::Flags, GET_CONSOLE_HANDLE, INPUT_RECORD_BUFFER_SIZE, _CONSOLE_GETCONSOLEINPUT_MSG::InputHandle, NT_SUCCESS, NULL, _CONSOLE_GETCONSOLEINPUT_MSG::NumRecords, _CONSOLE_GETCONSOLEINPUT_MSG::Record, SET_LAST_ERROR, SET_LAST_NT_ERROR, _CONSOLE_API_MSG::u, Unicode, and _CONSOLE_GETCONSOLEINPUT_MSG::Unicode.

Referenced by PeekConsoleInputA(), PeekConsoleInputW(), ReadConsoleInputA(), ReadConsoleInputExA(), ReadConsoleInputExW(), and ReadConsoleInputW().

00040 : 00041 00042 hConsoleInput - Supplies an open handle to CONIN$ that is to be 00043 read. The handle must have been created with GENERIC_READ access. 00044 00045 lpBuffer - Supplies the address of a buffer to receive the data read 00046 from the input buffer. 00047 00048 nLength - Supplies the length of lpBuffer in INPUT_RECORDs. 00049 00050 lpNumberOfEventsRead - Pointer to number of events read. 00051 00052 wFlags - Flags that control how data is read. 00053 00054 Return Value: 00055 00056 TRUE - The operation was successful. 00057 00058 FALSE/NULL - The operation failed. 00059 Extended error status is available using GetLastError. 00060 00061 --*/ 00062 00063 { 00064 PCSR_CAPTURE_HEADER CaptureBuffer; 00065 CONSOLE_API_MSG m; 00066 PCONSOLE_GETCONSOLEINPUT_MSG a = &m.u.GetConsoleInput; 00067 00068 // 00069 // If it's not a well formed handle, don't bother going to the server. 00070 // 00071 00072 if (!CONSOLE_HANDLE(hConsoleInput)) { 00073 try { 00074 *lpNumberOfEventsRead = 0; 00075 SET_LAST_ERROR(ERROR_INVALID_HANDLE); 00076 } except( EXCEPTION_EXECUTE_HANDLER ) { 00077 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00078 } 00079 return FALSE; 00080 } 00081 00082 a->ConsoleHandle = GET_CONSOLE_HANDLE; 00083 a->InputHandle = hConsoleInput; 00084 a->NumRecords = nLength; 00085 a->Flags = wFlags; 00086 a->Unicode = Unicode; 00087 00088 // 00089 // for speed in the case where we're only reading a few records, we have 00090 // a buffer in the msg we pass to the server. this means we don't have to 00091 // allocate a capture buffer. 00092 // 00093 00094 if (nLength > INPUT_RECORD_BUFFER_SIZE) { 00095 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 00096 nLength * sizeof(INPUT_RECORD) 00097 ); 00098 if (CaptureBuffer == NULL) { 00099 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 00100 return FALSE; 00101 } 00102 CsrCaptureMessageBuffer( CaptureBuffer, 00103 NULL, 00104 nLength * sizeof(INPUT_RECORD), 00105 (PVOID *) &a->BufPtr 00106 ); 00107 00108 } else { 00109 a->BufPtr = a->Record; 00110 CaptureBuffer = NULL; 00111 } 00112 CsrClientCallServer( (PCSR_API_MSG)&m, 00113 CaptureBuffer, 00114 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 00115 ConsolepGetConsoleInput 00116 ), 00117 sizeof( *a ) 00118 ); 00119 00120 try { 00121 if (NT_SUCCESS( m.ReturnValue )) { 00122 *lpNumberOfEventsRead = a->NumRecords; 00123 RtlCopyMemory(lpBuffer, a->BufPtr, a->NumRecords * sizeof(INPUT_RECORD)); 00124 } 00125 else { 00126 *lpNumberOfEventsRead = 0; 00127 SET_LAST_NT_ERROR(m.ReturnValue); 00128 } 00129 } except( EXCEPTION_EXECUTE_HANDLER ) { 00130 if (CaptureBuffer != NULL) { 00131 CsrFreeCaptureBuffer( CaptureBuffer ); 00132 } 00133 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00134 return FALSE; 00135 } 00136 if (CaptureBuffer != NULL) { 00137 CsrFreeCaptureBuffer( CaptureBuffer ); 00138 } 00139 00140 return NT_SUCCESS(m.ReturnValue); 00141 00142 }

BOOL WINAPI InvalidateConsoleDIBits IN HANDLE  hConsoleOutput,
IN PSMALL_RECT  lpRect
 

Definition at line 1752 of file iostubs.c.

References _CONSOLE_INVALIDATERECT_MSG::ConsoleHandle, ConsolepInvalidateBitmapRect, CsrClientCallServer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_INVALIDATERECT_MSG::OutputHandle, _CONSOLE_INVALIDATERECT_MSG::Rect, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

Referenced by main().

01759 : 01760 01761 hConsoleHandle - Supplies a console input or output handle. 01762 01763 lpRect - the region that needs to be updated to the screen. 01764 01765 Return Value: 01766 01767 TRUE - The operation was successful. 01768 01769 FALSE/NULL - The operation failed. Extended error status is available 01770 using GetLastError. 01771 01772 01773 --*/ 01774 01775 { 01776 CONSOLE_API_MSG m; 01777 PCONSOLE_INVALIDATERECT_MSG a = &m.u.InvalidateConsoleBitmapRect; 01778 01779 a->ConsoleHandle = GET_CONSOLE_HANDLE; 01780 a->OutputHandle = hConsoleOutput; 01781 try { 01782 a->Rect = *lpRect; 01783 } except( EXCEPTION_EXECUTE_HANDLER ) { 01784 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01785 return ERROR_INVALID_ACCESS; 01786 } 01787 CsrClientCallServer( (PCSR_API_MSG)&m, 01788 NULL, 01789 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 01790 ConsolepInvalidateBitmapRect 01791 ), 01792 sizeof( *a ) 01793 ); 01794 if (NT_SUCCESS( m.ReturnValue )) { 01795 return TRUE; 01796 } else { 01797 SET_LAST_NT_ERROR (m.ReturnValue); 01798 return FALSE; 01799 } 01800 }

BOOL APIENTRY PeekConsoleInputA HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead
 

defined(BUILD_WOW6432)

Definition at line 150 of file iostubs.c.

References FALSE, and GetConsoleInput().

00157 { 00158 return GetConsoleInput(hConsoleInput, 00159 lpBuffer, 00160 nLength, 00161 lpNumberOfEventsRead, 00162 CONSOLE_READ_NOREMOVE | CONSOLE_READ_NOWAIT, 00163 FALSE); 00164 }

BOOL APIENTRY PeekConsoleInputW HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead
 

Definition at line 168 of file iostubs.c.

References GetConsoleInput(), and TRUE.

00177 : 00178 00179 hConsoleInput - Supplies an open handle to CONIN$ that is to be 00180 read. The handle must have been created with GENERIC_READ access. 00181 00182 lpBuffer - Supplies the address of a buffer to receive the data read 00183 from the input buffer. 00184 00185 nLength - Supplies the length of lpBuffer in INPUT_RECORDs. 00186 00187 lpNumberOfEventsRead - Pointer to number of events read. 00188 00189 Return Value: 00190 00191 TRUE - The operation was successful. 00192 00193 FALSE/NULL - The operation failed. 00194 Extended error status is available using GetLastError. 00195 00196 --*/ 00197 00198 { 00199 return GetConsoleInput(hConsoleInput, 00200 lpBuffer, 00201 nLength, 00202 lpNumberOfEventsRead, 00203 CONSOLE_READ_NOREMOVE | CONSOLE_READ_NOWAIT, 00204 TRUE); 00205 }

BOOL APIENTRY ReadConsoleInputA HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead
 

Definition at line 209 of file iostubs.c.

References FALSE, and GetConsoleInput().

00216 { 00217 return GetConsoleInput(hConsoleInput, 00218 lpBuffer, 00219 nLength, 00220 lpNumberOfEventsRead, 00221 0, 00222 FALSE); 00223 }

BOOL APIENTRY ReadConsoleInputExA HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead,
USHORT  wFlags
 

Definition at line 268 of file iostubs.c.

References FALSE, and GetConsoleInput().

00276 { 00277 return GetConsoleInput(hConsoleInput, 00278 lpBuffer, 00279 nLength, 00280 lpNumberOfEventsRead, 00281 wFlags, 00282 FALSE); 00283 }

BOOL APIENTRY ReadConsoleInputExW HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead,
USHORT  wFlags
 

Definition at line 287 of file iostubs.c.

References GetConsoleInput(), and TRUE.

00297 : 00298 00299 hConsoleInput - Supplies an open handle to CONIN$ that is to be 00300 read. The handle must have been created with GENERIC_READ access. 00301 00302 lpBuffer - Supplies the address of a buffer to receive the data read 00303 from the input buffer. 00304 00305 nLength - Supplies the length of lpBuffer in INPUT_RECORDs. 00306 00307 lpNumberOfEventsRead - Pointer to number of events read. 00308 00309 wFlags - Flags that control how data is read. 00310 00311 Return Value: 00312 00313 TRUE - The operation was successful. 00314 00315 FALSE/NULL - The operation failed. 00316 Extended error status is available using GetLastError. 00317 00318 --*/ 00319 00320 { 00321 return GetConsoleInput(hConsoleInput, 00322 lpBuffer, 00323 nLength, 00324 lpNumberOfEventsRead, 00325 wFlags, 00326 TRUE); 00327 }

BOOL APIENTRY ReadConsoleInputW HANDLE  hConsoleInput,
PINPUT_RECORD  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsRead
 

Definition at line 227 of file iostubs.c.

References GetConsoleInput(), and TRUE.

00236 : 00237 00238 hConsoleInput - Supplies an open handle to CONIN$ that is to be 00239 read. The handle must have been created with GENERIC_READ access. 00240 00241 lpBuffer - Supplies the address of a buffer to receive the data read 00242 from the input buffer. 00243 00244 nLength - Supplies the length of lpBuffer in INPUT_RECORDs. 00245 00246 lpNumberOfEventsRead - Pointer to number of events read. 00247 00248 Return Value: 00249 00250 TRUE - The operation was successful. 00251 00252 FALSE/NULL - The operation failed. 00253 Extended error status is available using GetLastError. 00254 00255 --*/ 00256 00257 { 00258 return GetConsoleInput(hConsoleInput, 00259 lpBuffer, 00260 nLength, 00261 lpNumberOfEventsRead, 00262 0, 00263 TRUE); 00264 }

BOOL APIENTRY ReadConsoleOutputA HANDLE  hConsoleOutput,
PCHAR_INFO  lpBuffer,
COORD  dwBufferSize,
COORD  dwBufferCoord,
PSMALL_RECT  lpReadRegion
 

Definition at line 748 of file iostubs.c.

References FALSE, and ReadConsoleOutputInternal().

00755 { 00756 return ReadConsoleOutputInternal(hConsoleOutput, 00757 lpBuffer, 00758 dwBufferSize, 00759 dwBufferCoord, 00760 lpReadRegion, 00761 FALSE 00762 ); 00763 }

BOOL APIENTRY ReadConsoleOutputAttribute HANDLE  hConsoleOutput,
LPWORD  lpAttribute,
DWORD  nLength,
COORD  dwReadCoord,
LPDWORD  lpNumberOfAttrsRead
 

Definition at line 1160 of file iostubs.c.

References CONSOLE_ATTRIBUTE, and ReadConsoleOutputString().

01170 : 01171 01172 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01173 that is to be read. The handle must have been created with 01174 GENERIC_READ access. 01175 01176 lpAttribute - Supplies the address of a buffer to receive the attribute 01177 string read from the screen buffer. 01178 01179 nLength - Size of lpAttribute buffer in bytes. 01180 01181 dwReadCoord - Screen buffer coordinates of string to read. 01182 read data. 01183 01184 lpNumberOfAttrsRead - Pointer to number of attrs read. 01185 01186 Return Value: 01187 01188 TRUE - The operation was successful. 01189 01190 FALSE/NULL - The operation failed. 01191 Extended error status is available using GetLastError. 01192 01193 --*/ 01194 01195 { 01196 return ReadConsoleOutputString(hConsoleOutput, 01197 lpAttribute, 01198 nLength, 01199 sizeof(WORD), 01200 CONSOLE_ATTRIBUTE, 01201 dwReadCoord, 01202 lpNumberOfAttrsRead 01203 ); 01204 }

BOOL APIENTRY ReadConsoleOutputCharacterA HANDLE  hConsoleOutput,
LPSTR  lpCharacter,
DWORD  nLength,
COORD  dwReadCoord,
LPDWORD  lpNumberOfCharsRead
 

defined(BUILD_WOW6432)

Definition at line 1089 of file iostubs.c.

References CHAR, CONSOLE_ASCII, and ReadConsoleOutputString().

01099 : 01100 01101 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01102 that is to be read. The handle must have been created with 01103 GENERIC_READ access. 01104 01105 lpCharacter - Supplies the address of a buffer to receive the character 01106 string read from the screen buffer. 01107 01108 nLength - Size of lpCharacter buffer in characters. 01109 01110 dwReadCoord - Screen buffer coordinates of string to read. 01111 read data. 01112 01113 lpNumberOfCharsRead - Pointer to number of chars read. 01114 01115 Return Value: 01116 01117 TRUE - The operation was successful. 01118 01119 FALSE/NULL - The operation failed. 01120 Extended error status is available using GetLastError. 01121 01122 --*/ 01123 01124 { 01125 return ReadConsoleOutputString(hConsoleOutput, 01126 lpCharacter, 01127 nLength, 01128 sizeof(CHAR), 01129 CONSOLE_ASCII, 01130 dwReadCoord, 01131 lpNumberOfCharsRead 01132 ); 01133 }

BOOL APIENTRY ReadConsoleOutputCharacterW HANDLE  hConsoleOutput,
LPWSTR  lpCharacter,
DWORD  nLength,
COORD  dwReadCoord,
LPDWORD  lpNumberOfCharsRead
 

Definition at line 1138 of file iostubs.c.

References CONSOLE_REAL_UNICODE, and ReadConsoleOutputString().

01146 { 01147 return ReadConsoleOutputString(hConsoleOutput, 01148 lpCharacter, 01149 nLength, 01150 sizeof(WCHAR), 01151 CONSOLE_REAL_UNICODE, 01152 dwReadCoord, 01153 lpNumberOfCharsRead 01154 ); 01155 }

BOOL APIENTRY ReadConsoleOutputInternal IN HANDLE  hConsoleOutput,
OUT PCHAR_INFO  lpBuffer,
IN COORD  dwBufferSize,
IN COORD  dwBufferCoord,
IN OUT PSMALL_RECT  lpReadRegion,
IN BOOLEAN  Unicode
 

Definition at line 585 of file iostubs.c.

References _CONSOLE_READCONSOLEOUTPUT_MSG::BufPtr, _CONSOLE_READCONSOLEOUTPUT_MSG::Char, _CONSOLE_READCONSOLEOUTPUT_MSG::CharRegion, CONSOLE_RECT_SIZE_X, CONSOLE_RECT_SIZE_Y, _CONSOLE_READCONSOLEOUTPUT_MSG::ConsoleHandle, ConsolepReadConsoleOutput, CopyRectangle(), CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_READCONSOLEOUTPUT_MSG::OutputHandle, SET_LAST_ERROR, SET_LAST_NT_ERROR, SHORT, TRUE, _CONSOLE_API_MSG::u, Unicode, and _CONSOLE_READCONSOLEOUTPUT_MSG::Unicode.

Referenced by ReadConsoleOutputA(), and ReadConsoleOutputW().

00595 : 00596 00597 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 00598 that is to be read. The handle must have been created with 00599 GENERIC_READ access. 00600 00601 lpBuffer - Supplies the address of a buffer to receive the data read 00602 from the screen buffer. This pointer is treated as the origin of 00603 a two dimensional array of size dwBufferSize. 00604 00605 dwBufferSize - size of lpBuffer 00606 00607 dwBufferCoord - coordinates of upper left point in buffer to receive 00608 read data. 00609 00610 lpReadRegion - Supplies on input the address of a structure indicating the 00611 rectangle within the screen buffer to read from. The fields in 00612 the structure are column and row coordinates. On output, the fields 00613 contain the actual region read. 00614 00615 Return Value: 00616 00617 TRUE - The operation was successful. 00618 00619 FALSE/NULL - The operation failed. Extended error status is available 00620 using GetLastError. 00621 --*/ 00622 00623 { 00624 PCSR_CAPTURE_HEADER CaptureBuffer; 00625 CONSOLE_API_MSG m; 00626 PCONSOLE_READCONSOLEOUTPUT_MSG a = &m.u.ReadConsoleOutput; 00627 ULONG NumChars; 00628 COORD SourceSize; 00629 00630 a->ConsoleHandle = GET_CONSOLE_HANDLE; 00631 a->OutputHandle = hConsoleOutput; 00632 a->Unicode = Unicode; 00633 00634 // 00635 // clip region to read based on caller's buffer size 00636 // 00637 00638 SourceSize.X = (SHORT)CONSOLE_RECT_SIZE_X(lpReadRegion); 00639 if (SourceSize.X > dwBufferSize.X-dwBufferCoord.X) 00640 SourceSize.X = dwBufferSize.X-dwBufferCoord.X; 00641 SourceSize.Y = (SHORT)CONSOLE_RECT_SIZE_Y(lpReadRegion); 00642 if (SourceSize.Y > dwBufferSize.Y-dwBufferCoord.Y) 00643 SourceSize.Y = dwBufferSize.Y-dwBufferCoord.Y; 00644 00645 a->CharRegion.Left = lpReadRegion->Left; 00646 a->CharRegion.Right = (SHORT)(lpReadRegion->Left + SourceSize.X - 1); 00647 a->CharRegion.Top = lpReadRegion->Top; 00648 a->CharRegion.Bottom = (SHORT)(lpReadRegion->Top + SourceSize.Y - 1); 00649 00650 // 00651 // for speed in the case where we're only reading one character, we have 00652 // a buffer in the msg we pass to the server. this means we don't have to 00653 // allocate a capture buffer. 00654 // 00655 00656 NumChars = SourceSize.X * SourceSize.Y; 00657 if (NumChars > 1) { 00658 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 00659 NumChars * sizeof(CHAR_INFO) 00660 ); 00661 if (CaptureBuffer == NULL) { 00662 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 00663 return FALSE; 00664 } 00665 CsrCaptureMessageBuffer( CaptureBuffer, 00666 NULL, 00667 NumChars * sizeof(CHAR_INFO), 00668 (PVOID *) &a->BufPtr 00669 ); 00670 } 00671 else { 00672 CaptureBuffer = NULL; 00673 a->BufPtr = &a->Char; 00674 } 00675 CsrClientCallServer( (PCSR_API_MSG)&m, 00676 CaptureBuffer, 00677 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 00678 ConsolepReadConsoleOutput 00679 ), 00680 sizeof( *a ) 00681 ); 00682 if (NT_SUCCESS( m.ReturnValue )) { 00683 try { 00684 SMALL_RECT SourceRect; 00685 00686 SourceRect.Left = a->CharRegion.Left - lpReadRegion->Left; 00687 SourceRect.Top = a->CharRegion.Top - lpReadRegion->Top; 00688 SourceRect.Right = SourceRect.Left + 00689 (a->CharRegion.Right - a->CharRegion.Left); 00690 SourceRect.Bottom = SourceRect.Top + 00691 (a->CharRegion.Bottom - a->CharRegion.Top); 00692 dwBufferCoord.X += SourceRect.Left; 00693 dwBufferCoord.Y += SourceRect.Top; 00694 CopyRectangle(a->BufPtr, 00695 SourceSize, 00696 &SourceRect, 00697 lpBuffer, 00698 dwBufferSize, 00699 dwBufferCoord 00700 ); 00701 } except( EXCEPTION_EXECUTE_HANDLER ) { 00702 if (CaptureBuffer != NULL) { 00703 CsrFreeCaptureBuffer( CaptureBuffer ); 00704 } 00705 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00706 return FALSE; 00707 } 00708 } 00709 if (CaptureBuffer != NULL) { 00710 CsrFreeCaptureBuffer( CaptureBuffer ); 00711 } 00712 *lpReadRegion = a->CharRegion; 00713 if (!NT_SUCCESS(m.ReturnValue)) { 00714 SET_LAST_NT_ERROR(m.ReturnValue); 00715 return FALSE; 00716 } 00717 else { 00718 return TRUE; 00719 } 00720 00721 }

BOOL APIENTRY ReadConsoleOutputString IN HANDLE  hConsoleOutput,
OUT LPVOID  lpString,
IN DWORD  nLength,
IN DWORD  nSize,
IN DWORD  fFlags,
IN COORD  dwReadCoord,
OUT LPDWORD  lpNumberOfElementsRead
 

Definition at line 974 of file iostubs.c.

References _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::BufPtr, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::ConsoleHandle, ConsolepReadConsoleOutputString, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::NumRecords, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::OutputHandle, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::ReadCoord, SET_LAST_ERROR, SET_LAST_NT_ERROR, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::String, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::StringType, and _CONSOLE_API_MSG::u.

Referenced by ReadConsoleOutputAttribute(), ReadConsoleOutputCharacterA(), and ReadConsoleOutputCharacterW().

00986 : 00987 00988 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 00989 that is to be read. The handle must have been created with 00990 GENERIC_READ access. 00991 00992 lpString - Supplies the address of a buffer to receive the character 00993 or attribute string read from the screen buffer. 00994 00995 nLength - Size of lpCharacter buffer in elements. 00996 00997 nSize - Size of element to read. 00998 00999 fFlags - flag indicating what type of string to copy 01000 01001 dwReadCoord - Screen buffer coordinates of string to read. 01002 read data. 01003 01004 lpNumberOfElementsRead - Pointer to number of events read. 01005 01006 Return Value: 01007 01008 TRUE - The operation was successful. 01009 01010 FALSE/NULL - The operation failed. 01011 Extended error status is available using GetLastError. 01012 01013 --*/ 01014 01015 { 01016 PCSR_CAPTURE_HEADER CaptureBuffer; 01017 CONSOLE_API_MSG m; 01018 PCONSOLE_READCONSOLEOUTPUTSTRING_MSG a = &m.u.ReadConsoleOutputString; 01019 ULONG DataLength; 01020 01021 a->ConsoleHandle = GET_CONSOLE_HANDLE; 01022 a->OutputHandle = hConsoleOutput; 01023 a->NumRecords = nLength; 01024 a->StringType = fFlags; 01025 a->ReadCoord = dwReadCoord; 01026 01027 DataLength = nLength*nSize; 01028 01029 // 01030 // for speed in the case where the string is small, we have a buffer 01031 // in the msg we pass to the server. this means we don't have to 01032 // allocate a capture buffer. 01033 // 01034 01035 if (DataLength > sizeof(a->String)) { 01036 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 01037 DataLength 01038 ); 01039 if (CaptureBuffer == NULL) { 01040 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 01041 return FALSE; 01042 } 01043 CsrCaptureMessageBuffer( CaptureBuffer, 01044 NULL, 01045 DataLength, 01046 (PVOID *) &a->BufPtr 01047 ); 01048 01049 } 01050 else { 01051 a->BufPtr = a->String; 01052 CaptureBuffer = NULL; 01053 } 01054 CsrClientCallServer( (PCSR_API_MSG)&m, 01055 CaptureBuffer, 01056 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 01057 ConsolepReadConsoleOutputString 01058 ), 01059 sizeof( *a ) 01060 ); 01061 01062 try { 01063 *lpNumberOfElementsRead = a->NumRecords; 01064 if (NT_SUCCESS( m.ReturnValue )) { 01065 RtlCopyMemory(lpString, a->BufPtr, a->NumRecords * nSize); 01066 } 01067 else { 01068 SET_LAST_NT_ERROR(m.ReturnValue); 01069 } 01070 } except( EXCEPTION_EXECUTE_HANDLER ) { 01071 if (CaptureBuffer != NULL) { 01072 CsrFreeCaptureBuffer( CaptureBuffer ); 01073 } 01074 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01075 return FALSE; 01076 } 01077 if (CaptureBuffer != NULL) { 01078 CsrFreeCaptureBuffer( CaptureBuffer ); 01079 } 01080 return NT_SUCCESS(m.ReturnValue); 01081 }

BOOL APIENTRY ReadConsoleOutputW HANDLE  hConsoleOutput,
PCHAR_INFO  lpBuffer,
COORD  dwBufferSize,
COORD  dwBufferCoord,
PSMALL_RECT  lpReadRegion
 

defined(BUILD_WOW6432)

Definition at line 729 of file iostubs.c.

References ReadConsoleOutputInternal(), and TRUE.

00736 { 00737 return ReadConsoleOutputInternal(hConsoleOutput, 00738 lpBuffer, 00739 dwBufferSize, 00740 dwBufferCoord, 00741 lpReadRegion, 00742 TRUE 00743 ); 00744 }

BOOL APIENTRY WriteConsoleInputA HANDLE  hConsoleInput,
CONST INPUT_RECORD *  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsWritten
 

defined(BUILD_WOW6432)

Definition at line 444 of file iostubs.c.

References FALSE, TRUE, and WriteConsoleInputInternal().

00450 { 00451 return WriteConsoleInputInternal(hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten,FALSE,TRUE); 00452 }

BOOL APIENTRY WriteConsoleInputInternal IN HANDLE  hConsoleInput,
IN CONST INPUT_RECORD *  lpBuffer,
IN DWORD  nLength,
OUT LPDWORD  lpNumberOfEventsWritten,
IN BOOLEAN  Unicode,
IN BOOLEAN  Append
 

defined(BUILD_WOW64)

Definition at line 335 of file iostubs.c.

References _CONSOLE_WRITECONSOLEINPUT_MSG::Append, _CONSOLE_WRITECONSOLEINPUT_MSG::BufPtr, _CONSOLE_WRITECONSOLEINPUT_MSG::ConsoleHandle, ConsolepWriteConsoleInput, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, INPUT_RECORD_BUFFER_SIZE, _CONSOLE_WRITECONSOLEINPUT_MSG::InputHandle, NT_SUCCESS, NULL, _CONSOLE_WRITECONSOLEINPUT_MSG::NumRecords, _CONSOLE_WRITECONSOLEINPUT_MSG::Record, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, _CONSOLE_API_MSG::u, Unicode, and _CONSOLE_WRITECONSOLEINPUT_MSG::Unicode.

Referenced by WriteConsoleInputA(), WriteConsoleInputVDMA(), WriteConsoleInputVDMW(), and WriteConsoleInputW().

00345 : 00346 00347 hConsoleInput - Supplies an open handle to CONIN$ that is to be 00348 written. The handle must have been created with GENERIC_WRITE access. 00349 00350 lpBuffer - Supplies the address of a buffer containing the input records 00351 to write to the input buffer. 00352 00353 nLength - Supplies the length of lpBuffer in INPUT_RECORDs. 00354 00355 lpNumberOfEventsWritten - Pointer to number of events written. 00356 00357 Unicode - TRUE if characters are unicode 00358 00359 Append - TRUE if append to end of input stream. if FALSE, write to the 00360 beginning of the input stream (used by VDM). 00361 00362 Return Value: 00363 00364 TRUE - The operation was successful. 00365 00366 FALSE/NULL - The operation failed. 00367 Extended error status is available using GetLastError. 00368 00369 --*/ 00370 00371 { 00372 PCSR_CAPTURE_HEADER CaptureBuffer; 00373 CONSOLE_API_MSG m; 00374 PCONSOLE_WRITECONSOLEINPUT_MSG a = &m.u.WriteConsoleInput; 00375 00376 a->ConsoleHandle = GET_CONSOLE_HANDLE; 00377 a->InputHandle = hConsoleInput; 00378 a->NumRecords = nLength; 00379 a->Unicode = Unicode; 00380 a->Append = Append; 00381 00382 // 00383 // for speed in the case where we're only writing a few records, we have 00384 // a buffer in the msg we pass to the server. this means we don't have to 00385 // allocate a capture buffer. 00386 // 00387 00388 if (nLength > INPUT_RECORD_BUFFER_SIZE) { 00389 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 00390 nLength * sizeof(INPUT_RECORD) 00391 ); 00392 if (CaptureBuffer == NULL) { 00393 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 00394 return FALSE; 00395 } 00396 CsrCaptureMessageBuffer( CaptureBuffer, 00397 (PCHAR) lpBuffer, 00398 nLength * sizeof(INPUT_RECORD), 00399 (PVOID *) &a->BufPtr 00400 ); 00401 00402 } else { 00403 a->BufPtr = a->Record; 00404 CaptureBuffer = NULL; 00405 try { 00406 RtlCopyMemory(a->BufPtr, lpBuffer, nLength * sizeof(INPUT_RECORD)); 00407 } except( EXCEPTION_EXECUTE_HANDLER ) { 00408 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00409 return FALSE; 00410 } 00411 } 00412 CsrClientCallServer( (PCSR_API_MSG)&m, 00413 CaptureBuffer, 00414 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 00415 ConsolepWriteConsoleInput 00416 ), 00417 sizeof( *a ) 00418 ); 00419 if (CaptureBuffer != NULL) { 00420 CsrFreeCaptureBuffer( CaptureBuffer ); 00421 } 00422 try { 00423 *lpNumberOfEventsWritten = a->NumRecords; 00424 } except( EXCEPTION_EXECUTE_HANDLER ) { 00425 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00426 return FALSE; 00427 } 00428 if (!NT_SUCCESS(m.ReturnValue)) { 00429 SET_LAST_NT_ERROR(m.ReturnValue); 00430 return FALSE; 00431 } 00432 else { 00433 return TRUE; 00434 } 00435 00436 }

BOOL APIENTRY WriteConsoleInputW HANDLE  hConsoleInput,
CONST INPUT_RECORD *  lpBuffer,
DWORD  nLength,
LPDWORD  lpNumberOfEventsWritten
 

Definition at line 456 of file iostubs.c.

References TRUE, and WriteConsoleInputInternal().

00462 { 00463 return WriteConsoleInputInternal(hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten,TRUE,TRUE); 00464 }

BOOL APIENTRY WriteConsoleOutputA HANDLE  hConsoleOutput,
CONST CHAR_INFO *  lpBuffer,
COORD  dwBufferSize,
COORD  dwBufferCoord,
PSMALL_RECT  lpWriteRegion
 

Definition at line 951 of file iostubs.c.

References FALSE, and WriteConsoleOutputInternal().

00958 { 00959 return WriteConsoleOutputInternal(hConsoleOutput, 00960 lpBuffer, 00961 dwBufferSize, 00962 dwBufferCoord, 00963 lpWriteRegion, 00964 FALSE 00965 ); 00966 }

BOOL APIENTRY WriteConsoleOutputAttribute HANDLE  hConsoleOutput,
CONST WORD *  lpAttribute,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfAttrsWritten
 

Definition at line 1397 of file iostubs.c.

References CONSOLE_ATTRIBUTE, and WriteConsoleOutputString().

01407 : 01408 01409 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01410 that is to be written. The handle must have been created with 01411 GENERIC_WRITE access. 01412 01413 lpAttribute - Supplies the address of a buffer containing the attribute 01414 string to write to the screen buffer. 01415 01416 nLength - Length of string to write. 01417 01418 dwWriteCoord - Screen buffer coordinates to write the string to. 01419 01420 lpNumberOfAttrsWritten - Pointer to number of attrs written. 01421 01422 Return Value: 01423 01424 TRUE - The operation was successful. 01425 01426 FALSE/NULL - The operation failed. 01427 Extended error status is available using GetLastError. 01428 01429 --*/ 01430 01431 { 01432 return WriteConsoleOutputString(hConsoleOutput, 01433 lpAttribute, 01434 nLength, 01435 sizeof(WORD), 01436 CONSOLE_ATTRIBUTE, 01437 dwWriteCoord, 01438 lpNumberOfAttrsWritten 01439 ); 01440 }

BOOL APIENTRY WriteConsoleOutputCharacterA HANDLE  hConsoleOutput,
LPCSTR  lpCharacter,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfCharsWritten
 

defined(BUILD_WOW6432)

Definition at line 1329 of file iostubs.c.

References CHAR, CONSOLE_ASCII, and WriteConsoleOutputString().

01339 : 01340 01341 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01342 that is to be written. The handle must have been created with 01343 GENERIC_WRITE access. 01344 01345 lpCharacter - Supplies the address of a buffer containing the character 01346 string to write to the screen buffer. 01347 01348 nLength - Length of string to write, in characters. 01349 01350 dwWriteCoord - Screen buffer coordinates to write the string to. 01351 01352 lpNumberOfCharsWritten - Pointer to number of chars written. 01353 01354 Return Value: 01355 01356 TRUE - The operation was successful. 01357 01358 FALSE/NULL - The operation failed. 01359 Extended error status is available using GetLastError. 01360 01361 --*/ 01362 01363 { 01364 return WriteConsoleOutputString(hConsoleOutput, 01365 lpCharacter, 01366 nLength, 01367 sizeof(CHAR), 01368 CONSOLE_ASCII, 01369 dwWriteCoord, 01370 lpNumberOfCharsWritten 01371 ); 01372 }

BOOL APIENTRY WriteConsoleOutputCharacterW HANDLE  hConsoleOutput,
LPCWSTR  lpCharacter,
DWORD  nLength,
COORD  dwWriteCoord,
LPDWORD  lpNumberOfCharsWritten
 

Definition at line 1376 of file iostubs.c.

References CONSOLE_REAL_UNICODE, and WriteConsoleOutputString().

01384 { 01385 return WriteConsoleOutputString(hConsoleOutput, 01386 lpCharacter, 01387 nLength, 01388 sizeof(WCHAR), 01389 CONSOLE_REAL_UNICODE, 01390 dwWriteCoord, 01391 lpNumberOfCharsWritten 01392 ); 01393 }

BOOL APIENTRY WriteConsoleOutputInternal IN HANDLE  hConsoleOutput,
IN CONST CHAR_INFO *  lpBuffer,
IN COORD  dwBufferSize,
IN COORD  dwBufferCoord,
IN PSMALL_RECT  lpWriteRegion,
IN BOOLEAN  Unicode
 

defined(BUILD_WOW64)

Definition at line 771 of file iostubs.c.

References _CONSOLE_WRITECONSOLEOUTPUT_MSG::BufPtr, _CONSOLE_WRITECONSOLEOUTPUT_MSG::Char, _CONSOLE_WRITECONSOLEOUTPUT_MSG::CharRegion, CONSOLE_RECT_SIZE_X, CONSOLE_RECT_SIZE_Y, _CONSOLE_WRITECONSOLEOUTPUT_MSG::ConsoleHandle, ConsolepWriteConsoleOutput, CopyRectangle(), CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_WRITECONSOLEOUTPUT_MSG::OutputHandle, _CONSOLE_WRITECONSOLEOUTPUT_MSG::ReadVM, RtlAllocateHeap, RtlFreeHeap, SET_LAST_ERROR, SET_LAST_NT_ERROR, SHORT, TRUE, _CONSOLE_API_MSG::u, Unicode, and _CONSOLE_WRITECONSOLEOUTPUT_MSG::Unicode.

Referenced by WriteConsoleOutputA(), and WriteConsoleOutputW().

00781 : 00782 00783 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 00784 that is to be written. The handle must have been created with 00785 GENERIC_WRITE access. 00786 00787 lpBuffer - Supplies the address of a buffer containing the data to write 00788 to the screen buffer. This buffer is treated as a two dimensional 00789 array. 00790 00791 dwBufferSize - size of lpBuffer 00792 00793 dwBufferCoord - coordinates of upper left point in buffer to write data 00794 from. 00795 00796 lpWriteRegion - Supplies on input the address of a structure indicating the 00797 rectangle within the screen buffer to write to. The fields in 00798 the structure are column and row coordinates. On output, the fields 00799 contain the actual region written. 00800 00801 Return Value: 00802 00803 TRUE - The operation was successful. 00804 00805 FALSE/NULL - The operation failed. Extended error status is available 00806 using GetLastError. 00807 --*/ 00808 00809 { 00810 00811 PCSR_CAPTURE_HEADER CaptureBuffer; 00812 CONSOLE_API_MSG m; 00813 PCONSOLE_WRITECONSOLEOUTPUT_MSG a = &m.u.WriteConsoleOutput; 00814 ULONG NumChars; 00815 COORD SourceSize; 00816 COORD TargetPoint; 00817 00818 a->ConsoleHandle = GET_CONSOLE_HANDLE; 00819 a->OutputHandle = hConsoleOutput; 00820 a->Unicode = Unicode; 00821 00822 // 00823 // clip region to write based on caller's buffer size 00824 // 00825 00826 SourceSize.X = (SHORT)CONSOLE_RECT_SIZE_X(lpWriteRegion); 00827 if (SourceSize.X > dwBufferSize.X-dwBufferCoord.X) 00828 SourceSize.X = dwBufferSize.X-dwBufferCoord.X; 00829 SourceSize.Y = (SHORT)CONSOLE_RECT_SIZE_Y(lpWriteRegion); 00830 if (SourceSize.Y > dwBufferSize.Y-dwBufferCoord.Y) 00831 SourceSize.Y = dwBufferSize.Y-dwBufferCoord.Y; 00832 00833 if (SourceSize.X <= 0 || 00834 SourceSize.Y <= 0) { 00835 SET_LAST_ERROR(ERROR_INVALID_PARAMETER); 00836 return FALSE; 00837 } 00838 00839 a->CharRegion.Left = lpWriteRegion->Left; 00840 a->CharRegion.Right = (SHORT)(lpWriteRegion->Left + SourceSize.X - 1); 00841 a->CharRegion.Top = lpWriteRegion->Top; 00842 a->CharRegion.Bottom = (SHORT)(lpWriteRegion->Top + SourceSize.Y - 1); 00843 00844 // 00845 // for speed in the case where we're only writing one character, we have 00846 // a buffer in the msg we pass to the server. this means we don't have to 00847 // allocate a capture buffer. 00848 // 00849 00850 NumChars = SourceSize.X * SourceSize.Y; 00851 if (NumChars > 1) { 00852 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 00853 NumChars * sizeof(CHAR_INFO) 00854 ); 00855 if (CaptureBuffer == NULL) { 00856 a->ReadVM=TRUE; 00857 a->BufPtr = RtlAllocateHeap( RtlProcessHeap(), 0, NumChars * sizeof(CHAR_INFO)); 00858 if (a->BufPtr == NULL) { 00859 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 00860 return FALSE; 00861 } 00862 } else { 00863 a->ReadVM=FALSE; 00864 CsrCaptureMessageBuffer( CaptureBuffer, 00865 NULL, 00866 NumChars * sizeof(CHAR_INFO), 00867 (PVOID *) &a->BufPtr 00868 ); 00869 } 00870 } 00871 else { 00872 a->ReadVM=FALSE; 00873 CaptureBuffer = NULL; 00874 a->BufPtr = &a->Char; 00875 } 00876 try { 00877 SMALL_RECT SourceRect; 00878 00879 SourceRect.Left = dwBufferCoord.X; 00880 SourceRect.Top = dwBufferCoord.Y; 00881 SourceRect.Right = (SHORT)(dwBufferCoord.X+SourceSize.X-1); 00882 SourceRect.Bottom = (SHORT)(dwBufferCoord.Y+SourceSize.Y-1); 00883 TargetPoint.X = 0; 00884 TargetPoint.Y = 0; 00885 CopyRectangle(lpBuffer, 00886 dwBufferSize, 00887 &SourceRect, 00888 a->BufPtr, 00889 SourceSize, 00890 TargetPoint 00891 ); 00892 } except( EXCEPTION_EXECUTE_HANDLER ) { 00893 if (CaptureBuffer != NULL) { 00894 CsrFreeCaptureBuffer( CaptureBuffer ); 00895 } else if (a->ReadVM) { 00896 // a->BufPtr was allocated with RtlAllocateHeap. 00897 RtlFreeHeap( RtlProcessHeap(), 0, a->BufPtr); 00898 } 00899 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 00900 return FALSE; 00901 } 00902 CsrClientCallServer( (PCSR_API_MSG)&m, 00903 CaptureBuffer, 00904 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 00905 ConsolepWriteConsoleOutput 00906 ), 00907 sizeof( *a ) 00908 ); 00909 if (CaptureBuffer != NULL) { 00910 CsrFreeCaptureBuffer( CaptureBuffer ); 00911 } else if (a->ReadVM) { 00912 // a->BufPtr was allocated with RtlAllocateHeap. 00913 RtlFreeHeap(RtlProcessHeap(),0,a->BufPtr); 00914 } 00915 *lpWriteRegion = a->CharRegion; 00916 if (!NT_SUCCESS(m.ReturnValue)) { 00917 SET_LAST_NT_ERROR(m.ReturnValue); 00918 return FALSE; 00919 } 00920 else { 00921 return TRUE; 00922 } 00923 00924 }

BOOL APIENTRY WriteConsoleOutputString IN HANDLE  hConsoleOutput,
IN CONST VOID *  lpString,
IN DWORD  nLength,
IN DWORD  nSize,
IN DWORD  fFlags,
IN COORD  dwWriteCoord,
OUT LPDWORD  lpNumberOfElementsWritten
 

defined(BUILD_WOW64)

Definition at line 1212 of file iostubs.c.

References _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::BufPtr, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::ConsoleHandle, ConsolepWriteConsoleOutputString, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::NumRecords, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::OutputHandle, SET_LAST_ERROR, SET_LAST_NT_ERROR, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::String, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::StringType, TRUE, _CONSOLE_API_MSG::u, and _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::WriteCoord.

Referenced by WriteConsoleOutputAttribute(), WriteConsoleOutputCharacterA(), and WriteConsoleOutputCharacterW().

01224 : 01225 01226 hConsoleOutput - Supplies an open handle to the screen buffer (CONOUT$) 01227 that is to be written. The handle must have been created with 01228 GENERIC_WRITE access. 01229 01230 lpString - Supplies the address of a buffer containing the character 01231 or attribute string to write to the screen buffer. 01232 01233 nLength - Length of string to write, in elements. 01234 01235 nSize - Size of element to read. 01236 01237 fFlags - flag indicating what type of string to copy 01238 01239 dwWriteCoord - Screen buffer coordinates to write the string to. 01240 01241 lpNumberOfElementsWritten - Pointer to number of elements written. 01242 01243 Return Value: 01244 01245 TRUE - The operation was successful. 01246 01247 FALSE/NULL - The operation failed. 01248 Extended error status is available using GetLastError. 01249 01250 --*/ 01251 01252 { 01253 01254 PCSR_CAPTURE_HEADER CaptureBuffer; 01255 CONSOLE_API_MSG m; 01256 PCONSOLE_WRITECONSOLEOUTPUTSTRING_MSG a = &m.u.WriteConsoleOutputString; 01257 ULONG DataLength; 01258 01259 a->ConsoleHandle = GET_CONSOLE_HANDLE; 01260 a->OutputHandle = hConsoleOutput; 01261 a->NumRecords = nLength; 01262 a->StringType = fFlags; 01263 a->WriteCoord = dwWriteCoord; 01264 01265 // 01266 // for speed in the case where the string is small, we have a buffer 01267 // in the msg we pass to the server. this means we don't have to 01268 // allocate a capture buffer. 01269 // 01270 01271 DataLength = nLength*nSize; 01272 if (DataLength > sizeof(a->String)) { 01273 CaptureBuffer = CsrAllocateCaptureBuffer( 1, 01274 DataLength 01275 ); 01276 if (CaptureBuffer == NULL) { 01277 SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY); 01278 return FALSE; 01279 } 01280 CsrCaptureMessageBuffer( CaptureBuffer, 01281 (PCHAR) lpString, 01282 DataLength, 01283 (PVOID *) &a->BufPtr 01284 ); 01285 } 01286 else { 01287 a->BufPtr = a->String; 01288 CaptureBuffer = NULL; 01289 01290 try { 01291 RtlCopyMemory(a->BufPtr, lpString, DataLength); 01292 } except( EXCEPTION_EXECUTE_HANDLER ) { 01293 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01294 return FALSE; 01295 } 01296 } 01297 CsrClientCallServer( (PCSR_API_MSG)&m, 01298 CaptureBuffer, 01299 CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX, 01300 ConsolepWriteConsoleOutputString 01301 ), 01302 sizeof( *a ) 01303 ); 01304 if (CaptureBuffer != NULL) { 01305 CsrFreeCaptureBuffer( CaptureBuffer ); 01306 } 01307 try { 01308 *lpNumberOfElementsWritten = a->NumRecords; 01309 } except( EXCEPTION_EXECUTE_HANDLER ) { 01310 SET_LAST_ERROR(ERROR_INVALID_ACCESS); 01311 return FALSE; 01312 } 01313 if (!NT_SUCCESS(m.ReturnValue)) { 01314 SET_LAST_NT_ERROR(m.ReturnValue); 01315 return FALSE; 01316 } 01317 else { 01318 return TRUE; 01319 } 01320 01321 }

BOOL APIENTRY WriteConsoleOutputW HANDLE  hConsoleOutput,
CONST CHAR_INFO *  lpBuffer,
COORD  dwBufferSize,
COORD  dwBufferCoord,
PSMALL_RECT  lpWriteRegion
 

defined(BUILD_WOW6432)

Definition at line 932 of file iostubs.c.

References TRUE, and WriteConsoleOutputInternal().

00939 { 00940 return WriteConsoleOutputInternal(hConsoleOutput, 00941 lpBuffer, 00942 dwBufferSize, 00943 dwBufferCoord, 00944 lpWriteRegion, 00945 TRUE 00946 ); 00947 }


Generated on Sat May 15 19:44:21 2004 for test by doxygen 1.3.7