Patch to fix windows build

fix windows error during finding file format and number of pages + mingw dll build