advapi32.dll / LogonUser

C

C

Hi,


When I make a call to this API it works fine on my PC but not on another
development PC.

We both have the same OS and we both have local admin rights.

I get no error. The LogonUser call returns false each time.

Anyone have a similar problem?

Thanks.
 
H

Henning Krause [MVP]

Hello,

if LogonUser returns 0, call GetLastError to retrieve the error...

in .NET, you should have a DLLImport attribute like this on your LogonUser
definition:
[DllImport("advapi32.dll", SetLastError = true)]

You can then call Marshal.GetLastWin32Error() to get the error.

What is the value returned from this function?

Best regards,
Henning Krause
 
C

C

It retrurns 0 (false)

Henning Krause said:
Hello,

if LogonUser returns 0, call GetLastError to retrieve the error...

in .NET, you should have a DLLImport attribute like this on your LogonUser
definition:
[DllImport("advapi32.dll", SetLastError = true)]

You can then call Marshal.GetLastWin32Error() to get the error.

What is the value returned from this function?

Best regards,
Henning Krause
------------------------
Try my new WebDAV component for Exchange. It's free!
http://www.infinitec.de/software/nettoolbox/infinitec.exchange.aspx

C said:
Hi,


When I make a call to this API it works fine on my PC but not on another
development PC.

We both have the same OS and we both have local admin rights.

I get no error. The LogonUser call returns false each time.

Anyone have a similar problem?

Thanks.
 
H

Henning Krause [MVP]

Hello,

Are both functions returning zero?

Best regards,
Henning Krause
------------------------
Try my new WebDAV component for Exchange. It's free!
http://www.infinitec.de/software/nettoolbox/infinitec.exchange.aspx

C said:
It retrurns 0 (false)

Henning Krause said:
Hello,

if LogonUser returns 0, call GetLastError to retrieve the error...

in .NET, you should have a DLLImport attribute like this on your
LogonUser
definition:
[DllImport("advapi32.dll", SetLastError = true)]

You can then call Marshal.GetLastWin32Error() to get the error.

What is the value returned from this function?

Best regards,
Henning Krause
------------------------
Try my new WebDAV component for Exchange. It's free!
http://www.infinitec.de/software/nettoolbox/infinitec.exchange.aspx

C said:
Hi,


When I make a call to this API it works fine on my PC but not on
another
development PC.

We both have the same OS and we both have local admin rights.

I get no error. The LogonUser call returns false each time.

Anyone have a similar problem?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top