Update: I found the problem - embarrassingly/ironically enough it was was calling SetThreadAffinity() in the wrong thread, not the main one (program startup is messy...)
It's all working now, thanks for all the help! I've given everybody an upvote for taking part in my little debug session.