Create installers dynamically
-
Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way
-
Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way
Hi Jacob, My first guess might be that they are using the Windows Installer API to create MSI databases. See about it here: http://msdn.microsoft.com/en-us/library/aa372860(v=VS.85).aspx[^] See also the database manipulation functions: [^]
The difficult we do right away... ...the impossible takes slightly longer.
modified on Sunday, November 21, 2010 4:42 PM
-
Hi Jacob, My first guess might be that they are using the Windows Installer API to create MSI databases. See about it here: http://msdn.microsoft.com/en-us/library/aa372860(v=VS.85).aspx[^] See also the database manipulation functions: [^]
The difficult we do right away... ...the impossible takes slightly longer.
modified on Sunday, November 21, 2010 4:42 PM
I don't think they are doing that. Reason is because it is not a MSI file, it is a exe file. I did open reflector on the exe file and see where the install can take arguments but I just don't know how it is getting those arguments from that file you download. I found stuff like this: set.ReadXml(Assembly.GetEntryAssembly().GetManifestResourceStream(Assembly.GetEntryAssembly().GetName().Name.ToString() + ".Template.xml"), XmlReadMode.ReadSchema); So it appears to me that someway when you create a client, they are changing the Template.xml embedded resource. When you go to the webpage and click the link for your agent it is actually pointing to a Deployment.aspx?ID=LOCATIONID page. The number cooresponds with the location ID. Which there are templates that coorespond with that location. So it is changing that template.xml file based upon the location ID and the template is a embedded resource
modified on Sunday, November 21, 2010 6:34 PM
-
I don't think they are doing that. Reason is because it is not a MSI file, it is a exe file. I did open reflector on the exe file and see where the install can take arguments but I just don't know how it is getting those arguments from that file you download. I found stuff like this: set.ReadXml(Assembly.GetEntryAssembly().GetManifestResourceStream(Assembly.GetEntryAssembly().GetName().Name.ToString() + ".Template.xml"), XmlReadMode.ReadSchema); So it appears to me that someway when you create a client, they are changing the Template.xml embedded resource. When you go to the webpage and click the link for your agent it is actually pointing to a Deployment.aspx?ID=LOCATIONID page. The number cooresponds with the location ID. Which there are templates that coorespond with that location. So it is changing that template.xml file based upon the location ID and the template is a embedded resource
modified on Sunday, November 21, 2010 6:34 PM
Using the Microsoft API you have the option to create a MSI or a an exe. Without seeing anything you are talking about it is difficult to even guess, however the code could be embedded in the msi database or the code could be constructed on the fly using CodeDOM with the code embedded within it
I know the language. I've read a book. - _Madmatt
-
Using the Microsoft API you have the option to create a MSI or a an exe. Without seeing anything you are talking about it is difficult to even guess, however the code could be embedded in the msi database or the code could be constructed on the fly using CodeDOM with the code embedded within it
I know the language. I've read a book. - _Madmatt
Ahh I was thinking since it was talking about a MSI installer it only did MSI. I don't really have any code. I used reflector to look at the code to see what they were doing. I can try to explain this.. Ok there are agents and each agent have a "location" (city, town, etc). Now there are templates assigned to each location. These templates can contain stuff such as the server address, port, location id, tray icon file, etc. So in the control center application you create your locations and pick the template that goes with them. When you create a location and set the template it creates a link on the webpage for that installer (so it automatically creates a custom installer) So on the web interface where you download the agent EXE file, it is going to a Deployment.aspx page and is passed the LocationID as a query string. You download the EXE file, install it, and now your computer shows up automatically under the correct location. So after digging around in reflector I noticed that the installer is default for all of them. The only thing that changes is the embedded resource Template.xml. So what I think is happening is the Deployment.aspx page is querying the database for the locationid template information and creating a new Template.xml file. It is then replacing the Template.xml that is already in the agent installer with this new Template.xml. So when you install it, it is setting all the information in the template. So my question is if I have a EXE that I created, how do I replace the embedded resource with a updated file? This means I would have to open the EXE file and somehow figure out where the embedded resource file is and replace it programmically.
-
Sorry this question might seem vague, but I was wondering how to create dynamic installers? Maybe I'm not wording it right so let me explain the situation. We use a monitoring software and with this software you can create clients that have location(s). Each time you create a location within a client, you will see another installer popup on the web interface. Now what you do is you download this agent installer for your location, and it will install the agent on your computer. This agent creates a directory on your filesystem along with installs and runs two services. So my question is.. how exactly are they doing this? Because when you create the location it automatically creates a link on the webpage for a installer. Now with this certain installer it somehow has embedded your location ID which makes it when that agent installs it already puts you under that location. I noticed that the location is set in the registry so when it is dynamically creating it, it is embedding it to install setting that registry to that location ID. I've looked using reflector and wasn't able to find it.. it was a pretty large program so I'm still looking. I would love to hear your ideas on making this work similar to that way
-
Ahhh I'll take a look at that too. Note: I removed the code since it is not mine. It is code I found using reflector. I feel that I might of violated some license agreement by posting snippets of the code that I found. Although I would love to learn how they were capable of reading the bytes of the executable and replacing only the bytes that related to the Template.xml.... it is not worth being sued over :-) lol
modified on Monday, November 22, 2010 7:08 PM