[Windows] Refactor CommonFileDialog code and fixup a logging error.