The Old New Thing

The somewhat misguided question of whether MapViewOfFile or WriteProcessMemory is faster

A customer asked, "Which is faster for copying data from one process to another; or ?" This is one of those "Huh?"-type questions, where the customer has solved half of a problem and is looking for help with the other half, the half that makes no sense. First of all, the question is malformed because does not copy any data at all. It ...
Comments are closed.0 0
Code

Why doesn’t HeapValidate detect corruption in the managed heap?

A customer had a program that was corrupting the managed heap by p/invoking incorrectly. The problem didn't show up until the next garbage collection pass, at which point the CLR got all freaked-out-like. "According to Knowledge Base article 286470, the tool is supposed to catch heap corruption, but it doesn't catch squat." Depending on ...
Comments are closed.0 0
Code

Poisoning your own DNS for fun and profit

When you type a phrase into the Windows Vista Start menu's search box and click Search the Internet, then the Start menu hands the query off to your default Internet search provider. Or at least that's what the Illuminati would have you believe. A customer reported that when they typed a phrase into the Search box and clicked Search the ...

Finding a printer, and then creating a shortcut to that printer

Today's "Little Program" does two things: It looks for a printer in the Printers folder, and then once it finds it, it creates a shortcut to that printer. As is common with "Little Programs", I don't bother with error checking. I'll leave you to do that. Second part first, since it is handy on its own: Creating a shortcut to an arbitrary ...
Comments are closed.0 0
Code

When you have a SAFEARRAY, you need to know what it is a SAFEARRAY *of*

A customer had a problem with SAFEARRAY, or more specifically, with CComSafeArray. CComSafeArray<VARIANT> sa; GetAwesomeArray(&sa); LONG lb = sa.GetLowerBound(); LONG ub = sa.GetUpperBound(); for (LONG i = lb; i <= ub; i++) { CComVariant item = sa.GetAt(i); ... use the item ... } The GetAt method returns a VARIANT&, ...
Comments are closed.0 0
Code

STRICT_TYPED_ITEMIDS is the shell namespace version of the STRICT macro used by USER and GDI

Starting with the Windows Vista PlatformSDK, defining the symbol before including shell header files changes declarations that previously had simply used now use one of various types which are more clear about what type of ID list is being used. Think of it as the macro for the shell. The more precise names emphasize the form of the ...
Comments are closed.0 0
Code

Why was WHEEL_DELTA chosen to be 120 instead of a much more convenient value like 100 or even 10?

We saw some time ago that the nominal mouse wheel amount for one click (known as a "detent") is specified by the constant , which has the value 120. Why 120? Why not a much more convenient number like 100, or even 10? Because the value 120 made it easier to create higher-resolution mouse wheels. As noted in the documentation: The ...

Heads-up: Phone scammers pretending to be JPMorgan Chase MasterCard security

Recently, a round of phone scammers have been dialing through our area with a caller-ID of (000) 000-0000, which should already raise suspicions. When you answer, a synthesized voice says that they are calling from JPMorgan Chase MasterCard security. They claim that your credit card has been disabled due to suspicious activity, and in order ...