Call to LogonUser Lib "advapi32.dll" works on one server but not another

I'm deploying a windows service that watches for files.  I need to impersonate an account that has access to a network share and this is working on my local machine and a development server but not the prod server.  I can map drives on both servers using the account in question. Myself, the impersonation account, Admins, and SERVICE are all part of the "Impersonate a client.." security setting.  It looks like the call to advapi32.api is failing with a False return on the prod server (I can't attach to a process on the servers to see why but I've added logging that narrows it to that call).
Differences between dev and prod server:
   Prod:Windows Server 2003 R2 Standard EditionSP2  
   dev: Windows Server 2003 Standard Edition SP1  
   Different domains but both my id and the impersonation id can be located and given privileges on both servers using "domain\id" where domain is the same for both.

Any ideas why it's failing?
Who is Participating?
If you are using the LOGON32_LOGON_INTERACTIVE then I believe you also need the "Log on locally" privilege set.

If there is still no love, try the "Act as part of the operating system" privilege.  It's not supposed to be a restriction for LogonUser in 2003, but SP2 might have changed something.

Also what error is retrieve with GetLastDLLError when it fails?
bozworthyAuthor Commented:
thanks for the quick response.
still no love with either of those two security settings.  do I need to uninstall, reinstall, and restart the service to pick up those changes (I would think not) ?

I don't have GetLastDLLError  implemented in the code at this time but I'll get to work on that.
You will have to restart the service at least I think.
bozworthyAuthor Commented:
Ok I went back and removed all the security entries and restarted the service after adding each one at a time.  It's the Allow log on locally that does the trick.  Thanks a million.  I think that was quickest solution I've had yet.
Glad you got it working.  Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.