I tried on a win95 machine and a win98 machine
to 2 diffentent NT Domains
I also change the INTEGER IN SHORT
Still the same problem
>>Thanks for your reply
>>
>>I have take over your code
>>and changed username , pasword and domain
>>
>>But still, the return value is 0
>>and the getlasterror = 127
>
>It appears to work under NT; are you doing this under NT or Win9x? I'll try to test it later today on a Win98 box logged into one domain, and have it log into another.
>
>Ed
>
>BTW, I made a mistake in my declare that shouldn't have any effect; the type of the declaration should be SHORT rather than INTEGER, since BOOLs (the actual type of LogonUser) return a 16 bit WORD, with true being any value other than 0.
>
>>
>>>>I am trying to logon programmaly to an other domain
>>>>I am using to winapi32 function
>>>>
>>>>why is this not working ?
>>>>
>>>>Kind regards
>>>>
>>>>
>>>>Jan Dorresteijn.
>>>>
>>>>DECLARE INTEGER LogonUser ;
>>>> IN WIN32API ;
>>>> string @aUser,string @cdomain, string @apassw, integer @aType1,integer @atype2,integer atype3
>>>>
>>>
>>>You're passing some of the DWORD parameters incorrectly; instead, try:
>>>
>>>DECLARE INTEGER LogonUser IN WIN32API;
>>> STRING lpszUserName, ;
>>> STRING lpszDomain, ;
>>> STRING lpszPassword, ;
>>> INTEGER dwLogonType, ;
>>> INTEGER dwLogonProvider, ;
>>> INTEGER @ phToken
>>>
>>>cUser = 'user1'
>>>cDomain = 'MyDomain'
>>>cPasswd = 'xyzzy'
>>>nLogonType = 2 && LOGON32_LOGON_INTERACTIVE (see WINBASE.H)
>>>nProvider = 0 && LOGON32_PROVIDER_DEFAULT (see WINBASE.H)
>>>nToken = 0
>>>nResult = LogonUser(cUser, cDomain, cPasswd, nLogonType, nProvider, @nToken)
>>>
>>>Don't forget to CloseHandle() the phToken - the memory used by the object
>>>remains active until the handle is closed explicitly by the owner, even
>>>if the variable holding the value goes out of scope.
>>>
>>>
>>>>handle = 0
>>>>h_user = "user1"
>>>>h_serv = "domain"
>>>>h_a1 = 1
>>>>h_a2 = 0
>>>>h_pass = "passw1"
>>>>a= LogonUser(@h_user,@h_serv,@h_pass,@h_a1,@h_a2,@Handle)
>>>>? a && returns 0
>>>>
>>>>DECLARE INTEGER GetLastError IN WIN32API
>>>>lnError = GetLastError()
>>>>wait window STR(lnError) && Returns 127
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only