It's a PAnsiChar so it cannot be 0.
And I already tried Nil but without success, that is the reason for my post (:
Main Topics
Browse All TopicsI'm using the LogonUser to interact with the user dektop from within a service.
The call is:
if LogonUser(PChar(User), PChar(Domain), PChar(Password), LOGON32_LOGON_INTERACTIVE,
....
So for example
LogonUser(PChar('MyUser'),
This works when I have the user logon with a password but I can't make it work when there is no password
LogonUser(PChar('MyUser'),
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Well, it should.
However in some of my tinkering with similar functions, when I did a PChar(''), when no password was needed, it would not work. When I enter Nil, it would.
Here is an example, at least i Delphi 5, that if I have a null password or user and passed a null string to my WNEtAddConnection2, as a PChar, I would not connect. So I had to test for it being null and then specifically add Nil. Then it worked!
if (APassword <> '') or (AUser <> '') then
i:=WNetAddConnection2(n,PC
else
i:=WNetAddConnection2(n,ni
That is why I threw it out to you.
John
Run secpol.msc, then check the setting for
Local Policies | Security Options -> Accounts: Limit local account use of blank passwords to console logon only
Description
Determines whether remote interactive logons by network services such as Terminal Services, Telnet, and FTP are allowed for local accounts that have blank passwords. If this setting is enabled, a local account must have a nonblank password to be used to perform an interactive logon from a remote client.
Default: Enabled
---
If this setting is enabled, then your LogonUser call is going to fail.
Regards,
Russell
Business Accounts
Answer for Membership
by: JohnjcesPosted on 2009-02-11 at 07:38:35ID: 23612428
Did you try... (I forget sometimes whether it is nil or 0)
PChar('.'), Nil, or
PChar('.'), 0,
LogonUser(PChar('MyUser'),
LogonUser(PChar('MyUser'),
John