Solved

Free SECURITY_ATTRIBUTES and SECURITY_DESCRIPTOR

Posted on 2003-11-07
3
725 Views
Last Modified: 2013-12-03
Hi Experts,

If i use security attributes and security descriptors with e.g. CreateProcess, CreateNamedPipe or CreateFile - who is responsible for freeing the SECURITY_ATTRIBUTES and the SECURITY_DESCRIPTOR after use ??

Kind Regards
Peter
0
Comment
Question by:PeterLarsen
  • 2
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 9704470
What do you mean by "freeing" them - they are usually allocated on the stack and will be cleaned up when the calling function terminates. In other words: This is to be performed (and is done automatically) by the application that calls the APIs you mentioned.
0
 
LVL 2

Author Comment

by:PeterLarsen
ID: 9707132
Hi jkr and thanks for your comment,

I dont get it.
If program "A" starts program "B" by calling CreateProcess, program "A" must create an instance of PSecurityAttributes and PSecurityDescriptor, and the information are used by windows to set the security in the called process, right ?
But if program "A" terminates before program "B", the information are no longer available in memory - what then, are the information copied to the called process on creation or .. ??

PSecurityAttributes and PSecurityDescriptor are pointers to record structures and are created by e.g. New(pointer). Normally it's up to the programmer to keep track of allocated memory, and to make sure that they are freed - by call to Dispose or similar - before the program terminates. But in this case (CreateProcess) the helpfile dont say anything about it.

Kind Regards
Peter
0
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 9707754
>>But if program "A" terminates before program "B", the information are no longer
>>available in memory

Yes, but the security information is applied to the newly created process, it is no longer necessary to keep them. In fact, they are obsolete as soon as e.g. 'CreateProcess()' returns.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.Net Loading Word 11 105
Mixed results 10 90
Changing the installation path of this MSI 5 107
Need an intro to -- .Net SQL Authorization Manager 7 90
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question