I'm creating a process as a User(CreateProcessAsUser()
) to launch an application on the users screen. I need to somehow get a function to run on the user's screen before the application launches. My thought were to CreateRemoteThread()
and put my function in here but this would happen after the CreateProcessAsUser()
already launched the application.Any one advise? Thanks
Asked
Active
Viewed 55 times
0

hmjd
- 120,187
- 20
- 207
- 252

user1881918
- 33
- 6
-
It is. I had the function call before the createprocessasuser call but that function gets called in Session 0 which is hidden. I thought that by using a thread i could call the function in the users session. – user1881918 Dec 06 '12 at 11:45
1 Answers
0
Create a new application that executes your function and then executes the target application (which could be done using CreateProcess()
as the new application was started via CreateProcessAsUser()
).

hmjd
- 120,187
- 20
- 207
- 252
-
Is there a way of bypassing the creation of another new application. Could I do the following: use CreateProcessAsUser to create a process that does not launch an application, then assign a thread to this process that calls my function, then create another process(CreateProcessAsUser) with my original application ?? – user1881918 Dec 06 '12 at 11:53
-
@user1881918: "create a process that does not launch an application" - A process is an application, do you mean interface? I would avoid `CreateRemoteThread` - what if the application you want to launch is 64 bit, and your application is 32 bit? You can't inject a thread. You should `CreateProcessAsUser` on the calling application (i.e. use `GetModuleFileName`), with a command line parameter that tells it to do your 'function', that way you only need one application, but it does two things. – parrowdice Dec 06 '12 at 12:00
-
yes i meant interface but that would run some exe which wouldnt be any use. Thanks thats cleared things up – user1881918 Dec 06 '12 at 12:10