ActiveDs.DLL Woes

Fr33m3

New member
Joined
Feb 6, 2008
Messages
2
Programming Experience
1-3
Hey,

Sorry that my first post is a problem post but I've been working on this for awhile and I'm desperate to find someone that knows how to fix it :p.

I'm currently doing a project to get file permissions from folders using a
web interface. I'm using ASP.NET running VB.NET backend scripting on IIS 6.0
application server. I've been working on a web interface program for awhile
now and have set up pass through (impersonation) authentication. I have
completed several scripts that are fully integrated with my network, for
example I have one script that will change a users settings in active
directory via the web interface. Everything I have done has been successful
until this point.

I'm running a script that is calling ADsSecurityUtility to get the
permissions from my file server. I'm not using WINS because it's querying a
linux server. The script works fine as a normal VBScript and WAS working fine
as an .aspx script. It gets the permission via a text web text box and
displays them on a larger web text box based on whether they are read or
write. I'm using ActiveDS.DLL version 1.0.0.0 and calling it as such: <%@
Import namespace="activeds" %>.

So the symptoms are that I will run the script from the web server, it will
run fine and will get the permissions on any file I wish to query. I will
walk away for a couple of minutes, log back into the computer running the web
server, try the web page and it will give me the following error:

Retrieving the COM class factory for component with CLSID
{F270C64A-FFB8-4AE4-85FE-3A75E5347966} failed due to the following error:
800401f9.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Retrieving
the COM class factory for component with CLSID
{F270C64A-FFB8-4AE4-85FE-3A75E5347966} failed due to the following error:
800401f9.

Source Error:


Line 23: strabsolutefolderpath =
request.querystring.item("strabsolutefolderpath")
Line 24:
Line 25: AD = New activeds.ADsSecurityUtility
Line 26: adssecuritydescriptor =
AD.GetSecurityDescriptor(strabsolutefolderpath, ADS_PATH_FILE,
ADS_SD_FORMAT_IID)
Line 27: odacl = adssecuritydescriptor.DiscretionaryACL
The error seems time dependent as I can log off, log back in, log off, log
back in as a new user, change whatever I want but then I'll leave it for
awhile and it will die on me only with time. I can also get it to
consistantly crash by restarting the server itself.

I've checked to ensure that this CLSID is related properly to ActiveDS.DLL
and it is related properly. I've also run RegSVR32 ACTIVEDS.DLL to ensure
that the DLL is registered properly and it comes back and says that the DLL
has been properly registered.

I've eliminated some of the causes as follows:

I initially thought that the DLL was corrupt but I have a known good
ActiveDS.DLL sitting on a seperate computers and I ran an MD5 hash against
both of them and they are the same.

I thought that, possibly, the DLL may be loaded into RAM and that the web
was running of RAM and when RAM was flushed for w/e reason the DLL was
removed, started using the DLL on hard disk which was, for whatever reason,
at that point corrupt. This cannot be the case as I hashed the DLL before it
stopped working and after and they're the same. Also, I replaced the DLL with
one I knew wouldn't work and I ran the programt, didn't work, then I replaced
the DLL with the one that should be working and it worked properly.

I thought maybe windows had the wrong DLL in the DLL cache and was replacing
the DLL in my web folder with the one in the DLL cache so I replaced the DLL
in DLL cache with the known good one and it still had the same problem.

Some observations that I've made along my way that MAY be leading to the
cause of this problem:

I've noticed that the DLL is not consistant through out the windows OS
meaning that its in many different places but different in said places. IE:
There's an ActiveDS.DLL in C:\windows\system32\ that's version 5.x.x.x but
the one I'm supposed to be running is 1.0.0.0 . I'm thinking possibly a DLL
conflict? The activeDS.dll in windows /system32 is also 195kb compared to the
activeds.dll that I'm using, which is 104kb. I've tried replacing the
activeds.dll in my bin file with the one from windows/system32 which then
gives me the following error:
c:\windows\system32\inetsrv>
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc.exe" /t:library
/utf8output
/R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\assembly\dl3\8a06e680\048e7e0c_ec31c801\ADODB.DLL"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\assembly\dl3\1595bac4\9eba40ed_de52c801\stdole.DLL"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\assembly\dl3\929706d3\6e4ee00c_ec31c801\Scripting.DLL"
/R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll"
/R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll"
/out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\App_Web_permission_lookupv2(knowngood).aspx.cdcab7d2.wlwmiuz5.dll"
/D:DEBUG=1 /debug+ /define:_MYTYPE=\"Web\"
/imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\App_Web_permission_lookupv2(knowngood).aspx.cdcab7d2.wlwmiuz5.0.vb"
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\App_Web_permission_lookupv2(knowngood).aspx.cdcab7d2.wlwmiuz5.1.vb"


