How secure are GUIDs? Can I use it to generate passwords?
GUIDs are globally unique identifiers, and given their rather incomprehensible presentation, some people may be tempted to use them (or parts of them) as passwords. For example, one person wondered...
View ArticleIs a SID with zero subauthorities a valid SID? It depends whom you ask
Here's an interesting table. FunctionIs SubAuthorityCount=0 valid?IsValidSidYesConvertSidToStringSidYesConvertStringSidToSidNo That last entry creates the unfortunate situation where a SID...
View ArticleWhy does the BackupWrite function take a pointer to a modifiable buffer when...
The BackupWrite function takes a non-const pointer to the buffer to be written to the file being restored. Will it actually modify the buffer? Assuming it doesn't, why wasn't it declared const? It...
View ArticleTrying out all the different ways of recognizing different types of...
Today's Little Program takes a 64-bit integer and tries to interpret it in all the various timestamp formats. This comes in handy when you have extracted a timestamp from a crash dump and want to see...
View ArticleIntentionally making the suggestion look nothing like any scripting language,...
In an internal peer-to-peer discussion list for an internal tool I'll call Program Q, somebody asked, How can I query the number of free frobs in every table in my table repository? I suggested that...
View ArticleWhat would be the point of creating a product that can't do its job?
Yuhong Bao for some reason lamented that there is no 32-bit version of Windows Server 2008 R2. Well, duh. Why would anybody want a 32-bit version of a server product? You would run into address space...
View ArticleWhy is my x64 process getting heap address above 4GB on Windows 8?
A customer noticed that when they ran their program on Windows 8, memory allocations were being returned above the 4GB boundary. They included a simple test program: #include <stdio.h> #include...
View ArticleOn the various ways of creating large files in NTFS
For whatever reason, you may want to create a large file. The most basic way of doing this is to use SetFilePointer to move the pointer to a large position into the file (that doesn't exist yet),...
View ArticleGenerating different types of timestamps from quite a long way away
Today's Little Program does the reverse of what we had last time. It takes a point in time and then generates timestamps in various formats. using System; class Program { static void TryFormat(string...
View ArticleHazy memories of the Windows 95 ship party
One of the moments from the Windows 95 ship party (20 years ago today) was when one of the team members drove his motorcycle through the halls, leaving burns in the carpet. The funny part of that...
View ArticleWhy doesn't the Print command appear when I select 20 files and right-click?
This is explained in the MSDN documentation: When the number of items selected does not match the verb selection model or is greater than the default limits outlined in the following table, the verb...
View ArticleWhy do I get ERROR_INVALID_HANDLE from GetModuleFileNameEx when I know the...
Consider the following program: #define UNICODE #define _UNICODE #include <windows.h> #include <psapi.h> #include <stdio.h> // horrors! mixing C and C++! int __cdecl wmain(int,...
View ArticleWhat did the Ignore button do in Windows 3.1 when an application encountered...
In Windows 3.0, when an application encountered a general protection fault, you got an error message that looked like this: Application error CONTOSO caused a General Protection Fault in module...
View ArticleHow can I detect whether a keyboard is attached to the computer?
Today's Little Program tells you whether a keyboard is attached to the computer. The short answer is "Enumerate the raw input devices and see if any of them is a keyboard." Remember: Little Programs...
View ArticlePlease enjoy the new eco-friendly printers, now arguably less eco-friendly
Some years ago, the IT department replaced the printers multifunction devices with new reportedly eco-friendly models. One feature of the new devices is that when you send a job to the printer, it...
View ArticleWhen you think you found a problem with a function, make sure you're actually...
A customer reported that the DuplicateHandle function was failing with ERROR_INVALID_HANDLE even though the handle being passed to it seemed legitimate: // Create the handle here m_Event =...
View ArticleCorrupted file causes application to crash; is that a security vulnerability?
A security vulnerability report came in that went something like this: We have found a vulnerability in the XYZ application when it opens the attached corrupted file. The error message says,...
View ArticleThe curse of the redefinition of the symbol HLOG
A customer was running into a compiler error complaining about redefinition of the symbol HLOG. #include <pdh.h> #include <lm.h> ... The result is lmerrlog.h(80): error C2373: 'HLOG'...
View ArticleThe Itanium processor, part 1: Warming up
The Itanium may not have been much of a commercial success, but it is interesting as a processor architecture because it is different from anything else commonly seen today. It's like learning a...
View ArticleThe Itanium processor, part 2: Instruction encoding, templates, and stops
Instructions on Itanium are grouped into chunks of three, known as bundles, and each of the three positions in a bundle is known as a slot. A bundle is 128 bits long (16 bytes) and always resides on a...
View Article