By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

NetUserSetInfo AP call very slow ?

P: n/a
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


Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> 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.
--
Nov 22 '05 #2

P: n/a
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

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:-8********************@comcast.com...
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.
--


Nov 22 '05 #3

P: n/a
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.

<in************@booleansoft.com> wrote in message
news:Jb*****************@fe26.usenetserver.com...
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

Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.