The Old New Thing

Why does GetFileVersionInfo map the whole image into memory instead of just parsing out the pieces it needs?

Commenter acq responds (with expletive deleted), "the whole file is mapped into the process' memory only for version info that's certainly only a few kilobytes to be read?" Why not map only the parts that are needed? "I don't understand the necessity to map the whole file except that it was easier to write that code without thinking too much...
Comments are closed.0 0
Code

Get your hex wrench ready, because here comes the Ikea bicycle

Ikea säljer elcyklar. Click through for two-image slide show. Ikea selling electric bicycles Forget furniture. Ikea is now launching, that's right, an electric bicycle. It goes under the name People-Friendly and costs around 6000 SEK ($900 USD). But only in Älmhult, Småland. People-Friendly has already received ...

It rather involved being on the other side of this airtight hatchway: Denial of service by high CPU usage

We received the following security vulnerability report: Windows is vulnerable to a denial of service attack that consumes 100% CPU. Use the following procedure to create a file that is enchanted by magic pixie dust: [...] Rename the file to TEST.EXE. Execute as many copies of the program as you have CPU cores. Observe that CPU...

Cargo-cult registry settings and the people who swear by them

Two customers (so far) wanted to know how to increase the duration of taskbar balloon notifications on Windows Vista. (By the way, I gave the answer some time ago.) They claimed that on Windows XP, they were using the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\Current­Version\Explorer\Tray­Notify, setting the ...

Only senior executives can send email to the All Employees distribution list, but mistakes still happen

Some time ago, a senior executive sent email to the All Employees distribution list at Microsoft announcing that a particular product was now available for dogfood. The message included a brief introduction to the product and instructions on how to install it. A few hours later, a second message appeared in reply to the announcement. The ...

Find the index of the smallest element in a JavaScript array

Today's Little Program isn't even a program. It's just a function. The problem statement is as follows: Given a nonempty JavaScript array of numbers, find the index of the smallest value. (If the smallest value appears more than once, then any such index is acceptable.) One solution is simply to do the operation manually, simulating how ...
Comments are closed.0 0
Code

Why is the debugger telling me I crashed because my DLL was unloaded, when I see it loaded right here happily executing code?

A customer was puzzled by what appeared to be contradictory information coming from the debugger. We have Windows Error Reporting failures that tell us that we are executing code in our DLL which has been unloaded. Here's a sample stack: But if we ask the debugger what modules are loaded, our DLL is right there, loaded as happy as can ...
Comments are closed.0 0
Code

Eventually, we may find out where notes eight through twelve came from

CBC Radio's Tom Allen investigates the origin of the opening four notes of the classic Star Trek theme. He traces it to the opening of Mahler's First Symphony, then further back to Brahms's Second Symphony and Beethoven's Fourth Symphony. In college, one of my classmates (the same one that is now the conductor of an orchestra) identified ...

Why does my radio button group selection get reset each time my window regains activation?

A customer reported (all incomplete information and red herrings preserved): We have an issue related to two radio buttons in a window. The code programmatically checks the second button by sending the BM_SET­CHECK message. We observe that if the user clicks somewhere else on the screen (so that our application loses focus), and then ...
Comments are closed.0 0
Code

Feedback usabilla icon