I have a client process that uses shared memory created by a service. The problem is that the service is created as "Local User" so the clients are unable to access the shared memory. Even with adding a "Global\" prefix, I can't access the memory. I'm creating the shared memory as
What it boils down to is I have to fill in the LPSECURITY_ATTRIBUTES for the "Everyone" user. I've been playing with all sorts of combinations for the last 3 hours and getting nowhere. This is the basic framework I'm using
Any simple examples on what to put into sd to represent the "Everyone" user would be great.
Code:
mHandle = CreateFileMapping (
(HANDLE) 0xFFFFFFFF, // Use system buffering
(LPSECURITY_ATTRIBUTES) 0,
PAGE_READWRITE, // Protection
0, // filesize high dword
mFileSize, // filesize low dword
name); // Name
Code:
SECURITY_DESCRIPTOR* sd = new SECURITY_DESCRIPTOR();
InitializeSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
// Have tried all sorts of permutations on the contents of sd
SECURITY_ATTRIBUTES* sa = new SECURITY_ATTRIBUTES;
sa->nLength = sizeof (*sa);
sa->bInheritHandle = FALSE;
sa->lpSecurityDescriptor = sd;
std::string name = "Global\\";
name += (in_name == 0? SMBaseName: in_name);
mHandle = CreateFileMapping (
(HANDLE) 0xFFFFFFFF, // Use system buffering
sa,
PAGE_READWRITE, // Protection
0, // filesize high dword
mFileSize, // filesize low dword
name.c_str()); // Name