CRT Topics (Part II) Mahmoud Saleh Windows C++ Team.

Slides:



Advertisements
Similar presentations
C Run-time (CRT) topics Mahmoud Saleh Windows C++ Team.
Advertisements

Exceptions Chapter Throwing and Catching Exceptions When a program runs into a problem that it cannot handle, it throws an exception. Exceptions.
Configuring Windows to run Dr.Web scanner remotely.
BIM313 – Advanced Programming Techniques Debugging 1.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Day 10 Threads. Threads and Processes  Process is seen as two entities Unit of resource allocation (process or task) Unit of dispatch or scheduling (thread.
Exceptions and Exception Handling (1) Carl Alphonce CSE116.
C HAPTER 11 Risky Behavior. O VERVIEW Handling Risky Code Exceptions Agreeing to Risk try/catch blocks finally block Declaring an Exception Handle or.
Visual Basic: An Object Oriented Approach 9 - Persistence.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
Chapter 13 Embedded Systems
1 JMH Associates © 2004, All rights reserved Chapter 4 Structured Exception Handling.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
1 JMH Associates © 2004, All rights reserved Chapter 1 Getting Started with Win32/64.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Punit Shah Technical Lead | Microsoft
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
Windows 7 A Brief Overview and Look In. Windows 7 – A Brief Overview and Look In Windows 7 –What is Windows 7? Windows 7 is the 7 th public operating.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
CS 470 Lab 5 Comment your code. Description of Lab5 Create Four projects – Driver – Producer – Filter – Consumer.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Created by the Community for the Community BizTalk 2009 Webcast Series.
Windows NT and Real-Time? Reading: “Inside Microsoft Windows 2000”, (Solomon, Russinovich, Microsoft Programming Series) “Real-Time Systems and Microsoft.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Threads and Processes.
Introduction 1-1 Introduction to Virtual Machines From “Virtual Machines” Smith and Nair Chapter 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
A Comparative Study of the Linux and Windows Device Driver Architectures with a focus on IEEE1394 (high speed serial bus) drivers Melekam Tsegaye
COMP Exception Handling Yi Hong June 10, 2015.
Compatibility and Interoperability Requirements
Operating Systems Session 1. Contact details TA: Alexander(Sasha) Apartsin ◦ ◦ Office hours: Homepage:
Windows Network Programming ms-help://MS.MSDNQTR.2004JAN.1033/winsock/winsock/windows_sockets_start_page_2.htm 井民全.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Pipes & Filters Architecture Pattern Source: Pattern-Oriented Software Architecture, Vol. 1, Buschmann, et al.
Operating Systems Session 1. Contact details TA: Alexander(Sasha) Apartsin ◦ ◦ Office hours: TA: Sasha Alperovich.
CS795.Net Impersonation… why & How? Presented by: Vijay Reddy Mara.
WEB320 Migrating ASP.NET 1.x Applications to ASP.NET 2.0 Stefan Schackow Program Manager Web Platform and Tools Team Microsoft Corporation.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Department of Computer Science and Software Engineering
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 2.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
ICS3U_FileIO.ppt File Input/Output (I/O)‏ ICS3U_FileIO.ppt File I/O Declare a file object File myFile = new File("billy.txt"); a file object whose name.
Remote Access Usages. Remote Desktop Remote desktop technology makes it possible to view another computer's desktop on your computer. This means you can.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 1.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
Top 10 Entity Framework Features Every Developer Should Know
Chapter 4: Threads.
Introduction to ASP By “FlyingBono” 2009_01 By FlyingBono 2009_01
Windows API.
Security mechanisms and vulnerabilities in .NET
KERNEL ARCHITECTURE.
Chapter 3: Windows7 Part 1.
Crash Handlers Riddhiman Ghosh Debugging Applications for
YG - CS170.
Computer Systems Summary
Lecture Topics: 11/1 General Operating System Concepts Processes
1/14/2019 3:57 AM © 2004 Microsoft Corporation. All rights reserved.
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Operating Systems (COL 331)
CSE 153 Design of Operating Systems Winter 2019
Operating System Concepts
Operating System Concepts
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Crash Handlers Riddhiman Ghosh Debugging Applications for
CS Introduction to Operating Systems
Presentation transcript:

CRT Topics (Part II) Mahmoud Saleh Windows C++ Team

FILE IO Buffered vs low-level IO functions – fopen vs open open() maps 1:1 to O/S calls, same thing with _read()/_write(). These maps to CreateFile(), ReadFile() and WriteFile(). No extra buffering by the CRT. Buffered I/O create a buffer for the file data. Few other differences, in terms of standards compliance and dealing with text mode

Controlling the stream buffer By default the buffer size is 4K You can assign your own buffer, or even no buffering: – Use setvbuf()

GS handler, exceptions, etc… With the compiler support, the CRT has some components of the exception handling and GS cookie support implementation

GS cookie handling When a buffer overrun is detected, the GS cookie report handler is executed. By default, the GS cookie handler will allow breaking into the debugger if connected. Ultimately, the application will need to be terminated. /RTC – if enabled, will detect some of the buffer overruns.

How C++ exceptions work try{} catch{} is a Compiler/CRT/User code shared effort. Internally uses the exception handling mechanism provided in Windows; e.g. RaiseException C++ unhandled exceptions – terminate() handler

CRT and Windows APIs CRT implements standards Still, needs to rely on the O/S for the actual implementation. As seen in the prev examples Visual C++ CRT vs. Windows CRT – Use the Visual C++’s in your applications; currently msvcr100.dll (or libcmt.lib). Each version is tested and guaranteed to run on the O/S it supports; e.g. v.10 supports XP SP2 and SP3, Server 2003 SP1 & SP2, Vista, Server 2008 & R2 and Windows 7. – Windows CRT, msvcrt.dll, is a Windows component specific to the version it runs on.

CRT floating point support Uses available architecture, e.g. Math Coprocessor or SSE2. Optimized for the platform it’s running on, x86, x64, … Also, affected by the /fp flag: – /fp:[precise | except[-] | fast | strict ] – Or, use #pragma(float_control, …) Floating point exceptions don’t cause a C++ exception, but rather, an SEH exception, though we can map it to C++ exceptions if we need to. Using _set_se_translator() CRT function to handle floating point exceptions. Suggested reading: Microsoft Visual C++ Floating-Point OptimizationMicrosoft Visual C++ Floating-Point Optimization