Get 5.5 SecurityDescriptor with ADSI?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I've been looking at the how to enumerate the security descriptor on
Exchange 5.5 objects. I started looking at ADSI and put together some C++
code based on a few samples I found. It retrieves and prints a couple of
attributes ok, but goes into orbit when I try and query the SD.

Here's a quick snippet of the code:

LPWSTR strAttribute[] = { L"Home-MDB", L"NT-Security-Descriptor" };

hr = ADsBuildVarArrayStr((LPWSTR*)strAttribute, dwNumber, &var);
if ( hr == S_OK )
{
hr = pADs->GetInfoEx(var, 0L);
VariantClear(&var);
hr = pADs->Get(_bstr_t("Home-MDB"), &var);
if( hr != S_OK)
{
//This prints ok
wprintf(L"Get Home-MDB failed: 0x%x\n", hr);
goto Cleanup;
}
wprintf(L" Home-MDB = %S\n", V_BSTR(&var)) ;
VariantClear(&var);
}


hr = pADs->Get(_bstr_t("NT-Security-Descriptor"), &var);
if ( FAILED(hr) ) {
wprintf(L"Get NT-Security-Descriptor failed: 0x%x\n", hr);
goto Cleanup;
}

pDispSD = V_DISPATCH( &var );
hr = pDispSD->QueryInterface(IID_IADsSecurityDescriptor,(void**)&pSD);

It all works ok until I execute the last line. It then hogs 100% CPU until I
halt it. If I examine pDispSD just before the call, the structure contains
some CXX0030 errors, which makes me wonder if this is supported against 5.5
(or I've done something really dumb :-))

Is it possible to use ADSI to retrieve and enumerate the security desciptor
on 5.5? If not, what's the best method to use?

Thanks in advance,

Dave
.



Relevant Pages

  • Re: Programming the User-Account_Property using C#
    ... Using the security descriptor get the DACL for the object. ... Create an ACE and add: ... I am trying not to use ADSI in my new program, ... I don't want to have to write a wrapper for my existing unmanaged code ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: folder permissions and NTFS
    ... Use COM Interop with activeds.dll and adssecurity.dll to use the ADSI ... security descriptor objects; ... Use the .NET WMI wrappers to use the WMI provider to do ...
    (microsoft.public.dotnet.security)
  • Devenum.dll bug
    ... devenum.dll (shipped with DirectX 9.0b SDK). ... are thrown if any other application (e.g. graphedt or SDK sample ... SysEnum) tries to enumerate DS filters, ... For our service this security descriptor looks ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Enumerating domains/workstations with WMI
    ... > How can WMI be used to enumerate the domains in a network and given a domain ... You may be better off with ADSI for this. ...
    (microsoft.public.win32.programmer.wmi)
  • Problem using Win32_PerfRawData_ASPNET_ASPNETApplications...
    ... I am testing the query "Select * from ... the system and I can enumerate them using ADSI. ... Can anybody let me know whats the problem with this. ...
    (microsoft.public.win32.programmer.wmi)