M
Mark
Has anyone experience of using the DiskQuotaControl library on Windows 2003?
I am having severe problems using it within a VB program to interrogate the
quota status of new user accounts.
It appears that, if you make repeated use of the control, it can fail
(taking the calling application with it) when you try to unload it. When
this happens the application log will register an event 1000, category (100)
with the description 'Faulting application (your app and version), faulting
module dskquota.dll, version 5.2.3790.0, fault address 0x00004442.'
However, once the user's quota status has been successfully checked it seems
that the control will not hang when checking the same user account in the
future.
From what I can find the problem seems similar the KB article 297835, but
that relates to Windows 2000 and was fixed in SP3. I have not had a
opportunity to test this on a Windows 2000 server yet.
Below is a sample function that I have used to reproduce the problem on 5
different Windows 2003 servers. The function will usually hang if called 3
to 10 times against a new user account.
Has anyone seen this before or am I doing something wrong?
Mark
Private Function GetFreeQuota(ByVal LogonName As String) As Long
On Error GoTo DiskErr
Dim DQQ As DiskQuotaControl
Dim DQU As DIDiskQuotaUser
Dim SID As String
'Create a new instance of DiskQuotaControl
Set DQQ = New DiskQuotaControl
'Initialise the quota volume
DQQ.Initialize "C:\", False
'Find the user's SID from the logon name
SID = DQQ.TranslateLogonNameToSID(LogonName)
'Find the disk quota user from the SID
'This is where the problem starts, comment the next
'line out and it never fails.
Set DQU = DQQ.FindUser(SID)
If Not (DQU Is Nothing) Then
GetFreeQuota = (DQU.QuotaLimit - DQU.QuotaUsed)
End If
'Release the DIDiskQuotaUser
Set DQU = Nothing
'Release the DiskQuotaControl
'This is where the problem will reveal itself, if FindUser was
'called the DiskQuota control can die with no warning taking
'the IDE (or application if compiled) with it, the only clue
'is an application log event id 1000:
'Faulting application (VB IDE or App version), faulting module
'dskquota.dll, version 5.2.3790.0, fault address 0x00004442
Set DQQ = Nothing
'We wont get this far when it fails
Exit Function
DiskErr:
'Put this here to check if there was an error
'we could handle, there isnt.
With Err
Debug.Print "Error: " & .Number & " - " & .Description
End With
End Function
I am having severe problems using it within a VB program to interrogate the
quota status of new user accounts.
It appears that, if you make repeated use of the control, it can fail
(taking the calling application with it) when you try to unload it. When
this happens the application log will register an event 1000, category (100)
with the description 'Faulting application (your app and version), faulting
module dskquota.dll, version 5.2.3790.0, fault address 0x00004442.'
However, once the user's quota status has been successfully checked it seems
that the control will not hang when checking the same user account in the
future.
From what I can find the problem seems similar the KB article 297835, but
that relates to Windows 2000 and was fixed in SP3. I have not had a
opportunity to test this on a Windows 2000 server yet.
Below is a sample function that I have used to reproduce the problem on 5
different Windows 2003 servers. The function will usually hang if called 3
to 10 times against a new user account.
Has anyone seen this before or am I doing something wrong?
Mark
Private Function GetFreeQuota(ByVal LogonName As String) As Long
On Error GoTo DiskErr
Dim DQQ As DiskQuotaControl
Dim DQU As DIDiskQuotaUser
Dim SID As String
'Create a new instance of DiskQuotaControl
Set DQQ = New DiskQuotaControl
'Initialise the quota volume
DQQ.Initialize "C:\", False
'Find the user's SID from the logon name
SID = DQQ.TranslateLogonNameToSID(LogonName)
'Find the disk quota user from the SID
'This is where the problem starts, comment the next
'line out and it never fails.
Set DQU = DQQ.FindUser(SID)
If Not (DQU Is Nothing) Then
GetFreeQuota = (DQU.QuotaLimit - DQU.QuotaUsed)
End If
'Release the DIDiskQuotaUser
Set DQU = Nothing
'Release the DiskQuotaControl
'This is where the problem will reveal itself, if FindUser was
'called the DiskQuota control can die with no warning taking
'the IDE (or application if compiled) with it, the only clue
'is an application log event id 1000:
'Faulting application (VB IDE or App version), faulting module
'dskquota.dll, version 5.2.3790.0, fault address 0x00004442
Set DQQ = Nothing
'We wont get this far when it fails
Exit Function
DiskErr:
'Put this here to check if there was an error
'we could handle, there isnt.
With Err
Debug.Print "Error: " & .Number & " - " & .Description
End With
End Function