Category: Seriously

Day by day work stuff

LogProcessExceptions: Automatically Create Minidump Files on C++ Exception in Monitored Process

LogProcessExceptions utility implements a very basic debugger which attaches (see DebugActiveProcess on MSDN) to a running process and monitors its exceptions. Once exception takes place the utility creates a minidump file for the process (see MiniDumpWriteDump on MSDN) so that exception condition could be investigated off-site using debugger. If you throw C++ exceptions in your…

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

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

How to get HMODULE of msvcr90.dll

Because Microsoft C++ Runtime library is distributed as a side-by-side assembly, GetModuleHandle and LoadLibrary is no longer available to locate the library within the process. Both API calls would return NULL handle. HMODULE hModule = GetModuleHandle(_T(“msvcr90.dll”)); HMODULE hModule = LoadLibrary(_T(“msvcr90.dll”)); Still, how to locate the modules in order to, for example, be able to check…

Read the full article

Attributed ATL: Accessing BLOB with ISequentialStream

Before attributed ATL was deprecated, it was a convenient way to access databases using attributed classes on top of OLEDB Consumer Templates. Does not it look nice? [ db_command(“SELECT ServerData FROM Server WHERE Server = ?”) ] class CGetServerData { public: [ db_param(1) ] LONG m_nServer; [ db_column(1, length = “m_nDataLength”) ] ISequentialStream* m_pDataStream; DBLENGTH…

Read the full article

Another third party DirectShow filter that may break your very own application

One of the DirectShow’s most important features is Intelligent Connect, which allows Filter Graph Manager to build graphs out of independent filters trying to connect them together including options to fall back to originally non-preferred alternatives and so on. It is however important that filters are properly registered with the Filter Mapper. For the developers…

Read the full article