CreateFile winapi failed on volume C

0

This is from some old code that worked well for several years, but in our new project it got error. I have replaced all function arguments to constants, and tried using both wide-char and ASCII version and all got same result:

// compile with UNICODE=1
HANDLE handle = CreateFile( L"\\\\.\\C", 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
// or
HANDLE handle = CreateFileW( L"\\\\.\\C", 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
// or
HANDLE handle = CreateFileA( "\\\\.\\C", 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );

The returned handle is 0xffffffff that is INVALID_HANDLE_VALUE, and GetLastError() return 2 which means no file found.

Running program with administrator privilege got same result.

winapi
asked on Stack Overflow Apr 13, 2020 by jiandingzhe

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0