OpenFileMapping call Fails on VISTA
-
I start process which does CreateFilemapping as follows. ===================================================================================== hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, // Current file handle. &sa, // Default security. PAGE_READWRITE, // Read/write permission. 0, // Max. object size. 1, // Size of hFile. NONWTS_SERVICE_FILE_MAPOBJ); // Name of mapping object. lpMapAddress = MapViewOfFile(hMapFile, // Handle to mapping object. FILE_MAP_ALL_ACCESS, // Read/write permission 0, // Max. object size. 0, // Size of hFile. 0); // Map entire file. ..... FlushViewOfFile(lpMapAddress, 0); ===================================================================================== This process is running under session id = 1 and running under administrator user without Administrative previlages. From my other application(process) i call OpenFileMapping. This process is running under system context with session id = 0. ===================================================================================== hMapFile = OpenFileMapping( FILE_MAP_ALL_ACCESS, // Read permission. FALSE, // Inherit handle NONWTS_SERVICE_FILE_MAPOBJ); // Name of mapping object. //Non WTS Environment ===================================================================================== Here the OpenFileMapping call fails. This same thing works fine if i have done the CreateFilemapping from an application running under administrator user with Administrative previlages. Can any one please help me in overcoming this problem. Thanks in advance, Praveen
-
I start process which does CreateFilemapping as follows. ===================================================================================== hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, // Current file handle. &sa, // Default security. PAGE_READWRITE, // Read/write permission. 0, // Max. object size. 1, // Size of hFile. NONWTS_SERVICE_FILE_MAPOBJ); // Name of mapping object. lpMapAddress = MapViewOfFile(hMapFile, // Handle to mapping object. FILE_MAP_ALL_ACCESS, // Read/write permission 0, // Max. object size. 0, // Size of hFile. 0); // Map entire file. ..... FlushViewOfFile(lpMapAddress, 0); ===================================================================================== This process is running under session id = 1 and running under administrator user without Administrative previlages. From my other application(process) i call OpenFileMapping. This process is running under system context with session id = 0. ===================================================================================== hMapFile = OpenFileMapping( FILE_MAP_ALL_ACCESS, // Read permission. FALSE, // Inherit handle NONWTS_SERVICE_FILE_MAPOBJ); // Name of mapping object. //Non WTS Environment ===================================================================================== Here the OpenFileMapping call fails. This same thing works fine if i have done the CreateFilemapping from an application running under administrator user with Administrative previlages. Can any one please help me in overcoming this problem. Thanks in advance, Praveen
Kernel object aren't visible between sessions unless you prefix the name with "Global\"
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.