Monthly Archives: January 2020

How to become a Windows Expert ?

This article is the continuation of How to become a Microsoft Expert? (http://netazurerangers.com/blog/comment-devenir-un-expert-microsoft/)

Windows has been Microsoft’s technological flagship for 25 years. You will tell me, yes but now there is Azure. OK but what is Azure? It is ; if I ignore the Linux part; Windows Server and Service Fabric… and that’s Windows. It’s C / C ++. And yes, again! There is no secret. it must work quickly and well. It must be reliable, robust, fast and secure.

In one of my last post “C ++ unsafe and unsecure?” (http://netazurerangers.com/blog/c-unsafe-et-unsecure/), I explain why C / C ++ is the best and why Microsoft is doing 95% of its products with. Microsoft is the # 1 company in the software industry. It’s not an advertising agency like Google or Facebook, it’s pure juice Tech. Microsoft sells Products and Services. Anyway next…

How to become a Windows expert? The question is asked. First, we learn about the operating system principles via Microsoft Docs (ex: MSDN LIbrary) on https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/overview-of-windows -components

Then, we read the passage on User mode and Kernel mode via https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/user-mode-and-kernel-mode

From there, we know the basic architecture of Windows. now we attack the elements on the operating system, namely the kernel and the thread scheduler. Windows order threads, Linux order processes. These two systems do not work the same way. The Processes & Threads doc is here: https://docs.microsoft.com/en-us/windows/win32/procthread/about-processes-and-threads

Then we go to practice, how to create a thread, a process, reach the end, etc. the API doc also called reference doc is here: https://docs.microsoft.com/en-us/windows/win32/procthread/process-and-thread-reference

The easiest examples can be viewed via https://docs.microsoft.com/en-us/windows/win32/procthread/process-and-thread-functions#process-and-thread-functions and more specifically the CreateThread function: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread?redirectedfrom=MSDN and its example: https://docs.microsoft.com/en-us/windows / win32 / procthread / Creating-threads

To test this, you must install Visual C ++ available in Visual Studio 2019 for example, Community Edition or Pro 30 day trial. If you received money from Santa Claus, buy the following books:

Windows via C / C ++ by Jeffrey Richter and Christophe Nasarre

Windows Internals ex-Inside Windows NT (https://docs.microsoft.com/en-us/sysinternals/learn/windows-internals)

I bought Inside Windows NT in 1992 and got the virus.

Windows is huge. It’s powerful. You read the Windows Internals book and you will have vision; you will understand how the OS works. It’s very interesting and you will have no trouble understanding new Microsoft technologies with that. Microsoft NET, CLR, BCL, it’s done with C ++ and parts of the Windows API aka Win32. Watch the code on GitHub of CoreCLR (https://github.com/dotnet/runtime)

There are urban legends that Microsoft rewrites Windows from scratch; this is for managers and IT 01. For technicians, the truth is that Windows is sitting on the same code and has been evolving for 25 years. The code is improved and regularly revised in Modern C ++. I can certify it because I have the source code of Windows NT 4, Windows 2000 and access to the latest source code of Windows 190x. The code is made in:

C for kernel and drivers
in C / C ++ for the rest.
What is Modern C ++?

automatic memory release with smart points
using the Standard Template Library (STL)
use of C ++ 11/14/17 with auto, lambdas, etc.
Windows uses COM technology a lot. A COM component is registered in the registry and is invoked via APIs (https://docs.microsoft.com/en-us/windows/win32/api/_com/)

A COM component is a class with AddRef, Release, QueryInterface and methods:

The COM component is created via CoCreateObject and the COM factory:

For more information on COM components, I made in 200x a translation of some elements of “Inside COM + Base Services”: Apartments | Threads | Apartments types | Threading for In-Proc components | Apartment and languages

For more information on COM, get your hands on Inside COM + Base Services (http://www.windowscpp.com/Books/MSPress-InsideCOMBaseServices.zip) or on docs but on docs, the doc is spartan.

201x saw Microsoft turn to open source so you can find Windows components in open source:

Windows Terminal (https://github.com/microsoft/terminal)
Windows NET CoreCLR (https://github.com/dotnet/runtime)
Do like me, study these two modules and try to contribute in GitHub. And who knows, one day, you may work for Microsoft!

Chick!

Christophe | http://www.christophepichaud.com

My Microsoft’s resolutions for 2020

Friends Softies,

(EMail sent to my old Microsoft coworkers)

Here are my good resolutions for 2020…

Let me make an announcement: I want to work again for Microsoft and more particularly for Corp. It may go through Services before, I don’t know, but I’m working on it. As I told my friends Alain and the zErics, working at Microsoft was a dream but it stopped suddenly. I would not go back on this episode and the reasons for this stop, the page is turned.
Since I’m an MVP, I’ve had access to a lot of things and it’s great. Microsoft is the number 1 software company, there’s no question about it. You are working on it and you know it. This company is magnificent, the products are nickel and especially the technology is fantastic. Who doesn’t have a passion for an SDK or a product? Our job is made of passion, laughter and tears. Today’s failures will be tomorrow’s successes.

When I read Windows code, it’s complex but it’s beautiful. C ++ code contains something that other languages ​​do not have. The Microsoft style based on COM is very special. The mix between Windows types (COM strings, VARIANT, UINT, DWORD, UNICODE LPWSTR, wchar_t and char *) and C ++ types (wstring and string) means that the code is made with several styles. We find the business code mostly made in COM components or in C ++ ISO code and the specific glue in Win32 API. Don Box said “COM is love”. That is true. A coclass of a COM component is a C ++ class. We have a class in shared_ptr mode, an ambiguous AddRef ctor, an ambiguous Release dtor, a QueryInterface cast to obtain the different interfaces (a C ++ class can implement several interfaces and can inherit from several classes unlike C # which can only inherit from d ‘only one class).

In the Windows Terminal code, there is for example the WinUI code of the frame (tabbed and Window and popup menu and menu) written in pure Windows API and XAML Islands, the code of the cmd with its char buffer engine, its interpreter and the code Ancestral Windows rewritten in modern C ++. The code is improved. It’s like a good Burgundy, it gets better over time. The C ++ 98/03 code is improved in C ++ 11/14 code and gradually this Modern C ++ makes the code nickel, it is beautiful! For example, I made a contribution with PR (pull-request accepted on June 19, 2019 https://github.com/microsoft/terminal/pull/1161) which consisted of putting a shared_ptr on a raw pointer and doing the plumbing that goes with it to play with a reference behind. The memory is released automatically via the smart pointer. It’s beautiful. There is plenty of TODO and FIXME in the code to improve the Windows legacy code. I saw that it has been 4 years since the CMD code has been refactored and improved. It may be my memory that betrays me but I think that’s it; seen in code comments. You don’t realize the power of Windows tools. The GitHub code archive for Windows Terminal (https://github.com/microsoft/terminal) alone is 9.3 MB. There are 6.3 MB of .h and .cpp files. It’s not bad already. Huge for a single individual to understand. CMD is a complex tool that goes beyond a simple dir c: \! It’s a pillar of Windows. Our system admins know this. I intend to continue to invest a little more on Windows Terminal because it is exciting. This is my first resolution.

Then there is the CoreCLR (https://github.com/dotnet/runtime) which is the NET runtime. There I put myself thoroughly because it is a part of my future that is playing on it. I will learn and potash the beast to understand how it works. The archive is 99MB and unzipped is 777MB. It’s huge but good, there are unit tests & co but good C ++ code is about 76MB in size without the tests. Suffice to say that this is huge from huge. OK Windows is 1 GB of source code but we are just talking about the Windows \ NET Framework folder mscoree.dll and company… with the DLLs of the BCL system.xxx. & co. I have 3 months to navigate, explore and understand the code. This is my second resolution. Then I try the Isue … I have to find something easy at first, a FIXME or TODO basic to get into it.

Then there is the Windows code via the NDA Shared Source Initiative and there it is my regular favorite: read the Windows source code. For those who do not know C ++, this is the opportunity to get started. Buy my book “C ++ Aide-Mémoire” and ask for access to the Windows source code and admire the quality of the Windows Engineers code. I have a lot of respect for Windows code. Since I got my hands on the Windows NT4 and Windows 2000 leak (2 GB of source code) in the years 2000/2002, I have spent many hours studying this code. The kernel, RTL NTUser & co dlls, Shell, File Explorer. This is a Star Wars novel in 350 Volumes. It’s beautiful. It’s complex but at the same time subtle and organized. Damn, it’s good! That’s why I have so much admiration for Bill Gates. Windows is a flagship of technology. OK sometimes it’s good old C / C ++ but it works fast and well.

When I discovered Windows Internals (7th edition Part 16th Edition Part 16th Edition Part 2) in the 2000s, I saw the virgin because it helped me understand Windows sources then when I discovered Windows Protocols (https://docs.microsoft.com/en-us/openspecs/protocols/ ms-protocolslp / 9a3ae8a2-02e5-4d05-874a-b3551405d8f9), that was the grail. When I was at Services in 2017, I was surprised, people don’t know that. The culture of the NET means that people are very little cultivated on Windows while it is the flagship of the company. OK, now there is Azure but hey Azure is Windows Server and Service Fabric and all that is Windows. I ignore the Linux part … Each Microsoftie should be offered to deliver Windows Internals for its arrival in the company!

In short you will understand, my goal is to work for Corp. I’m working on it. Being blacklisted at Services France, I will find a way to get out of it via GitHub and my relationships with the Visual C ++ team in the US. My friend Simon Brand is a good C ++ advocate and yet lives in Edinburg, UK. France is very special … C ++ is limited. The companies for Services make, for the development with Microsoft Technologies, C # / NET.

Happy New Year to all the girlfriends.

Kisses to my mentor EricV. Kisses to EricMitt. Kisses to Alain.

Kisses to Agnes, my HEXV2 Project Director of OBS in 2006…. We got on well with GGray, PCP, Nicolas. I’m still in touch with the ex-OBS colleagues for whom we had to replace their Linux system (700,000) BAL POP / IMAP with Exchange Server via HMC… We meet regularly over a beer with Gael Roualland, the little genius from OBS who gave us a hard time and his friends at the time. Since I also switched to Debian Linux and Ubuntu (C ++ requires), they accept me but chamber me by saying that Microsoft is my best enemy so I love you either. They tell me to dump everything on builder than on Linux and that I would be more successful than with Microsoft … I disagree. 25 years of C ++ Microsoft, it does not give up, on the contrary, it is currency. And when you love, you don’t count your efforts.

Christophe | www.christophepichaud.com