Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Oh, you’re with them?

One of my friends is a woman of color, and not that long ago, she arrived with three male colleagues in the lobby of a building for a scheduled meeting. The administrative assistant came out, walked...

View Article


Nasty gotcha: The inadvertently named resource

In the resources of a Win32 module, resource files, you can identify a resource by number (ordinal) or by name (string). One horrific gotcha of the resource file format is that it doesn't require you...

View Article


Dubious security vulnerability: Attacking the application directory in order...

A security vulnerability report arrived that went something like this: There is a vulnerability in the XYZ.EXE program. If you place a hacked copy of the file CABINET.DLL in the same directory as...

View Article

How can I force memory to be allocated above the 4GB boundary (for debugging...

A customer discovered that their program has 64-bit-to-32-bit pointer truncation bugs. They are working hard to track down all the places where this happens. On Windows 8 and higher, they can build...

View Article

The Windows 8.1 ship-it awards were yellow

Microsoft has a tradition of giving an award to each member of a team when their product ships. The mechanics of this is that when you ship your first product, you get an award-like thing with blank...

View Article


Was it intentional that the Media Control Interface has the same acronym as a...

The Media Control Interface is a programmable interface to multimedia peripherals. It's probably best known for providing an easy way to prank somebody by repeatedly opening and closing the CD tray....

View Article

Three short questions about LogonUser (with answers!)

A customer had a Web service that runs processes as specific users. There may be multiple such processes running at the same time for a single user account. Here are the questions. And just to be...

View Article

Using DuplicateHandle to help manage the ownership of kernel handles

A customer was using a third party I/O library that also gave you access to the underlying HANDLE, in case you needed it. The customer needed that underlying HANDLE so it could pass it to...

View Article


Is there anything better than GetThreadTimes for obtaining per-thread CPU...

A customer was using the Get­Thread­Times function for high-resolution profiling of performance-sensitive code, but found that its accuracy is rather poor. They were hoping there would be something...

View Article


Why is Identical COMDAT Folding called Identical COMDAT Folding?

We saw a while ago that the linker will recognize that two functions consist of the same code sequence and will use the same bytes to represent both functions, a process known as identical COMDAT...

View Article

Microspeak: lift up

Today's Microspeak is the verb phrase "lift up". Here's a citation: [After a long detailed discussion.] I want to lift up a little and talk about why this is important. I didn't know what this...

View Article

Why does the documentation for ReadFile say that the lpNumberOfBytesRead...

The documentation for the Read­File function says BOOL WINAPI ReadFile( _In_ HANDLE hFile, _Out_ LPVOID lpBuffer, _In_ DWORD nNumberOfBytesToRead, _Out_opt_ LPDWORD lpNumberOfBytesRead, _Inout_opt_...

View Article

How to electrify your own fence: ProcessStrictHandleCheckPolicy

During process termination, if you try to enter a critical section that is owned by another thread that has already been terminated, the gates are now electrified, and the kernel simply terminates...

View Article


Why does SetThreadPriority sometimes take a really long time?

A customer had a video application that gathers information as it runs. Every so often, they need to take all this information, process it, and save it to a database. They perform this processing...

View Article

This processor has no stack (insert spooky laughter)

In the early days of computing, most processors did not have what we today would consider a "stack". Everything was done with static data. Subroutine linkage on these systems was typically done by...

View Article


Windows file system compression had to be dumbed down

I noted some time ago that when you ask Windows to use file system compression, you get worse compression than WinZip or some other dedicated file compression program, for various reasons, one of...

View Article

What happens if you call RevertToSelf when not impersonation?

A customer wanted to know what happens if you call Revert­To­Self from a thread that is not impersonating. "Does the call succeed or fail? This particular scenario is not explicitly discussed in the...

View Article


Solving the problem instead of answering the question: How do I get this...

A customer had a dialog box with two large text controls. Something like this: IDD_DIALOG_WELCOME DIALOGEX 0, 0, 305, 280 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell...

View Article

Why is my crash dump file filled with 0xAAAAAAAA?

A customer was studying a minidump collected by Windows Error Reporting. The minidump includes the contents of the stack, but the contents are randomly filled with 0xAAAAAAAA. 00f3ac5c 00f3d1c0...

View Article

How do I programmatically add a folder to my Documents library?

Today's Little Program adds a folder to the Documents library. Remember that Little Programs do little to no error checking. Today's smart pointer library is… (rolls dice)… nothing! We're going with...

View Article
Browsing all 3085 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>