Jonesey007
asked on
Windows Installer Hooks to Simulate User Interaction
Hi
I am investigating the possibility of developing an application which will hook into an installer and reproduce user actions , such as clicking the 'Ok' and 'Next' button etc
My company deliver laptops with custom builds (XP usually) with up to 30 installed applications and drivers.
We use Ghost to clone the final image and roll image the laptops via a network connection.
When we build the master image we often install the same software we have used on multiple different builds in the past.
I would like to try and automate this process and in the past we have used recorder software to record x and y coords etc but it has proved unreliable.
For example, we need to install MySQl. This includes pressing 'Ok' three times, selecting 'Custom' and then 'Next' 3 more times and finally pressing the 'Finish' button.
I would like to develop an app which records all user interaction with the MySQL installer window.
Once recorded will i we able to launch the MySQL Installer on another machine and use method calls to simulate the 'Ok' button being pressed?
If this is possible i will spend more time researching it. Another option is to record all the registry and file updates during an install process and have my app call the APIs directly pretending to be the MySQL installer?
Any info would be appreciated
Thanks
Pete
I am investigating the possibility of developing an application which will hook into an installer and reproduce user actions , such as clicking the 'Ok' and 'Next' button etc
My company deliver laptops with custom builds (XP usually) with up to 30 installed applications and drivers.
We use Ghost to clone the final image and roll image the laptops via a network connection.
When we build the master image we often install the same software we have used on multiple different builds in the past.
I would like to try and automate this process and in the past we have used recorder software to record x and y coords etc but it has proved unreliable.
For example, we need to install MySQl. This includes pressing 'Ok' three times, selecting 'Custom' and then 'Next' 3 more times and finally pressing the 'Finish' button.
I would like to develop an app which records all user interaction with the MySQL installer window.
Once recorded will i we able to launch the MySQL Installer on another machine and use method calls to simulate the 'Ok' button being pressed?
If this is possible i will spend more time researching it. Another option is to record all the registry and file updates during an install process and have my app call the APIs directly pretending to be the MySQL installer?
Any info would be appreciated
Thanks
Pete
"Hooking" is already anticipating a possible way to resolve that: Windows Hooks (http://msdn.microsoft.com/en-us/library/ms632589%28VS.85%29.aspx) and WH_JOURNALRECORD/WH_JOURNA LPLAYBACK in particular. See http://www.codeproject.com/KB/applications/winmacro.aspx ("Writing a Macro Recorder/Player using Win32 Journal Hooks") which pretty much already fits your requirements and comes with full source code.
ASKER
Hi
thanks again jkr
I've tested the CodeProject example and its not quite what im looking for as it records mouse movements and utilises system hooks.
You sent me a great example in another question from a German site but im really looking for something in-between
I don’t understand how installers (MSI and .EXE's) work but im hoping as you iterate through an installer (Press Next, Ok , Confirm ive read the license, Next, Next etc) im hoping each visual panel in the installer will have an id.
So on a MySQL installer, the first panel says "Welcome to the setup wizard for MySQL server 5.1" The setup wizard will install MySQL .... "To continue, click Next"
There are two buttons on this panel, "Next" and "Cancel"
I would like to hook the MySQL Installer and then send a function call to simulate the "Next" button press for Panel[0].
Hope this is clear. Do you know any examples or any techniques i can use for this?
Thanks very much for the help
Pete
thanks again jkr
I've tested the CodeProject example and its not quite what im looking for as it records mouse movements and utilises system hooks.
You sent me a great example in another question from a German site but im really looking for something in-between
I don’t understand how installers (MSI and .EXE's) work but im hoping as you iterate through an installer (Press Next, Ok , Confirm ive read the license, Next, Next etc) im hoping each visual panel in the installer will have an id.
So on a MySQL installer, the first panel says "Welcome to the setup wizard for MySQL server 5.1" The setup wizard will install MySQL .... "To continue, click Next"
There are two buttons on this panel, "Next" and "Cancel"
I would like to hook the MySQL Installer and then send a function call to simulate the "Next" button press for Panel[0].
Hope this is clear. Do you know any examples or any techniques i can use for this?
Thanks very much for the help
Pete
ASKER
ideally i would like to void mouse movement techniques because the solution will be used on different hardware and screen resolutions
thanks
thanks
I suppose you could use FindWindow() to get a handle to the installer dialog, EnumChildWindows() to find the "Next" button, and SendMessage() to post WM_MOUSEDOWN/WM_MOUSEUP events to the button.
Window functions: http://msdn.microsoft.com/en-us/library/ff468919%28v=VS.85%29.aspx
Message functions: http://msdn.microsoft.com/en-us/library/ff468870%28v=VS.85%29.aspx
SendInput() (http://msdn.microsoft.com/en-us/library/ms646310%28v=VS.85%29.aspx) might be easier to implement than SendMessage().
But, wouldn't it be easier to customize the installation packages and then just run them in unattended mode? I usually find that, using Orca (http://msdn.microsoft.com/en-us/library/aa370557%28v=vs.85%29.aspx), many of a .MSI's properties are obvious, or can be learned from the publisher's site or sites like www.appdeploy.com; then I can create a transform for the MSI and just run msiexec.exe with the "/qb" switch to run it unattended.
Window functions: http://msdn.microsoft.com/en-us/library/ff468919%28v=VS.85%29.aspx
Message functions: http://msdn.microsoft.com/en-us/library/ff468870%28v=VS.85%29.aspx
SendInput() (http://msdn.microsoft.com/en-us/library/ms646310%28v=VS.85%29.aspx) might be easier to implement than SendMessage().
But, wouldn't it be easier to customize the installation packages and then just run them in unattended mode? I usually find that, using Orca (http://msdn.microsoft.com/en-us/library/aa370557%28v=vs.85%29.aspx), many of a .MSI's properties are obvious, or can be learned from the publisher's site or sites like www.appdeploy.com; then I can create a transform for the MSI and just run msiexec.exe with the "/qb" switch to run it unattended.
ASKER
hey thanks Tgerbert
That looks very interesting and will save a ton of work? Does something similar exist for .EXE setup files?
Thanks
Pete
That looks very interesting and will save a ton of work? Does something similar exist for .EXE setup files?
Thanks
Pete
Well, MSI's are a specific type of database, and as such conform to a set of well-defined rules so they're behavior is very predicatable & controllable.
EXE installers, on the other hand, are really just programs and free to act however they want - so they can sometimes be problematic.
Really, it's up to the vendor, but typically an EXE installer is just a self-executing compressed archive from which you can extract an MSI; or will accept a "silent" or "unattended" command line parameter. Rarely (if ever) have I seen an EXE installer that didn't fit into one of these two categories.
In either case, consulting the publishers documentation is the best place to start - almost every big player out there will give you the information & tools you need to customize the installation of their product. Failing that, I go www.appdeploy.com - sometimes an installer will have configurable parameters that aren't documented, but you may find there.
EXE installers, on the other hand, are really just programs and free to act however they want - so they can sometimes be problematic.
Really, it's up to the vendor, but typically an EXE installer is just a self-executing compressed archive from which you can extract an MSI; or will accept a "silent" or "unattended" command line parameter. Rarely (if ever) have I seen an EXE installer that didn't fit into one of these two categories.
In either case, consulting the publishers documentation is the best place to start - almost every big player out there will give you the information & tools you need to customize the installation of their product. Failing that, I go www.appdeploy.com - sometimes an installer will have configurable parameters that aren't documented, but you may find there.
I would recommend you to write a custom action dll and use a transform to link that to the existing MSI application. So in the custom action you could handle the way you want to handle.
Let us know if you need more info.
Let us know if you need more info.
ASKER
Hi DeepuAbrahamK
Thanks for the input. can you tell me what a transform is? Is this the same thing as a mofified MSI generated by ORCA or a similar program?
I think i need to investigate tgbert's above comments because i need a solution that will work with Exe's and MSI's
Thanks for the input
Pete
Thanks for the input. can you tell me what a transform is? Is this the same thing as a mofified MSI generated by ORCA or a similar program?
I think i need to investigate tgbert's above comments because i need a solution that will work with Exe's and MSI's
Thanks for the input
Pete
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.