Click here to Skip to main content
15,921,250 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: UI-thread with both message pump and an infinite loop Pin
Stephen Hewitt27-Apr-07 0:20
Stephen Hewitt27-Apr-07 0:20 
QuestionFile with permission Pin
vivekphlp26-Apr-07 18:26
vivekphlp26-Apr-07 18:26 
AnswerRe: File with permission Pin
Paresh Chitte26-Apr-07 18:40
Paresh Chitte26-Apr-07 18:40 
GeneralRe: File with permission Pin
vivekphlp26-Apr-07 18:46
vivekphlp26-Apr-07 18:46 
GeneralRe: File with permission Pin
Paresh Chitte26-Apr-07 20:13
Paresh Chitte26-Apr-07 20:13 
GeneralRe: File with permission Pin
Paresh Chitte26-Apr-07 20:22
Paresh Chitte26-Apr-07 20:22 
AnswerRe: File with permission Pin
uday kiran janaswamy26-Apr-07 19:32
uday kiran janaswamy26-Apr-07 19:32 
AnswerRe: File with permission Pin
skornel27-Apr-07 4:41
skornel27-Apr-07 4:41 
I was having the same issue. When the ini file was created by someone in the administrators group, the file was only accessible by others in the administrators group. 'Normal' users were denied permission.

So I changed the fourth parameter in the CreateFile() function call to be:


m_hFile = CreateFile(..., ..., ..., GetSAForEveryone(), ..., 0, 0);




SECURITY_ATTRIBUTES* GetSAForEveryone()
{
static SECURITY_ATTRIBUTES SA;
static SECURITY_DESCRIPTOR SD;
static bool FirstTime(true);

if (FirstTime)
{
SD.Revision = SECURITY_DESCRIPTOR_REVISION;
SD.Sbz1 = 0; // reserved
SD.Control = SE_DACL_PRESENT;
SD.Owner = 0;
SD.Group = 0;
SD.Sacl = 0;
SD.Dacl = 0; // This grants access to everyone

SA.nLength = sizeof(SECURITY_ATTRIBUTES);
SA.bInheritHandle = false;
SA.lpSecurityDescriptor = &SD;
FirstTime = false;
}

return &SA;
}


This works great. The file is created so that everyone on the machine can read/write/delete/copy/move it.

However, the next hurdle you will face is that if a user in the administrators group copies/moves the file to another folder, the file is again not accessible by all users. To get around this issue I found a page (http://support.microsoft.com/kb/310316) that addresses the issue. The bottom line is that I set the registry entry mentioned in that article for each user that creates the file. This may not be an acceptable solution in your case but it works for me.


GeneralRe: File with permission Pin
vivekphlp27-Apr-07 17:40
vivekphlp27-Apr-07 17:40 
QuestionEmai Processing System Pin
xinxin062926-Apr-07 16:51
xinxin062926-Apr-07 16:51 
QuestionFile name to video buffer Pin
hmaturana26-Apr-07 16:34
hmaturana26-Apr-07 16:34 
QuestionRe: File name to video buffer Pin
Mark Salsbery29-Apr-07 10:06
Mark Salsbery29-Apr-07 10:06 
AnswerRe: File name to video buffer Pin
hmaturana30-Apr-07 13:28
hmaturana30-Apr-07 13:28 
GeneralRe: File name to video buffer [modified] Pin
Mark Salsbery1-May-07 5:21
Mark Salsbery1-May-07 5:21 
GeneralRe: File name to video buffer Pin
hmaturana1-May-07 7:06
hmaturana1-May-07 7:06 
Questionclass construction Pin
hch326-Apr-07 16:27
hch326-Apr-07 16:27 
AnswerRe: class construction Pin
Stephen Hewitt26-Apr-07 17:25
Stephen Hewitt26-Apr-07 17:25 
GeneralRe: class construction Pin
hch327-Apr-07 4:44
hch327-Apr-07 4:44 
GeneralRe: class construction Pin
Stephen Hewitt27-Apr-07 14:45
Stephen Hewitt27-Apr-07 14:45 
Questionabout "MSDN Library for Visual Studio 2005" Pin
HOW WHAT26-Apr-07 16:14
HOW WHAT26-Apr-07 16:14 
AnswerRe: about "MSDN Library for Visual Studio 2005" Pin
Paresh Chitte26-Apr-07 20:10
Paresh Chitte26-Apr-07 20:10 
Questioncreate static text area to SDI framewnd Pin
gurucplusplus26-Apr-07 15:59
gurucplusplus26-Apr-07 15:59 
AnswerRe: create static text area to SDI framewnd Pin
Arman S.26-Apr-07 19:26
Arman S.26-Apr-07 19:26 
GeneralRe: create static text area to SDI framewnd Pin
gurucplusplus27-Apr-07 6:28
gurucplusplus27-Apr-07 6:28 
QuestionPlaying Windows Explorer Sounds Pin
Ryan Sikma26-Apr-07 14:02
Ryan Sikma26-Apr-07 14:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.