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

Image may be NSFW.
Clik here to view.

Why did disabling interrupts cause Windows 95 to hang?

One of the ways people used to demonstrate the awfulness of Windows 95 was that you could hang the system with this simple two-instruction MS-DOS program: cli jmp $ The cli instruction disabled...

View Article


Image may be NSFW.
Clik here to view.

Enumerating all the programs that can launch a particular protocol

Today's Little Program is a variation on the one from last time. This time, instead of enumerating all the handlers for a file extension, we enumerate all the handlers for a protocol. We then open a...

View Article


Image may be NSFW.
Clik here to view.

How do I register a command on the desktop background context menu? (And how...

To register a command to appear on the context menu for the desktop background, you put it under the predefined shell object Desktop­Background. (For some reason, this predefined object is not on the...

View Article

Image may be NSFW.
Clik here to view.

Why doesn't findstr use the standard regular expression library?

Tim wonders why there isn't a standard library that was settled on and used by everyone by now. (While you're at it, why isn't there a standard for electrical outlets that was settled on and used by...

View Article

Image may be NSFW.
Clik here to view.

Why does OpenProcess return access denied, even if I enable debug privilege?

Many customers ask something like this: We want to get the creation time of a process, but our call to Open­Process fails with ERROR_ACCESS_DENIED. struct KernelHandleDeleter { public...

View Article


Enumerating all the programs that can launch a particular protocol

Today’s Little Program is a variation on the one from last time. This time, instead of enumerating all the handlers for a file extension, we enumerate all the handlers for a protocol. We then open a...

View Article

How do I register a command on the desktop background context menu? (And how...

To register a command to appear on the context menu for the desktop background, you put it under the predefined shell object Desktop­Background. (For some reason, this predefined object is not on the...

View Article

Why doesn’t findstr use the standard regular expression library?

Tim wonders why there isn’t a standard library that was settled on and used by everyone by now. (While you’re at it, why isn’t there a standard for electrical outlets that was settled on and used by...

View Article


Why does OpenProcess return access denied, even if I enable debug privilege?

Many customers ask something like this: We want to get the creation time of a process, but our call to Open­Process fails with ERROR_ACCESS_DENIED. struct KernelHandleDeleter { void operator()(HANDLE...

View Article


Hasn’t the problem of updates being partially installed until the next reboot...

Last week, I discussed how A question about how to detect whether Windows Update needs the system to be restarted turns out to be the wrong question. One of the issues I noted was the risk of the...

View Article

Calculating integer factorials in constant time, taking advantage of overflow...

For some reason, people on StackOverflow calculate factorials a lot. (Nevermind that it’s not necessarily the best way to evaluate a formula.) And you will see factorial functions like this: int...

View Article

Great moments in forgetfulness: Does anybody have a copy of this file?

A colleague of mine (let’s call him Bob) sent out a question to the rest of the team: Does anybody have a copy of xyz.exe? I replied, Hi, Bob. I found a copy on \\scratch\temp\bob\xyz.exe (A few years...

View Article

You’d think that with the name TEMP, people wouldn’t expect it to be around...

A customer had a problem with the Disk Cleanup wizard. The customer liaison explained: The customer would like to know what locations the Disk Cleanup wizard removes files from. The custom is running...

View Article


Dubious security vulnerability: Messing with the Recycle Bin

Today’s dubious security vulnerability goes like this: The $RECYCLE.BIN directory can be used to drop files into an arbitrary directory. To do this, navigate into a user’s Recycle Bin directory and...

View Article

Are views of memory-mapped files coherent within a single process? (And how...

A customer wanted some clarification. An MSDN article says This means that changes made to a page in the memory-mapped file via one process’s view are automatically reflected in a common view of the...

View Article


Allocating page file space without allocating RAM

The Windows Server 2003 Resource Kit comes with a tool called consume.exe, and one of the things you can ask it to do is to suck up space in your swap file. If you run the program in that mode, you...

View Article

Unhandled Exception: Cannot print exception string because...

I ran an internal tool, and it communicated with a back-end service, and then displayed the error Unhandled Exception: Cannot print exception string because Exception.ToString() failed. I can’t figure...

View Article


Confusing gotcha: PSECURITY_DESCRIPTOR is not a pointer to a SECURITY_DESCRIPTOR

There is a structure called a SECURITY_DESCRIPTOR. It describes the layout of an absolute security descriptor. There is also a structure called a SECURITY_DESCRIPTOR_RELATIVE. It describes the layout...

View Article

Why does my in-place tooltip dismiss itself as soon as it appears?

One subtlety in the use of in-place tooltips is that you should create the tooltip with the WS_EX_TRANSPARENT extended style. This style makes the window invisible to hit-testing, which is a good...

View Article

When is the correct time to call FreeLibraryWhenCallbackReturns?

When is the correct time to call Free­Library­When­Callback­Returns, or any of the other ...When­Callback­Returns functions? In practice, many people call the function immediately before returning...

View Article
Browsing all 1765 articles
Browse latest View live