GLib 2.0 used for package mingw-w64-i686-glib2 seems not to have been properly compiled.
According glib sources for same version (2.40), if G_OS_WIN32 g_fopen should use _wfopen, using given file mode (e.g. "r", "w", ...).
Using binary dist of glib2 installed by pacman, file mode is not honored: even passing "rb" (binary read), translation is applied which is wrong and prevent from recognizing signature or binary file (e.g. as required by gdk-pixbuf to detect image format).
Using attached test code with gnome-fs-directory.png, with glib2 package provided by msys2, line carriage is translated (5th byte translated to 10 instead of original 13).
Building same glib version from sources with following configure command, same test code is back to expected behaviour (read untranslated):
CPPFLAGS="-march=i686 -D_WIN32_WINNT=0x0601" LIBFFI_CFLAG=
pkgconfig --cflags libffi LIBFFI_LIBS="-lffi -L/mingw32/lib/" ./configure --prefix=/mingw32 --with-python=