Declare function help SetSecurityDescriptorControl  and Usage

cidex used Ask the Experts™
I am having trouble using the function SetSecurityDescriptorControl from advapi32.dll
I'm not certain how to declare it.  I receive Run-time error '49', bad dll calling convention, which I believe is related to the declaration.

Thanks in Advance,
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Make sure you declare it at the top of a module.
what do you currently have for the declaration?

I can give you the VB declaration for GetSecurityDescriptorControl which may help you figure out the Set.  I don't have the set unfortunately.

Public Declare Function GetSecurityDescriptorControl Lib "advapi32.dll" Alias "GetSecurityDescriptorControl" (pSecurityDescriptor As SECURITY_DESCRIPTOR, pControl As Integer, lpdwRevision As Long) As Long
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author of the Year 2009

Hi cidex,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Save as PAQ -- No Refund.

cidex, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
DanRollins -- EE database cleanup volunteer
Delete instead of PAQ?
Author of the Year 2009

I think you're right.  That API description is not all that valuable... I found it in MSDN with no trouble.  Changing recommendations:

      Delete this question.

DanRollins -- EE database cleanup volunteer


I apologize I haven't checked in a while.  I also have the declaration for GetSecurityDescriptorControl, but I can't make SetSecurityDescriptorControl work.  I'll see if I can find what i was using for the declaration, although I may have scrapped it.

Thanks for returning to this question.
Here would be a MS article on it:
The Bad DLL calling convention is most likely due to the

Here's another article that might be worth looking into that has some VBScript code that might be useful as well.;EN-US;q279682

If you can give me the code that fills in the UDT, the API declaration, and the code that calls the API, perhaps I can be of more assistance.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial