Unable to map shared memory file in scheduled task or service using server 2008 R2 RRS feed

  • Question

  • We have an application that uses global shared memory for inter-process communication.  When running from an interactive session, the memory maps as expected. When we try to start the process using task scheduler or as a service, the call to CreateFileMapping fails with an "Invalid Handle" error code.

    However...  We are using Multi-Byte Character Set(MBCS).  If I convert the global section name to wide characters and pass it into the MBCS function, it seems to work but the name appears wrong in the map. Viewing the sections in Process Explorer shows "G" for each of them which I assume is from "Global\...".  Likewise, if I use the MBCS string and specifically call the wide character function, CreateFileMappingW(), it also works but shows a different name in Process Explorer (e.g. "??????????????S"). 

    Anybody have any ideas or is this a bug in windows?

    Friday, October 14, 2011 3:51 PM