Skip to content

Console x86 Functions

mrfearless edited this page Feb 10, 2019 · 3 revisions

Console x86 Functions

ConsolePause

Description: Pauses console and waits for a keypress. Optionally displays a message, see the bConMsgType constants for values that can be used.

Parameters: dwConMsgType

ConsoleStdOut / ConsoleText

Description: Output text to console as specified by zero terminated text pointed to by the lpszConText parameter.

Parameters: lpszConText

ConsoleStdOutColor / ConsoleTextColor

Description: Output colored text to console as specified by zero terminated text pointed to by the lpszConText parameter.

Parameters: lpszConText, Color

ConsoleStdIn

Description: Input text from console to a specified buffer.

Parameters: lpszConInputBuffer, dwSizeConInputBuffer

ConsoleStdInW

Description: Input text from console to a specified buffer. Unicode version.

Parameters: lpszWideConInputBuffer, dwSizeWideConInputBuffer

ConsoleStdErr

Description: Output console error text.

Parameters: lpszErrText

ConsoleClearScreen / ConsoleCls

Description: Clears the console screen.

Parameters: None

ConsoleShowCursor

Description: Show the console cursor (caret)

Parameters: None

ConsoleHideCursor

Description: Hide the console cursor (caret)

Parameters: None

ConsoleGetTitle

Description: Retrieve the title of the console window to the buffer specified.

Parameters: lpszConTitle, dwSizeConTitle

ConsoleGetPosition

Description: Get the current cursor (caret) x and y position.

Parameters: lpdwXpos, lpdwYpos

ConsoleSetTitle

Description: Set the console window title as specified by the zero terminated string pointed to by the lpszConTitle parameter.

Parameters: lpszConTitle

ConsoleSetPosition

Description: Set the current cursor (caret) x and y position.

Parameters: dwXpos, dwYpos

ConsoleSetIcon

Description: Set the console window icon.

Parameters: IcoResID

ConsoleAnimateIconStart

Description: Animate a series of icons in the console window icon.

Parameters: IcoResIDStart, IcoResIDFinish, dwTime, dwTimeIconStep

ConsoleAnimateIconStop

Description: Stops the animation of the series of icons animating.

Parameters: None

ConsoleSpinnerStart

Description: Draws a spinner from |-/\ characters at the specified position.

Parameters: dwXpos, dwYpos, dwXoffset, dwYoffset

ConsoleSpinnerStop

Description: Stops the spinner.

Parameters: None

ConsoleStarted

Description: Returns in eax TRUE if started via console or FALSE if started via explorer.

Parameters: None

ConsoleAttach

Description: Attaches a console.

Parameters: None

ConsoleFree

Description: Frees an attached console

Parameters: None

ConsoleParseCmdLine

Description: Parses the command line parameters into array. Make sure buffer is large enough for all parameters. Returns in eax total parameters.

Parameters: dwParametersArray

ConsoleCmdLineParam

Description: Fetches a specified parameter index from the parameters array (from the ConsoleParseCmdLine function) and returns it in the buffer pointed to lpszReturnedParameter

Parameters: dwParametersArray, dwParameterToFetch, dwTotalParameters, lpszReturnedParameter

ConsoleCmdLineParamType

Description: Determines the speficied parameter index type. Returns in eax one of the following constants: CMDLINE_PARAM_TYPE_ERROR, CMDLINE_PARAM_TYPE_UNKNOWN, CMDLINE_PARAM_TYPE_SWITCH, CMDLINE_PARAM_TYPE_COMMAND, CMDLINE_PARAM_TYPE_FILESPEC, CMDLINE_PARAM_TYPE_FILENAME, CMDLINE_PARAM_TYPE_FOLDER

Parameters: dwParametersArray, dwParameterToFetch, dwTotalParameters

ConsoleSwitchRegister

Description: Registers a switch (/ or - or -- followed by letters, symbols or numbers) that is valid for the command line parameters.

Parameters: lpszSwitch, dwSwitchID, bCaseSensitive

ConsoleSwitchID

Description: Returns in eax dwSwitchID or -1 if fail

Parameters: lpszSwitch, bCaseSensitive

ConsoleCommandRegister

Description: Registers a command (Letters without a switch) that is valid for the command line parameters.

Parameters: lpszCommand, dwCommandID, bCaseSensitive

ConsoleCommandID

Description: Returns in eax dwCommandID or -1 if fail

Parameters: lpszCommand, bCaseSensitive

Console Constants

ConsolePause bConMsgType:

  • CON_PAUSE_NO_MSG - Doesnt output any console message.
  • CON_PAUSE_ANY_KEY_CONTINUE - Outputs 'Press any key to continue'
  • CON_PAUSE_ANY_KEY_EXIT - Outputs 'Press any key to exit'

ConsoleCmdLineParamType return values:

  • CMDLINE_PARAM_TYPE_ERROR - Error occured
  • CMDLINE_PARAM_TYPE_UNKNOWN - Unknown switch or command
  • CMDLINE_PARAM_TYPE_SWITCH - A switch, ie: /?, /Q
  • CMDLINE_PARAM_TYPE_COMMAND - A command, ie: Xa, C
  • CMDLINE_PARAM_TYPE_FILESPEC - A file spec, ie: *.*, <filename>.*, *.<ext>
  • CMDLINE_PARAM_TYPE_FILENAME - A filename: <filename.ext>
  • CMDLINE_PARAM_TYPE_FOLDER - A folder: C:\Windows, .\MyFolder, ..\OtherFolder

ConsoleStdOutColor & ConsoleTextColor color values:

  • FOREGROUND_BLUE
  • FOREGROUND_GREEN
  • FOREGROUND_RED
  • FOREGROUND_INTENSITY
  • FOREGROUND_WHITE
  • FOREGROUND_YELLOW
  • FOREGROUND_GREEN
  • FOREGROUND_MAGENTA
  • FOREGROUND_BLACK
  • FOREGROUND_INTENSE_RED
  • FOREGROUND_INTENSE_GREEN
  • FOREGROUND_INTENSE_BLUE
  • FOREGROUND_INTENSE_WHITE
  • FOREGROUND_INTENSE_YELLOW
  • FOREGROUND_INTENSE_CYAN
  • FOREGROUND_INTENSE_MAGENTA
  • BACKGROUND_BLUE
  • BACKGROUND_GREEN
  • BACKGROUND_RED
  • BACKGROUND_INTENSITY
  • BACKGROUND_WHITE
  • BACKGROUND_YELLOW
  • BACKGROUND_CYAN
  • BACKGROUND_MAGENTA
  • BACKGROUND_BLACK
  • BACKGROUND_INTENSE_RED
  • BACKGROUND_INTENSE_GREEN
  • BACKGROUND_INTENSE_BLUE
  • BACKGROUND_INTENSE_WHITE
  • BACKGROUND_INTENSE_YELLOW
  • BACKGROUND_INTENSE_CYAN
  • BACKGROUND_INTENSE_MAGENTA

Clone this wiki locally