none
CreateFile() Error 5 RRS feed

  • Question

  • HI all.

    I build a ATL project.  Use Web js call interface.  Not under protection mode, open the success.  but , open failed in the IE protected mode. 

    code:

    HANDLE hCard = NULL;
    LPSECURITY_ATTRIBUTES lpTmpFileMappingAttributes = NULL;

    SECURITY_ATTRIBUTES saSecurity;
    saSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
    saSecurity.lpSecurityDescriptor = NULL;
    saSecurity.bInheritHandle = 1;

    lpTmpFileMappingAttributes = &saSecurity;

    PSECURITY_DESCRIPTOR pSD = NULL;

    hCard = CreateFile(TEXT("\\\\.\\H:"), 
    GENERIC_WRITE | GENERIC_READ, 
    FILE_SHARE_WRITE | FILE_SHARE_READ, 
    lpTmpFileMappingAttributes , 
    OPEN_EXISTING ,
    FILE_ATTRIBUTE_NORMAL,
    NULL);

    DWORD re = GetLastError();

    I need open success in the IE protected mode. Thanks!

    help me !!!

    Wednesday, December 23, 2015 2:51 PM

Answers

  • First are you really trying to open the volume i.e. H: not the root directory H:\ ?  If so you are out of luck no matter what the environment is, this is protected against at least for the permissions you are asking for.   If you are trying to open the root directory fix your code, and if it still fails then give us the error code that is returned.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, December 23, 2015 3:23 PM

All replies

  • First are you really trying to open the volume i.e. H: not the root directory H:\ ?  If so you are out of luck no matter what the environment is, this is protected against at least for the permissions you are asking for.   If you are trying to open the root directory fix your code, and if it still fails then give us the error code that is returned.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, December 23, 2015 3:23 PM
  • I'm curious to know what you think this should do.  What are you actually trying to accomplish here?

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Wednesday, December 23, 2015 9:18 PM
  • Thanks. My Device is mass storage device. It itself is a U disk. Virtual into a CDROM.
    Thursday, December 24, 2015 1:25 AM