diff --git a/src/libraw_datastream.cpp b/src/libraw_datastream.cpp
index 60593b42..4218aad3 100644
--- a/src/libraw_datastream.cpp
+++ b/src/libraw_datastream.cpp
@@ -752,12 +752,12 @@ LibRaw_bigfile_buffered_datastream::LibRaw_bigfile_buffered_datastream(const cha
 {
     if (filename.size() > 0)
     {
+#if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
         std::string fn(fname);
         std::wstring fpath(fn.begin(), fn.end());
-#if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
         if ((fhandle = CreateFile2(fpath.c_str(), GENERIC_READ, 0, OPEN_EXISTING, 0)) != INVALID_HANDLE_VALUE)
 #else
-        if ((fhandle = CreateFileW(fpath.c_str(), GENERIC_READ, FILE_SHARE_READ, 0,
+        if ((fhandle = CreateFileA(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, 0,
             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
 #endif
         {