Microsoft (R) Visual Basic Compiler version 8.0.50727.42
for Microsoft (R) .NET Framework version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\364fb6af\d379e111\App_Web_permission_lookupv2(knowngood).aspx.cdcab7d2.wlwmiuz5.0.vb(15)
: warning BC40056: Namespace or type specified in the Imports 'activeds'
doesn't contain any public member or cannot be found. Make sure the namespace
or the type is defined and contains at least one public member. Make sure the
imported element name doesn't use any aliases.

Imports activeds
~~~~~~~~
C:\Web\Permission_LookupV2(knowngood).aspx(5) : error BC30002: Type
'activeds.ADsSecurityUtility' is not defined.

Dim AD As activeds.ADsSecurityUtility
~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Web\Permission_LookupV2(knowngood).aspx(25) : error BC30002: Type
'activeds.ADsSecurityUtility' is not defined.

AD = New activeds.ADsSecurityUtility

I noticed that the DLL in the registry, registered to CLSID with a GUID of
F270C64A-FFB8-4AE4-85FE-3A75E5347966 is neither version, it's version 0. I've
also ensured that the activeds.dll is the one I want running by deleting the
temp file in asp.net, at which point it calls the ActiveDS.dll that was found
in system32.

I'm really stuck on this problem. Below is my code. I would really
appreciate any help given as I've been working on this for weeks and have, as
of yet, been unable to find a solution. If anyone needs any clarification on
my problems, please let me know. If anyone wants my direct contact email,
feel free to ask.

thanks for the help in advance,

Patrick

CODE:

VB.NET:
<%@ Import namespace="activeds" %>
<script language="VB" runat="Server">
Dim strcomputer As Object
Dim strabsolutefolderpath As String
Dim AD As activeds.ADsSecurityUtility
Dim adssecuritydescriptor As Object
Dim odacl As Object
Dim oace As Object
dim pdtest as object
Const ADS_PATH_FILE As Short = 1
Const ADS_SD_FORMAT_IID As Short = 1
</script>

<%
'on error resume next

response.Write("<form method='get' 
action='activeds_LookupV2(KnownGood).aspx'>")
response.Write("<input type='text' name='strabsolutefolderpath' size='18' 
maxlength='100'>")
response.Write("<input type='SUBMIT' value='Lookup'>")
response.Write("</form>")


strabsolutefolderpath = request.querystring.item("strabsolutefolderpath")

AD = New activeds.ADsSecurityUtility
adssecuritydescriptor = AD.GetSecurityDescriptor(strabsolutefolderpath, 
ADS_PATH_FILE, ADS_SD_FORMAT_IID)
odacl = adssecuritydescriptor.DiscretionaryACL

If strabsolutefolderpath <> "" then
	response.write("FolderPath Entered is: " & "<strong>" & 
strabsolutefolderpath & "</strong><br>")
	response.Write(("<textarea size='20' rows=8 style='width: 730px' readonly>"))
	For	Each oace In odacl
		XEtest = left(oace.trustee,2)
		if XETest = "XE" then
			response.write(vbcr)
			response.Write("User is: " & oace.Trustee)
			response.write(vbCR)
			response.Write("activedss: ")
			response.write(vbcr)
		
			If oace.Trustee = "XE\XE_FILE SECURITY_LIST" Then
				response.write(vbtab)
				response.Write("PD\PD_GG_FILE SECURITY_LIST")
		
			ElseIf oace.AccessMask = 1245631 Then 
				response.write(vbtab)
				response.Write(("Group Has Modify Rights"))
		
			ElseIf oace.AccessMask = 1179817 Then 
				response.write(vbtab)
				response.Write(("Group Has Read Rights"))
		
			ElseIf oace.AccessMask = 2032127 Then 
				response.write(vbtab)
				response.Write(("Group has Full Control"))

			ElseIf oace.AccessMask = 1507839 Then 
				response.write(vbtab)
				response.Write(("Group has Help Desk Full Control"))

			Else 
				response.write(vbtab)
				response.Write(("Group Unknown, OACE: " & oace.accessmask))
		
			End If
		response.write(vbcr)
		response.write("<=========================================>")
		end if

	Next oace
	response.Write(("</textarea><br>"))
end if

AD.close
adssecuritydescriptor.close
odacl.close
%>
 
Last edited by a moderator:
Back
Top