Windows core Programming Reading notes-fourth chapter process

Source: Internet
Author: User

1. Process composition

    • A kernel object that the operating system uses to manage processes.
    • An address space that contains code and data for all executable files or DLL modules. In addition, it contains dynamic memory allocations, such as thread stacks and heap allocations.

2. A process can have multiple threads, and all threads execute code "simultaneously" in the address space of the process. Each process must have at least one thread to execute the code contained in the process address space.

3. When you use Microsoft Visual Studio to create an application project, the set development environment sets up various linker switches that allow the linker to embed the correct type of subsystem into the resulting executable file. For the CUI program, this linker switch is /subsystem:console, and for GUI programs, it is /subsystem:windows

4. Application types and corresponding entry-point functions

Application type entry point function (portal) embedded executable startup function
GUI application handling ANSI characters and strings _twinmain (WinMain) winmaincrtstartup
GUI application for processing Unicode characters and strings _twinmain (wWinMain) /td> wwinmaincrtstartup
handling ANSI characters and words String cui application _tmain (Main) maincrtstartup
The cui application that handles Unicode characters and strings _tmain (Wmain wmaincrtstartup

5. Purpose of the Start function

    • Gets a pointer to the full command line of the new process
    • Gets a pointer to the environment variable for the new process
    • Initializes a global variable for the C + + runtime library. If StdLib.h is included, our code can access these variables
    • Initializes the heap (heap) used by the C run-time Library memory allocation function (malloc and calloc) and other underlying I/O routines
    • Constructors that call all global and static C + + class objects

6. Each executable file or DLL file loaded into the process address space is given a unique instance handle. An instance of the executable file is passed in as the first parameter of the (W) WinMain function Hinstanceexe. (W) The actual value of the Hinstanceexe parameter of the WinMain is a memory base address: The system loads the image of the executable file into this location in the city address space.

7.HMODULE and hinstance are exactly the same thing.

8.

Windows core Programming Reading notes-fourth chapter process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.