The Old New Thing

How can I see what files and shares are being accessed remotely, and the general usage pattern for the NetXxx functions

Today's Little Program is a command line version of the Shared Folders MMC snap-in. Why? Because it illustrates the usage pattern for the Net­Xxx family of functions. (It's also a clone of the networking portion of the openfiles tool.) The Net­Xxx family of functions generally work like this: You pass in some parameters that ...
Comments are closed.0 0
Code

Microsoft-internal Chuck Norris facts

A colleague of mine forwarded me some status mail from his team's internal bug push. (This is a push to fix bugs, not a push to introduce new bugs.) Apparently, one of the ways the developers lifted the tension was to discover some new Chuck Norris Facts, two of which were shared in the status mail: Chuck facts today: Happy birthday...

Why do Explorer and the command prompt interpret file times differently?

A customer observed that if they use Explorer to view the timestamp on a file, it is not always in agreement with the value shown if they run a plain DIR in a command prompt. They are sometimes off by an hour. Why is that? Whenever you hear the phrase "off by an hour" you should immediately think "Daylight Saving Time". The formatting of ...

What are the conventions for managing standard handles?

Consider this function: void ChangeConsoleColor(WORD wColor) { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); if (h != INVALID_HANDLE_VALUE) { SetConsoleTextAttribute(h, wColor); CloseHandle(h); } } "When I call this function, it works the first time, but when I call it a second time, Get­Std­Handle returns a handle ...
Comments are closed.0 0
Code

What are the dire consequences of not selecting objects out of my DC?

The convention when working with device contexts is to restore them to the way you found them. If a drawing function selects a bitmap into a device context, then it should select the original bitmap into the device context before returning. Same for fonts, pens, all that stuff. But what if you decide to violate that convention? For example, ...
Comments are closed.0 0
Code

Inadvertently creating dress-like-Steve day

Even if you haven't been paying much attention, you may have noticed that Steve Sinofsky has developed a bit of a uniform for himself. You can pretty much count on him wearing a T-shirt with a V-neck sweater. (There appears to be some sort of alphabetic theme there, but I'm not going to check if he's also wearing a G-string.) Some time ago, ...

Marking a shortcut to say that it should not be placed on the Windows 8 Start page upon installation or treated as a newly-installed application

Today's Little Program creates a shortcut on the Start menu but marks it as "Do not put me on the front page upon installation." This is something you should do to any secondary shortcuts your installer creates. And while you're at it, you may as well set the "Don't highlight me as a newly-installed program" attribute used by Windows 7...
Comments are closed.0 0
Code

The source of much confusion: “backed by the system paging file”

Perhaps one of the most misunderstood sentences in the Win32 documentation is this little bit in the documentation for Create­File­Mapping: If hFile is INVALID_HANDLE_VALUE, the calling process must also specify a size for the file mapping object in the dwMaximum­Size­High and dwMaximum­Size­Low parameters. In this ...
Comments are closed.0 1
Code

Feedback usabilla icon