Why not just write in C?
Shells are combination development environments, programming languages with primitives and standard libraries, and UIs, and as such need to be exactly as security-minded as any other standard library, IDE, or file explorer.
Namely RAII, type safe strings, vectors, collections, less implicit conversions, reference parameters.
For me, Turbo Vision, Object Windows Library and Visual Components Library were good examples of C++ frameworks making good use of such features.
MFC always was seemed too thin in high level features.
The problem with C++, is that its copy-paste compatibility with C, crucial to win the adoption from C compiler developers, nowadays has become its Achilles heel regarding safety.