|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
NetUserChangePassword Module not found??when i call the NETUserChangePassword from the netapi32.ll I receive "Module not found" error? Here my code: Private Declare Unicode Function NetUserChangePassword Lib "netapi32.dll" (ByVal domainname As String, _ ByVal Username As String, _ ByVal OldPassword As String, _ ByVal NewPassword As String) As Long Sub main retVal = netUserChangePassword("MyDomain", "MyUser", "OldPassword", "NewPassword") End sub Public Shared Function GetErrorMessage(ByVal errorCode As Integer) As String Dim FORMAT_MESSAGE_ALLOCATE_BUFFER As Integer = &H100 Dim FORMAT_MESSAGE_IGNORE_INSERTS As Integer = &H200 Dim FORMAT_MESSAGE_FROM_SYSTEM As Integer = &H1000 Dim messageSize As Integer = 255 Dim lpMsgBuf As String Dim dwFlags As Integer = FORMAT_MESSAGE_ALLOCATE_BUFFER Or FORMAT_MESSAGE_FROM_SYSTEM Or FORMAT_MESSAGE_IGNORE_INSERTS Dim ptrlpSource As IntPtr = IntPtr.Zero Dim prtArguments As IntPtr = IntPtr.Zero Dim retVal As Integer = FormatMessage(dwFlags, ptrlpSource, errorCode, 0, lpMsgBuf, _ messageSize, prtArguments) If 0 = retVal Then Throw New Exception("Failed to format message for error code " + errorCode.ToString() + ". ") End If Return lpMsgBuf End Function 'GetErrorMessage
Show quote
Hide quote
"AndyL" <An***@discussions.microsoft.com> schrieb The type of the function return value should by Integer, not Long. I don't > Hi, > > when i call the NETUserChangePassword from the netapi32.ll I receive > "Module not found" error? > > Here my code: > > Private Declare Unicode Function NetUserChangePassword Lib > "netapi32.dll" (ByVal domainname As String, _ > > ByVal Username As String, _ > > ByVal OldPassword As String, _ > > ByVal NewPassword As String) As Long know if it solves the problem. Armin Why not use WMI to change password instead? A lot simpler
Crouchie1998 BA (HONS) MCP MCSE Hi,
i wan't to try ADSI. But it doesn't work. I'm connecting the active directory with: set oUser = GetObject("WinNT://<domain>/<user>,user",<user>,<oldpassword>) In the security log i see the logon of the user. Then i will change the password with the change password mehtod. call oUSer.changePassword(<oldpassword>,<newpassword>) This method fails. In the eventlog i see the change password method is called in the user context of the current user and not in the context of the connected user. So the next idea was creating a impersonation (it's working now) and then call the changepassword Method of the netapi32.dll Show quoteHide quote "Crouchie" wrote: > Why not use WMI to change password instead? A lot simpler > > Crouchie1998 > BA (HONS) MCP MCSE > > >
CHANGING DATA TYPE
Changed Date on PC, now project doesn't compile source code changes Get information about Dial Up connections? Compressing (zipping) files dispose the login form vb.net tabpage copying dynamic Save lines drawn in the picturebox as an lmage Job LastRunOutCome?? Parsing a string - please help Maximized MDI childforms.... Anyone? |
|||||||||||||||||||||||