Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница:

 

  Вопрос: Локальная учётная запись Добавлено: 10.01.09 23:56  

Автор вопроса:  Cooller
Можно ли проверить связку login\pass учётной записи на компе в локальной сети?
для проверки использую

Option Explicit
Private Declare Function LogonUser Lib "Advapi32" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As Any, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Function UserCheckPassword(ByVal UserName As String, ByVal Password As String, Optional ByVal Domain As String = vbNullString) As Boolean

On Error Resume Next
    Dim lRet As Long, hToken As Long

     

    Const LOGON32_LOGON_NETWORK = 3& 'Intended for high performance servers to authenticate clear text passwords

    Const LOGON32_LOGON_INTERACTIVE = 2& 'Intended for users who will be interactively using the machine, such as a user being logged on by a terminal server

    Const LOGON32_LOGON_BATCH = 4&

     

    Const LOGON32_PROVIDER_DEFAULT = 0& 'Use the standard logon provider for the system

    Const LOGON32_PROVIDER_WINNT40 = 2& 'Use the Windows NT 4.0 logon provider

    Const LOGON32_PROVIDER_WINNT35 = 1& 'Use the Windows NT 3.5 logon provider

    Const LOGON32_PROVIDER_WINNT50 = 3& 'Use the Windows 2000 logon provider.

     

    lRet = LogonUser(UserName, Domain, Password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, hToken)
    If lRet Then UserCheckPassword = True: CloseHandle hToken


End Function


Какого вида должен быть Domain?

Ответить

  Ответы Всего ответов: 0  

Нет ответов

Страница:

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам