locked
CreateFile2 fails always on both desktop and Metro app with error code 0x2 (FILE_NOT_FOUND)

    Question

  • Hi,

    How to use CreateFile2 API ? We tried below statement:

    CreateFile2(FileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL);

    But always fails with error code 0x2 (FILE_NOT_FOUND).

    Development environment: OS Windows 8.1 x64

    Could anyone share us simple working CreateFile2 API sample.

    Please help.

    Thanks,

    Yash


    Saturday, September 20, 2014 2:55 PM

All replies

  • Your code looks fine.

    What is FileName? Does that file exist? Is it located somewhere the app has file access (i.e. the app data or install directories)?

    Saturday, September 20, 2014 5:08 PM
    Moderator