CreateProcessWithLogonW

Paul.Harrison

New Member
Hi,

Has anybody successfully used the 'CreateProcessWithLogonW' function under Progress. Can get it to work under VB, but all I get is invalid username/password when using progress.

Enclosed is current progress code I'm trying to get to work.

Or if anybody has done it with the 'CreateProcessAsUser' function I would be gratefull for some code snippets!.

Ta.

Paul Harrison.
 

Attachments

  • paul.txt
    2.7 KB · Views: 75

Paul.Harrison

New Member
Ok - I have A solution - Enclosed

Okay, didn't get a response but I've managed to get this to work, so I'll post my solution as you may find it useful!

I have ended up using the API's LogonUser and CreateProcessAsUser, the important thing is that the user specified has certain local rights on the machine running the application, these are:

- Log on as a service,
- Log on as a batch job,
- Act as part of the operating system,
- Increase quotas,
- Create a token object,
- Replace a process level token.

Then using the code enclosed it should work.

Ta.
 

Attachments

  • paul.txt
    5.2 KB · Views: 122

sgregory

New Member
I am having trouble getting this to work on Windows 2000 server. The API calls do return valid values and seem to work - but the command is never run.

The API calls do correctly identify when the server cannot find the command you want to run.

Has anyone any advice?
 

Paul.Harrison

New Member
Assuming you are trying to start a PROWIN job, do you actually see a PROWIN32 job in the task list, if yes then your command is invalid and hasn't started to run your program.

If you don't then have you assigned the local rights to the user you are starting the job under, the error message returned is usually you don't have permissions/priviledges to do this. If the user is controlled by a domain server then you may have to set these priviledges on the domain user as well.

Try using the administrator user and see what happens.

This code does work on WIN2000, WIN2003 servers.

Thats about it - it should work once the users authorisation is sorted. (I use it from a background process that was started in services and therefore has a user of SYSTEM which then uses this code to kick off prowin jobs under an Administrator user).
 

sgregory

New Member
Hello Paul,

Many, many thanks for the fast response - I tried your advice and used the administrator login and it worked a treat!

We've added the original user to an admin group and that works as well now. No change in the values returned by the API calls, it must have been something obscure that was tripping it up.

Thanks again, you've made my day!

Stu.
 
Top