Home
Tutorials
Code Snippets
Code Samples
Downloads
The Forum
Links

The Blog
Our Projects
Guest Book
About
Contact

ShOuT b0X:
::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 

View thread "launching installer"

Author
Thread Post Reply | New Thread
Views: 2809 | Replies: 9 | Posting Date: 2006-09-11 19:33:44
Thread Starter:
coder
Hi,

I'm trying to launch the installer executable for windows media player from a windows service while it is being installed. I tried using the WinExec and ShellExecute funstions and neither one of them work. Does anyone know how to accomplish this task?

Thanks in advance~


arkon
Posted at:
2006-09-12 04:41:40
Re: launching installer

give more details please,

1.is it an .msi file you try to install?
2.while YOUR service is being installed?
3.maybe you actually executed the installer but didn't show it?
4.did you try running your code from a plain win32 console application?
coder
Posted at:
2006-09-12 07:22:38
Re: launching installer

Actually it is an exe file that I'm trying to launch. Yeah I wrote a service code, and in the OnInstall function for my service, it should launch the installer. I did execute the installer but it runs as a secondary under the service and I want it to run independent of service. Also, in the task manager it shows that it is runnig as a system file but it should be running under the current user. So when it runs as a system file, it launches but it is incapable of performing its functions
arkon
Posted at:
2006-09-12 07:44:52
Re: launching installer

did you try CreateProcess, i think there's also a snippet for this one.
coder
Posted at:
2006-09-12 11:26:51
Re: launching installer

Yeah I tried that too! Like in your snippet, you launch notepad.exe. When I tried that, I see notepad.exe running if I open the windows task manager and go to processes tab. And notepad is running as a SYSTEM file not under the current username. So I see it is launched but there is no windows that I can use. It's functions are diabled when it is launched as a system file
arkon
Posted at:
2006-09-12 15:10:16
Re: launching installer

so you will need CreateProcessAsUser
check msdn for this one.
Coder
Posted at:
2006-09-15 11:22:21
Re: launching installer

Thanks for the hint. I have a question on getting user tokens in CreateProcessasUser. It says that I should call the LogonUser function to call get the Tokens. But in my code the user should already be logged on so how can I get the token for the user already logged on?

By the way, just out of curiosity, in C++, is there a way to attach a file to startup that automatically launches a program when someone logs on?

Thanks!
arkon
Posted at:
2006-09-17 16:02:41
Re: launching installer

well, this one is really tricky,

you have a few options, i will mention two of them:
1. create a normal application that will run from the RUN key (or any other start up ideas you have) which will use IPC with your service to send its token info. then your service will communicate with this app and impersonate this process.

2. enum all processes until you find explorer.exe and then take its token. you should be able to do this, since you run in system privileges anyways.

3.write your own GINA which will track login/logoff

i think you should pick up 2nd option.


about your second questions, as i said, you can use the RUN key in registry.
or startup directory or whatever you like. and it doesn't have anything to do with C++. it's pure windows stuff.

good luck
coder
Posted at:
2006-09-21 01:02:57
Re: launching installer

Actually I realized that the problem is not that the code is running as a system file but it is that it is running as a process owned by the service. Can I launch it without having it being associated with the service?

Also, I'm really new to the C++ environment. I recently started learning it and it is similar to other languages so it isn't that hard but I really don't know how to enum processes and take a token from explorer.exe. Do you know any good tutorials or something where I can learn it from?

thanks again~
arkon
Posted at:
2006-09-23 11:25:36
Re: launching installer

for process enumeration you need the same api as in this snippet, check this out
http://www.ragestorm.net/snippet?id=18
though you will need TH32CS_SNAPPROCESS and Process32First and Process32Next.
Post Reply | New Thread

Replying to post "launching installer"

Name:
Topic:
e-mail:
ICQ:
::Top 5 Tutorials::
Embedded Python[57494]
Keyboard Hook[55451]
2D Rotated Rectangles Collision Detection[49183]
UDP[41014]
HTTP Proxy[27800]

::Top 5 Samples::
2D ColDet Rotated Rectangles[8464]
PS2 Mouse Driver[5159]
Reading FAT12[4146]
Wave Format Player[3982]
CodeGuru[3791]

::Link to RageStorm::

::Affiliates::
AngelCode
YOV408 Technologies
FireStorm


All rights reserved to RageStorm © 2009