Error using CreateFileMapping - C

后端 未结 6 1967
梦谈多话
梦谈多话 2021-01-24 20:38

I am using the tutorial on this MSDN link to implement a way of transferring data from one process to another. Although I was advised in an earlier question to use the Pipe meth

6条回答
  •  时光说笑
    2021-01-24 21:12

    Ensure the Global name is unique; this can be done with a tool named Process Explorer.

    If not unique, this would typically fail with Error code 6 (The handle is invalid) upon calling CreateFileMappinng

    1. Download Process Explorer from SysInternals
    2. Run Process Explorer
    3. Run your application up to a break point just prior to the CreateFileMapping() failure
    4. Search for MyFileMappingObject using Find (Ctrl-F)
    5. If anything comes up such as another FileMap, Mutex, etc.. consider a more unique name, and ensure your application is not the one creating it.

    Note: Consider naming your FileMapping using a GUID (File -> Tools > Create GUID) within Visual Studio

提交回复
热议问题