Re: Identificación de Windows

06/07/2006 - 15:39 por fnunez | Informe spam
Yo utilizo esto para comprobar el logeo en win

using System.Runtime.InteropServices
using System.Security.Principal
using System.Windows.Forms
using System
namespace Entradawindow

public class loge

[DllImport("Advapi32.Dll")

static extern bool LogonUser
string sUserName
string sDomain
string sUserPassword
uint dwLogonType
uint dwLogonProvider
out System.IntPtr token)

[DllImport("Kernel32.Dll")
static extern void CloseHandle(System.IntPtr token)
public int loging(string nombre, string passw

System.IntPtr pToken
if (LogonUser(nombre, string.Empty, passw, 2, 0, out pToken)
return 1
els
return 0;




Y me va bastante bien :

Saludos

fnunez

Ver este tema: http://www.softwaremix.net/viewtopic-529193.htm

Enviado desde http://www.softwaremix.net

Preguntas similare

Leer las respuestas

#1 Marc Solé
07/07/2006 - 12:00 | Informe spam
Gracias fnunez por tu respuesta, lo probaré a ver si me funciona.

Marc


"fnunez" wrote in message
news:

Yo utilizo esto para comprobar el logeo en win:

using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Windows.Forms;
using System;
namespace Entradawindows
{
public class logeo
{
[DllImport("Advapi32.Dll")]

static extern bool LogonUser(
string sUserName,
string sDomain,
string sUserPassword,
uint dwLogonType,
uint dwLogonProvider,
out System.IntPtr token);

[DllImport("Kernel32.Dll")]
static extern void CloseHandle(System.IntPtr token);
public int loging(string nombre, string passw)
{
System.IntPtr pToken;
if (LogonUser(nombre, string.Empty, passw, 2, 0, out pToken))
return 1;
else
return 0;
}
}
}

Y me va bastante bien :p

Saludos.


fnunez


Ver este tema: http://www.softwaremix.net/viewtopic-529193.html

Enviado desde http://www.softwaremix.net


Respuesta Responder a este mensaje
#2 Marc Solé
07/07/2006 - 12:19 | Informe spam
Por cierto, no tendrás un ejemplo de su utilización?

Marc


"fnunez" wrote in message
news:

Yo utilizo esto para comprobar el logeo en win:

using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Windows.Forms;
using System;
namespace Entradawindows
{
public class logeo
{
[DllImport("Advapi32.Dll")]

static extern bool LogonUser(
string sUserName,
string sDomain,
string sUserPassword,
uint dwLogonType,
uint dwLogonProvider,
out System.IntPtr token);

[DllImport("Kernel32.Dll")]
static extern void CloseHandle(System.IntPtr token);
public int loging(string nombre, string passw)
{
System.IntPtr pToken;
if (LogonUser(nombre, string.Empty, passw, 2, 0, out pToken))
return 1;
else
return 0;
}
}
}

Y me va bastante bien :p

Saludos.


fnunez


Ver este tema: http://www.softwaremix.net/viewtopic-529193.html

Enviado desde http://www.softwaremix.net


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida