No magic, just basic -- read windows core programming Preface

Source: Internet
Author: User

 

Today, I read the preface of the book "Windows core programming" carefully. Some of the remarks are reasonable and worth remembering. ========================================================== =================================== Preface

Microsoft Windows is a complex operating system. It provides a wide range of features, and it is almost impossible for anyone to fully understand the entire system. The complexity also makes it difficult for us to determine where the main focus should be. As a matter of fact, I have always been inclined to start from the bottom layer and have a deep understanding of the basic components of the system. Once you have mastered the most basic things, you can easily add more high-level things to your knowledge base.Therefore, this book will focus on the basic components and basic concepts of windows, which must be mastered for the architecture and implementation of Windows applications. In short, this book introduces you to various windows features and describes how to understand and use these features through the C and C ++ languages.
Although this book does not cover certain Windows concepts, such as Component Object Model (COM ), however, COM is built on basic components such as processes, threads, memory management, DLL, local thread storage areas, and Unicode. If you understand these basic components, understanding COM is equivalent to understanding how to use these basic components. I am very sorry for those friends who are trying to skip these basic components and carefully study the com architecture. To improve the knowledge base, they still have a long way to go, which will inevitably have a great negative impact on their code and software development progress. (Thinkhy: In, I learned about com and took a detour. No magic, just basic !) 
Microsoft. net Framework's Common Language Runtime (CLR) is another technology not involved in this book. (If you are interested, you can read another monograph on Framework Design: CLR via C #). However, CLR is implemented as a COM object in the dynamic link library (DLL). It needs to be loaded into the process, and it needs to use threads to execute code, it needs to process Unicode strings, and it also needs to manage these strings in memory. Therefore, the basic components introduced in this book still help software developers write managed code. In addition, with the help of the CLR platform call (platform invocation, P/invoke) technology, we can call various windows APIs described in this book.
   In this way, the purpose of this book is to introduce the basic Windows Components that every Windows developer should master (at least in my opinion ). (Thinkhy: the purpose of writing windows internal is: this is a book about internal mechanisms, not a user guide, programming or system management type book, so, this book does not describe how to use, program, or configure windows ).When introducing each component, I will also describe how the system uses these components, and how our own applications make full use of these components. In many chapters, I will introduce how to create your own components. Our own components are generally implemented as common functions or C ++ classes. They combine some windows components to create a whole. The result is far greater than the sum of parts.
64-bit Windows OS
Microsoft released a 32-bit Windows operating system that supports the x86 CPU architecture for many years. Microsoft now provides 64-bit Windows operating systems that support x64 and IA-64 CPU architectures. Computers Based on these 64-bit CPU architecture were quickly accepted by the market. In fact, in the near future, all desktops and servers will use 64-bit CPUs. (Thinkhy: in fact, most of the client's servers are 64-bit machines. 64-bit programming is not a future, but a current demand !)To this end, Microsoft has issued a statement that Windows Server 2008 will be the last 32-bit version of Windows! For developers, it is time to concentrate on enabling their applications to run properly on 64-bit Windows operating systems. Throughout this book, we will cover all the relevant knowledge, allowing developers to run their applications on 64-bit Windows operating systems (including 32-bit windows.
The biggest benefit of an application from a 64-bit address space is that it can easily process large amounts of data because the application process is no longer limited by 2 GB of available address space. Even if the application does not need all of these spaces, Windows itself can use this apparently much larger address space (about 8 TB) to speed up its operation.
What do we need to know about the 64-bit Windows operating system? Let's take a look.
The 64-bit Windows kernel is a 32-bit Windows Kernel transplant version. This means that all the previous 32-bit windows details and difficulties are applicable to 64-bit windows. In fact, Microsoft has modified the 32-bit Windows source code so that it can generate both a 32-bit system and a 64-bit system. The two systems use the same source code library, so the repair of new features and defects will be applied to both systems at the same time.
Because the kernel uses the same code and basic concepts, Windows APIs on both platforms are the same. This means that we don't have to redesign or implement the application, so we can run it on a 64-bit Windows operating system. We only need to make a few changes to the source code, and then re-build the application.
To maintain backward compatibility, the 64-bit Windows operating system can execute 32-bit applications. However, if an application is generated as a 64-bit application, its performance will be significantly improved.
Because it is very easy to port 32-bit code, there are already many device drivers, tools, and applications in the 64-bit Windows operating system. Unfortunately, Visual Studio is 32-bit, and Microsoft does not seem eager to port it to 64-bit. However, the good news is that 32-bit Visual Studio does run very well on 64-bit windows, but its data structure has limited address space. In addition, we can also use Visual Studio to debug 64-bit applications.
You do not need to learn too much new knowledge. Most data types are still 32-bit in width, which many readers are happy to see. They are int, DWORD, long, And bool. In fact, in most cases, we only need to worry about pointers and handles, because they are now 64-bit.
Microsoft has provided a wealth of information on how to change the existing source code to 64-bit, so we do not intend to go into these details in this book. However, when I write each chapter, I will consider the 64-bit Windows operating system. When appropriate, I will add 64-bit windows information. At the same time, I have compiled and tested all the sample programs in this book in 64-bit windows. Therefore, if you follow the example programs in the book and my practices, creating a source code library that can be compiled for 32-bit or 64-bit windows will be completely non-problematic.
New Content in Windows core programming (version 5th)
In the past, this book was named "Advanced NT", "advanced windows", and "Programming Application for Microsoft Windows. To maintain this tradition, the 5th version of this book also has a new title, namely Windows via C/C ++. The new title indicates that this book was designed for C and C ++ programmers who intend to understand windows. Version 5th fully covers 2008 new functions and Windows features in Windows XP, Windows Vista, and Windows Server 170.
Some chapters have been completely rewritten, such as chapter 11th, which explains how to use the new thread pool API. The original chapters of version 4th have been significantly revised to highlight new features. For example, in chapter 4th, the introduction of User Account Control is now included, and Chapter 8th introduces the new synchronization mechanism.
At the same time, I also introduced more comprehensively how the C/C ++ Runtime Library interacts with the operating system, with special emphasis on security and exception handling. Finally, two chapters are added in version 5th to explain how I/O operations work and how to thoroughly understand the new Windows Error Reporting System, this system has changed the way we must consider application error reports and application recovery.

 

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.