Category: Source

Source code availability

ATLENSURE_SUCCEEDED double failure

A colleague pointed out that code snippet in previous post is misusing ATL’s ATLENSURE_SUCCEEDED macro making it [possibly] evaluate its argument twice in case of failure, that is evaluating into failure HRESULT code. As it is defined like this: #define ATLENSURE_SUCCEEDED(hr) ATLENSURE_THROW(SUCCEEDED(hr), hr) It does things in a straightforward way, for a code line ATLENSURE_SUCCEEDED(pFilterGraph.CoCreateInstance(CLSID_FilterGraph));…

Read the full article

Utility Clearance: Automatic Snapshots

Automatic Snapshots runs as a background application monitors clipboard. Should a new image be copied there, the utility automatically writes the image into a file. The process does not require any user interaction and is completely automatic so that – per Mike Westen‘s request – user could quickly and easily create snapshots of a multitude…

Read the full article

If your application is looking for network adapters, it may be blind to see

A really long and annoying troubleshooting of a problem finally ended with a bug found in GetAdaptersInfo/GetAdaptersAddresses API. It may unexpectedly fail under the following conditions: 32-bit application 64-bit operating system or /3GB feature enabled on 32-bit operating system hosting process is linked with /LARGEADDRESSAWARE flag or has otherwise set it in binary header over…

Read the full article

Booo SRW Locks

Windows Vista introduced new synchronization API: slim reader/writer (SRW) locks. Being already armed with critical sections, one perhaps would not desperately need an SRW lock, but still it offers a great option to provide both exclusive (critical section alike) mode and shared mode when 2+ threads can enter protected section simultaneously. Some time earlier, I…

Read the full article

Obtaining number of thread context switches programmatically

Previous post on thread synchronization and context switches used number of thread context switches as one of the performance indicators. One might have hard times getting the number from operating system though. The only well documented access to amount of context switches seems to be accessing corresponding performance counters. Thread performance counter will list available…

Read the full article