Showing results for History - The Old New Thing

Feb 16, 2004
0
2

The arms race between programs and users

Raymond Chen
Raymond Chen

There is a constant struggle between people who write programs and the people who actually use them. For example, you often see questions like, "How do I make my program so the user can't kill it?" Now, imagine if there were a way to do this. Ask yourself, "What would the world be like if this were possible?" Well, then there would be some progra...

History
Feb 13, 2004
0
3

Bad version number checks

Raymond Chen
Raymond Chen

Version numbers. Very important. And so many people check them wrong. This is why Windows 95's GetVersion function returned 3.95 instead of 4.0. A lot of code checked the version number like this: Now consider what happens when the version number is reported as 4.0. The major version check passes, but the minor version check fails since 0 is l...

History
Feb 11, 2004
0
5

Sure, we do that

Raymond Chen
Raymond Chen

The DirectX video driver interface for Windows 95 had a method that each driver exposed called something like "DoesDriverSupport(REFGUID guidCapability)" where we handed it a capability GUID and it said whether or not that feature was supported. There were various capability GUIDs defined, things like GUID_CanStretchAlpha to ask the driver wh...

History
Feb 6, 2004
0
0

Adjustor thunks

Raymond Chen
Raymond Chen

Yesterday we learned about the layout of COM objects and I hinted at "adjustor thunks". If you find yourself debugging in disassembly, you'll sometimes find strange little functions called "adjustor thunks". Let's take another look at the object we laid out last time: In the diagram, p is the pointer returned when the IPersist interface is n...

History
Feb 5, 2004
0
2

The layout of a COM object

Raymond Chen
Raymond Chen

The Win32 COM calling convention specifies the layout of the virtual method table (vtable) of an object. If a language/compiler wants to support COM, it must lay out its object in the specified manner so other components can use it. It is no coincidence that the Win32 COM object layout matches closely the C++ object layout. Even though COM was o...

History
Jan 23, 2004
0
0

The white flash

Raymond Chen
Raymond Chen

If you had a program that didn't process messages for a while, but it needed to be painted for whatever reason (say, somebody uncovered it), Windows would eventually lose patience with you and paint your window white. Or at least, that's what people would claim. Actually, Windows is painting your window with your class background brush. Since most...

History
Jan 14, 2004
0
2

The history of calling conventions, part 5: amd64

Raymond Chen
Raymond Chen

The last architecture I'm going to cover in this series is the AMD64 architecture (also known as x86-64). The AMD64 takes the traditional x86 and expands the registers to 64 bits, naming them rax, rbx, etc. It also adds eight more general purpose registers, named simply R8 through R15. Here's a sample: On entry to CallThatFunction, the stack lo...

History