Console A presentation by Inti Vincenzo Pizzoni.

Slides:



Advertisements
Similar presentations
Computer Graphics1 Windows NT Graphics Interface.
Advertisements

Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
CS 140 Lecture Notes: Processes and ThreadsSlide 1 UNIX Fork/Exec Example int pid = fork(); if (pid == 0) { exec("foo"); } else { waitpid(pid, &status,
1 JMH Associates © 2004, All rights reserved Chapter 6 Process Management.
ISP – 3 rd Recitation “The joy of Windows API” Processes Threads Handles Relevant functions A simple code example.
Operating Systems.
Terminal Services Terminal Services is the modern equivalent of mainframe computing, in which servers perform most of the processing and clients are relatively.
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
Mastering the AS/400, Third Edition, author Jerry Fottral 1 Week 2 The System The AS/400 is a multi-user, multi-tasking system -- a system on which many.
Software GCSE COMPUTING.
CGMB214: Introduction to Computer Graphics
1 Server Design Discuss Design issues for Servers Review Server Creation in Windows.
OPERATING SYSTEMS BY LANDON, KYLE, AND ETHAN. WHAT IS THEIR PURPOSE? (1) manage the computer's resources, such as the central processing unit (2) establish.
Chapter Eleven The X Window System. 2 Lesson A Starting and Navigating an X Window System.
Fall 2002 CS 325 Class Notes Page 1 Lecture 25 Today –exec() in Unix –CreateProcess in Windows Announcements.
Notes on Processes, Context, Context Switching The following slides contain partially quoted statements from various Wikipedia pages.
Hardware/Software Basics Test Get out your DIY Test Review.
Operating Systems Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Programming Logic and Design Seventh Edition Chapter 12 Event-Driven GUI Programming, Multithreading, and Animation.
Lecture Lecture 25 Review of Last Lecture DLL’s DLL’s Processes Processes Threads Threads Memory Management Memory Management.
System SOFTWARE.
Principles of Information Technology
Dive Into® Visual Basic 2010 Express
Microsoft Foundation Classes MFC
Basics of Computer A Computer is Electronic device that can
Computer Literacy BASICS
Clocks, I/O devices, Thin Clients, and Power Management
Topics Graphical User Interfaces Using the tkinter Module
Chapter 7 Text Input/Output Objectives
Information Security Professionals
11.10 Human Computer Interface
Windows Programming Lecture 09.
Chapter 7 Text Input/Output Objectives
Console and GUI Programs
Basic Computer for Small Business
Windows Concurrency Concepts and APIs
Basic Computer for Small Business
An Introduction to Computers and Visual Basic
Understand Windows Forms Applications and Console-based Applications
What is an operating system?
Computer Parts There are many parts that work together to make a computer work.
User Interface Design Notes are from: Wilson, Software Design and Development The Preliminary Course. Cambridge Press. pp and Fowler,
Exploring the Basics of Windows XP
EE 422C Java FX.
User Interface Software Look under the hood
Module 1.
Linux Fork/Exec Example
Windows APIs File Processing Copyright © 2016 Curt Hill.
Made by Aistė Augustinaitė Software Engineering 3 group
UNIX Fork/Exec Example
Interprocess Communication
Interactive Input Methods & Graphical User Input
X Windows.
Exploring the Basics of Windows XP
MBI 630: Week 11 Interface Design
GRAPHICAL USER INTERFACE
UNIX Fork/Exec Example
DOS and window operating system
Interactive Input Methods & Graphical User Input
An Introduction to Computers and Visual Basic
Process Description and Control
Prepare a DD Form 1081-Return
Windows desktop sharing
Chapter 3: Processes.
The Main Features of Operating Systems
Linux Fork/Exec Example
The CreateFile Function
Human and Computer Interaction (H.C.I.) &Communication Skills
Advanced GUIs and Graphics
Human-computer interaction
Presentation transcript:

Console A presentation by Inti Vincenzo Pizzoni

What is a Console? Traditionally: computer terminal where a user may input commands and view output (i.e. results of inputted commands or status messages from the computer) Often connected to a remote computer or computer system that is controlled from the console A console traditionally refers to a computer terminal where a user may input commands and view output such as the results of inputted commands or status messages from the computer. It is often connected to a remote computer or computer system that is controlled from the console.

What was a Console? Early days of computers: usually only a few consoles available for computer systems such as a mainframe → the term "console" actually referred to the terminal from which the computer could be controlled. Now: computer screen and input devices of computers are referred to as separate objects, namely, the monitor and input devices, and not as a single console. The console no longer refers strictly to the monitor, but to a piece of software, such as a command prompt, where a user can input advanced commands. → Called a console because it is similar in function to the hardware console, which allows users advance use of the computer system it is attached to. In the early days of computers, there were usually only a few consoles available for a computer system such as a mainframe, meaning that the term "console" actually referred to the terminal from which the computer could be controlled. This term has since lost its original meaning, and people now refer to the computer screen and input devices of computers as separate objects, namely, the monitor and input devices, and not as a single console. In PC terms, the console no longer refers strictly to the monitor but to a piece of software, such as a command prompt, where a user can input advanced commands. This type of software is called a console because it is similar in function to the hardware console, which allows users advance use of the computer system it is attached to.

Components of a Console Console: input buffer + one or more screen buffers. The input buffer contains a queue of input records, each of which contains information about an input event. The input queue always includes key-press and key-release events. It can also include mouse events (pointer movements and button presses and releases) and events during which user actions affect the size of the active screen buffer. A screen buffer is a two-dimensional array of character and color data for output in a console window. Any number of processes can share a console. A console consists of an input buffer and one or more screen buffers. The input buffer contains a queue of input records, each of which contains information about an input event. The input queue always includes key-press and key-release events. It can also include mouse events (pointer movements and button presses and releases) and events during which user actions affect the size of the active screen buffer. A screen buffer is a two-dimensional array of character and color data for output in a console window. Any number of processes can share a console.

Creating a Console The system creates a new console when it starts a console process, a character-mode process whose entry point is the main function. A process can create a console by using one of the following methods: A graphical user interface (GUI) or console process can use the CreateProcess function with CREATE_NEW_CONSOLE to create a console process with a new console.  A GUI or console process that is not currently attached to a console can use the AllocConsole function to create a new console.  Usually by default a console process inherits its parent's console, while GUI processes are not attached to a console when they are created. 

Creating a New Console C BOOL CreateProcessA ( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); The function CreateProcess Creates a new process and its primary thread. The new process runs in the security context of the calling process. Here we have to specify the CREATE_NEW_CONSOLE flag When a process uses CreateProcess, it can specify a STARTUPINFO structure, whose members control the characteristics of the first new console created for the child process. 

Creating a New Console C typedef struct _STARTUPINFOA { DWORD cb; LPSTR lpReserved; LPSTR lpDesktop; LPSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; LPBYTE lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; } STARTUPINFOA, *LPSTARTUPINFOA; The STARTUPINFO structure specified in the call to CreateProcess affects a console created if the CREATE_NEW_CONSOLE flag is specified. It also affects a console created if the child process subsequently uses AllocConsole. The following console characteristics can be specified: Size of the new console window, in character cells. Location of the new console window, in screen pixel coordinates. Size of the new console's screen buffer, in character cells. Text and background color attributes of the new console's screen buffer. Display name for the title bar of the new console's window.

Attaching to a Console A process can use the AttachConsole function to attach to a console. A process can be attached to one console. C BOOL WINAPI AttachConsole( _In_ DWORD dwProcessId ); This function has one parameter: dwProcessId [in] which is the identifier of the process whose console is to be used. This parameter can be the pid to use the console of the specified process or ATTACH_PARENT_PROCESS (DWORD)-1 to use the console of the parent of the current process. If the function succeeds, the return value is nonzero, otherwise If the function fails, the return value is zero. A console can have many processes attached to it. To retrieve a list of the processes attached to a console, call the GetConsoleProcessList function.

Closing a Console A process can use the FreeConsole function to detach itself from its console. C BOOL WINAPI FreeConsole(void); This function has no parameters and succeeds, the return value is nonzero, otherwise If the function fails, the return value is zero. If other processes share the console, the console is not destroyed, but the process that called FreeConsole cannot refer to it. After calling FreeConsole, the process can use AllocConsole to create a new console or AttachConsole to attach to another console. A console is closed when the last process attached to it terminates or calls FreeConsole.

Thank you for your attention!

Sources https://docs.microsoft.com/en-us/windows/console https://docs.microsoft.com/it-it/windows/desktop/api/processthreadsapi https://en.wikibooks.org/wiki/Windows_Programming https://www.techopedia.com