I have a system service running that created a global shared memory buffer using file mapping. The service runs fine, but when i try to have an application access the file mapping, the call to CreateFileMapping() returns 5, access denied. Here is the code
If I run the application without the system service installed, it doesnt have a problem, So I think it might have something to do with system services running at higher (lower numerically) privledge level.Code:hCommandBuffer = CreateFileMapping((HANDLE)INVALID_HANDLE_VALUE , NULL , PAGE_READWRITE | SEC_COMMIT , 0 , sizeof(COMMANDBUFFER) , "Elysia Makes Me Hot Buffer"); if(hCommandBuffer == NULL){ sprintf(szError , "%d\n" , GetLastError()); MessageBox(NULL , szError , "Failed to allocate handle to global shared memory" , MB_OK); } pCommandBuffer = (COMMANDBUFFER*)MapViewOfFile(hCommandBuffer , FILE_MAP_WRITE , 0 , 0 , sizeof(COMMANDBUFFER)); if(pCommandBuffer == NULL){ sprintf(szError , "%d\n" , GetLastError()); MessageBox(NULL , szError , "Failed to allocate global shared memory" , MB_OK); }



LinkBack URL
About LinkBacks



