NetUserSetInfo AP call very slow ?

G

Guest

I'm changing passwords every so often with my VB.net app using the NetUserSetInfo API call.
I found that it is very slow, on a 3 GHz P4 it uses 18 seconds to change 100 passwords. Anyone
else have the same experience ? I know for a fact that the code works. My VB.net code is as
follows:
Public Sub ChangePasswords()
msgbox(now)
Dim i As Integer
For i = 0 To 100
Try
Dim retVal As Long
Dim servername As String = "WINXPPRO"
Dim username As String = "testuser1"
Dim password As String = "testpassword" & i
retVal = NetUserSetInfo(servername, username, 1003, password, 0)
If retVal <> 0 Then
If retVal = 2221 Then
Err.Raise(retVal, Nothing, "Unknown user '" & username & "'")
Else
Err.Raise(retVal, Nothing, "NetUserSetInfo() failed with code " & retVal)
End If
End If
Catch
EventLog.WriteEntry(Err.Source, Err.Description)
End Try

Next i
msgbox(now)
End Sub

' API function declared
Declare Unicode Function NetUserSetInfo Lib "netapi32.dll" ( _
ByVal servername As String, ByVal username As String, _
ByVal level As Integer, ByRef buf As String, _
ByRef parm_err As Integer) As Integer
 
N

Nick Malik [Microsoft]

I'm changing passwords every so often with my VB.net app using the
NetUserSetInfo API call.
I found that it is very slow, on a 3 GHz P4 it uses 18 seconds to change
100 passwords.

I have no idea if this is by design, but if it isn't, it should be.

I want the system to be using the most difficult and complex encryption
algorithm that it possibly can when encrypting my password. For a single
person to wait two-tenths of a second for their personal password to be
stored... that's a small price to pay for security.


--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
I

Inge Henriksen

I dont think its the encryption, if you do the same encryptions in a program
you can probably do thousands in just one second, something else is
happening here.My app is a dynamic password changer, that changes passwords
every so often automatically, can change passwords like very minute if it
takes 18 sec for it to alter 100 passwords. I can get write access the NT
password file either, since its always locked by the system. Anyone have any
ideas ?

-Inge
 
W

Willy Denoyette [MVP]

A password reset is quite involving, what makes you thing 200 msec. per
password is slow? This is something you don't do 100 times in succession I
suppose.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top