I'm not very familiar with how fopen
in the standard C library works under the hood but it seems to preserve '\r\n' line endings in "b" mode and convert them to '\n' in the "r" mode. I would like to achieve the same effect using WinAPI or ATL, would that be possible?
No, the API level functions simply give you the data as stored. Just like the C run-time functions can provide Unicode data in a variety of UTF encodings and the API functions can not.