Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Free SECURITY_ATTRIBUTES and SECURITY_DESCRIPTOR

Posted on 2003-11-07
3
Medium Priority
?
732 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

719 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