I think the lock should already be held during the call to IWICWineDecoder_Initialize. I don't want to think about what will happen if some other thread grabs the lock between that and checking the file type.