As far as I can see, the only MFC code you have in there is the CFile object. Replace it with
CreateFile()[
^] or
fopen_s()[
^], and it will not depend on MFC anymore.
Edit: And the use of CString. But if you create an ATL service, CString will be usable as is.
PS. You might want to have a look at CString::Format().