<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>8 Apr 2015 06:23:00 Z</lastBuildDate><pubDate>7 Apr 2015 03:58:00 Z</pubDate><description>Hi,&#13;
&#13;
How can we do impersonate easily in WD 20? My application need to use NTLM authentication to acces to a database in another machine inside the same network.&#13;
&#13;
As far as my research, I need to use .NET system.security.principal assembly to use NetworkIdentity class. The thing is, i cant get it work yet.Here my code :&#13;
&#13;
RetourFonction est un booléen // Type C :BOOL&#13;
LpszUsername est une chaîne // Type C :LPSTR, c'est l'adresse d'une chaîne, il est aussi possible de spécifier directement une chaîne&#13;
LpszDomain est une chaîne // Type C :LPSTR, c'est l'adresse d'une chaîne, il est aussi possible de spécifier directement une chaîne&#13;
LpszPassword est une chaîne// Type C :LPSTR, c'est l'adresse d'une chaîne, il est aussi possible de spécifier directement une chaîne&#13;
dwLogonType est un entier = 2 // Type C :DWORD mode logon interactif&#13;
dwLogonProvider est un entier = 0 // Type C :DWORD mode LOGON32_PROVIDER_DEFAULT par defaut NTLM&#13;
clPhToken est un IntPtr = Null// Type C :PHANDLE&#13;
nPhtoken est un entier&#13;
szLpbuffer est une chaîne ASCIIZ de 32&#13;
nSize est un entier=31&#13;
pclImpersonationContext est un WindowsImpersonationContext dynamique&#13;
pclWid est un WindowsIdentity dynamique&#13;
pclWidAdmin est un WindowsImpersonationContext dynamique&#13;
&#13;
RetourFonction= API("ADVAPI32","LogonUserA",&amp; LpszUsername,&amp; LpszDomain,&amp; LpszPassword,dwLogonType,dwLogonProvider, &amp; clPhToken)&#13;
&#13;
pclWid = WindowsIdentity.GetCurrent()&#13;
Info (pclWid.get_Name() + "/n "+pclWid.get_Token()+" "+pclWid.Token+" "+pclWid.get_AuthenticationType())&#13;
// Begin impersonating the user&#13;
nPhtoken = &amp; clPhToken&#13;
Info (nPhtoken)&#13;
&#13;
gpclMyIdentity est un WindowsIdentity dynamique = allouer un WindowsIdentity (clPhToken)&#13;
//myIdentity.Impersonate (clPhToken)&#13;
//WindowsIdentity.Impersonate(clPhToken)&#13;
&#13;
Any idea? Cheers</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate/read.awp</link><title>[WD 20] Impersonate</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-solved-51417/read.awp</comments><pubDate>8 Apr 2015 06:23:00 Z</pubDate><description>Actually it is the case. The error occurs because i'm trying to re-authenticate the currently logged in account. I'm an idiot. I…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-solved-51417/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-solved-51417/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate/read.awp">[WD 20] Impersonate</source><title>Re: [WD 20] Impersonate [SOLVED]</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-51415/read.awp</comments><pubDate>8 Apr 2015 02:59:00 Z</pubDate><description>Perhaps you have a session context already established with the server with a different set of credentials than that being passe…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-51415/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate-51415/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/51381-20-impersonate/read.awp">[WD 20] Impersonate</source><title>Re: [WD 20] Impersonate</title></item></channel></rss>
