DirectShow filter built with Visual Studio 2019 Preview to run on Windows Server 2012

I pushed a few commits to my fork of DirectShow Win7 Samples (BaseClasses library specifically).

One of small problems I happened to deal with is that a filter built with current/recent toolset produces code incompatible with legacy operating systems, which are still widely present in the wild. This could be solved by using outdated versions of Visual Studio, outdated Windows SDK etc. This is however not really necessary because even Visual Studio 2019 Preview builds DirectShow code perfectly (including using v142 toolset), and you are generally not limited in using 30 year old codebase alone. I had a filter using Windows Implementation Libraries (WIL) helpers, C++17 code and C++/WinRT for COM object implementation, however a few rough places of BaseClasses resulted in filter binary incompatible with Windows Server 2012 runtime.

A bit of massaging of BaseClasses fixed the problem. I also enabled SDL checks (and this made me fix something COutputQueue implementation – not really a bug, but it could be more accurate, and got rid of strsafe.h in favor of safe CRT string functions.

While doing that, I noticed that ancient lstrcmpW API function is documented incorrectly on MSDN.

Leave a Reply