0

Im using OllyDbg to reverse engineer an executable for my lab assignment. My professor has asked a question asking for the APIs responsible for writing output to the command prompt. The DLLS used were ntdll, kernel32, msvcr100

1 Answers1

0

There are more than a couple of ways to achieve this but the famous two are WriteConsole and WriteFile.

From MSDN documentation:

WriteConsole

Writes a character string to a console screen buffer beginning at the current cursor location.

BOOL WINAPI WriteConsole(
  _In_             HANDLE  hConsoleOutput,
  _In_       const VOID    *lpBuffer,
  _In_             DWORD   nNumberOfCharsToWrite,
  _Out_            LPDWORD lpNumberOfCharsWritten,
  _Reserved_       LPVOID  lpReserved
);

WriteFile

Writes data to the specified file or input/output (I/O) device. This function is designed for both synchronous and asynchronous operation.

BOOL WINAPI WriteFile(
  _In_        HANDLE       hFile,
  _In_        LPCVOID      lpBuffer,
  _In_        DWORD        nNumberOfBytesToWrite,
  _Out_opt_   LPDWORD      lpNumberOfBytesWritten,
  _Inout_opt_ LPOVERLAPPED lpOverlapped
);

...
...
Characters can be written to the screen buffer using WriteFile with a handle to console output. The exact behavior of the function is determined by the console mode. The data is written to the current cursor position. The cursor position is updated after the write operation.

Megabeets
  • 1,378
  • 11
  • 19