Limitations of InstallScript "Is(FILE_EXISTS, filename)"? - installscript

My InstallScript 2014 project installs our application on a desktop PC or an embedded PC that controls an industrial instrument. The only way to know the difference is the presence of a unique USB device driver on the embedded PC that is used to enable the instrument front panel - there is obviously no front panel on the desktop.
The InstallScript code says
if (IS(FILE_EXISTS, "c:\\windows\\system32\\mydriver.sys")) then
do instrument stuff
else
do desktop stuff
endif;
The file is present on the instrument hard disk in the windows\system32 folder, yet the IS function always returns false.
I don't understand why this would be failing. The installer itself is running with elevated privilege, but examining the contents of Win\Sys32 does not require any special permissions - I can see the file using Windows Explorer.
What am I missing?

Apparently there is "magic" at the file system level that redirects requests between various directories on a 64 bit Windows system.
It seems that all that must be done is
Disable(WOW64FSREDIRECTION);
do stuff
Enable(WOW64FSREDIRECTION);
See Targeting 64 bit operating systems with InstallScript Installations

Related

obtain data from remote computers using autoit

I have been maintaining a program written in batch. I want to write a replacement program using autoit.
The program is downloaded to the desktop of remote computers and prints out a log of the scan results in notepad on the desktop.
I want it to cover windows XP-vista-7-8-8.1-10. At the moment it does not cover 8-8.1 or 10.
This is the printout:
Results of my test version 001
Windows 7 x86 Service Pack 1 ---- (shows in brackets if service pack is out of date)
(UAC) --- shows if UAC is on or disabled.
Internet Explorer----(shows if out of date)
Antivirus/Firewall Check:
Windows Firewall Enabled!
Panda Free Antivirus
WMI entry may not exist for antivirus; attempting automatic update.
Anti-malware/Other Utilities Check:
CCleaner
Java 8 Update 31 (Java version out of Date!)
Adobe Flash Player 17.0.0.188
Adobe Reader XI
Mozilla Firefox (38.0.5)
Thunderbird (38)
System Health check
Total Fragmentation on Drive C: 2%
````````````````````End of Log``````````````````````
So this is possible. To get versions of files(like java and firefox) I think you can use FileGetVersion
To get if windows filewall is enabled you have to read the registry. This key might be a little bit different depending on your system but the one for me was this one
RegRead("HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\", "EnableFirewall")
These two macros should be usefull to determine OS specific information that you request
#OSType
#OSVersion
UAC can also be read from the registry and as with the firewall it might depend on your system but for me this was the registry:
RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA")
Im not quite sure what the Total Fragmentation means so I am not sure how you can get this.
You should be able to compose a txt file with all this information. You should be able to find examples of autoit code that transfers text files just by searching here on stackoverflow or on google.

JWrapper windows shortcuts broken

JWrapper support now redirects to StackOverflow, so I'm posting here.
The Windows shortcuts created by JWrapper don't work; they point to a location which doesn't exist; I can verify this by navigating to the directory pointed to in the properties of the shortcut:
C:\Users\jchrist\AppData\Roaming\JWrapper-SampleApp
and seeing that the expected SampleAppWinLauncher.exe isn't there.
I can reproduce this simply with a slight modification of the SampleApp. Open the jwrapper-sampleapp.xml file and copy main virtual app, but give it a different name:
<App>
<Name>SampleApp2</Name>
<LogoPNG>sampleapp/logo.png</LogoPNG>
<MainClass>jwrapper.SampleApp</MainClass>
<Param>one</Param>
<Param>two</Param>
</App>
If you do this, and then run the 32-bit offline installer, you'll get a dialog which allows you to select which of the two virtual apps you want to launch.
After selecting one of the (identical) virtual apps and quiting it, the shortcuts provided in the start menu in the SampleApp folder do not work. If you dig into the properties of the shortcuts, you can see they point to an executable which doesn't exist. (It did exist, but it deletes itself after the first run).
I'm using the latest JWrapper (jwrapper-00036138363.jar, although this problem existed with jwrapper-00035090611.jar) as well.
I've tested this on Windows 7 today and it works OK. I haven't tested this on server 2008 but Windows 7 is treated basically the same as Server 2008 by JWrapper. Also the executable disappearing after the first run is not normal behaviour.
My guess would be that this is antivirus software that is detecting the run as a false positive and deleting the executable. Do you have any AV software installed? can you turn it off to test?
Unfortunately some AV software will delete files etc without any warning.

CSS cross browser compatibility on Ubuntu

I'm currently working in web development and my default desktop is Ubuntu and I'm kind of happy with the setup and applications I got going. But I need to test web pages for cross browser compatibility while still being on Ubuntu.
I have gone through hell trying to get IE7 or IE8 (with wine) to run on ubuntu and when they finally worked they were very buggy and the graphics/scrolling was insanely slow.
Of course there is the option of virtual box but again, too much GBytes just to run a small application!
So to all the CSS gurus out there, how can I continue with my beloved Ubuntu and still deliver a good quality (tested) page.
Thank you.
Edit:
Update for freshness:
I now use the paid service from browserstack.com to provide the multitude of different browser testing environments via flash tunnelling. I'm a paid user, but there is an initial free trial period. browserstack has freed me of the need to run the windows os on my machines in any form, virtual image or otherwise. Since it also allows tunnelling, I can host the site on my local machine but still test in browserstack browsers. I consider the monthly fee money very well spent.
End Edit
Various options I have tried, including "the final solution": free downloadable windows testing OSes from microsoft
I've tried a number of the options below, but virtualbox may be your best bet for full & complete testing, especially because in a professional capacity you often have to test ie8, ie7 -and- ie6. Which gets tricky with only a single os installed. So in order of simplest and most shallowly testing to most complex and most fully testing:
browserlab.adobe.com
A newer, interesting online solution is: browserlab.adobe.com. It's actually very specific and fast compared to browsershots. It only gives you screenshots, but it's a great first step. So I do recommend that for purely visual (and thus relatively shallow) testing.
Browsershots.org
And while browsershots.org is also something that you should use for an overview experience of what users might see, you really can't get by without the real browsers for javascript and behavior testing (instead of just display & rendering testing that browsershots provides). The delay before you can see the images is also killer.
Dual booting into windows
Another that I've tried is dual booting, I work 99% of my time in ubuntu, and I have windows installed & available to dual boot into. Not a fast way to test, but if you don't have any other way to access ie, it should work for at least the latest version.
Remote desktop-ing over to a running windows box
Before I mention the "covers-all-the-bases" option, another useful possibility is to set up a windows machine and boot it up and connect to it via remote desktop so that you can work from one machine and test from both.
The final solution, using virtualbox
Finally, the mother of all solutions, using virtualbox:
Luckily (I know you said you didn't like the virtualbox solution, and I know it's an annoying setup process, but...) Microsoft provides available-for-a-year-or-more virtualmachine distros with different versions of ie pre-installed, available without the need for a license for a year or so before you'd have to update the virtualmachine, #
http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en
Installing a virtualmachine from microsoft's freely available browser testing images
Because this guide to setup on ubuntu is no longer available in full anywhere else, just in case you or someone else actually need it I feel compelled to include the actual details of the install process that were suggested to me on the ubuntu forums and worked when I went through them. I apologize for their length. Courtesy of the now anonymous original poster on the ubuntu forums:
Free Access to Microsoft Browser Compatibility Virtual OSes, Install Steps for Ubuntu
http://ubuntuforums.org/showthread.php?t=1097080 (Ed: I can't find this thread online any more)
HOWTO: run IE6, IE7, IE8 on Linux in
VirtualBox You need: virtualbox, qemu,
wine
Code: apt-get install virtualbox qemu
wine
Download the free(!) Microsoft
Internet Explorer Application
Compatibility Check VPC Images here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en
(Note: you don't have to download the
full pack, you can cherry pick
specific combinations of XP/Vista and
IE6-8)
Extract the VPC image(s) with wine
(double-click). (Note: it might take a
while before the first window shows
up)
Turn the VPC image(s) into (a) VMWare
image(s) (which is/are readable by
VirtualBox): qemu-img convert -f vpc
image.vhd -O vmdk image.vmdk
Setup a new VM in VirtualBox, using
the vmdk image as an existing disk.
Boot it, you will see the Windows boot
progress bar and ... it will BSOD
shortly after.
Fixing the BSOD:
The BSOD is caused because the virtual
Windows tries to load processor
drivers for the wrong processor (it is
not running on VirtualPC proc, but on
VirtualBox proc). Or something like
that... We need to force Windows not
to attempt to load drivers for the
processor (it doesn't need any proc
drivers, because it's all virtual
anyway). Start safe mode by
(frantically) hitting F8 at Windows
boot and choosing safe mode.
Ignore all the 'New hardware' detected
warnings (we will deal with those
later). Start a command box and run
the following command to disable the
loading of processor drivers:
Code: sc config processor start=
disabled (note the space between '='
and 'disabled'!)
Restart the virtual Windows, it should
now boot all the way to the Windows
Desktop.
Now just when you think you can start
browsing the web with IE, you will
find out that the virtual Windows
needs to install the drivers for the
AMD PCnet NIC, which are located on
the Windows install disk. Fortunately
for those without a Windows install
disk, there is another way :)
Download AMD PCnet drivers here:
http://www.amd.com/us-en/ConnectivitySolutions/ProductInformation/0,,50_2330_6629_2452%5E2454%5E2486,00.html
Make an iso file containing the
drivers. I used Brasero for
simplicity. Choose to create a Data
Project, add the zip file (or the
unzipped files, saves you a step in
Windows), create the iso. No need to
burn an actual cd!
Stop the virtual Windows, edit the
settings in VirtualBox: mount your
brand new iso.
Start the virtual Windows, when it
asks to install the drivers for the
PCnet nick, point it to the (unzipped)
drivers. Et voila! You have teh
innernets! (Now you can also try to
install the other drivers it complains
for, but it's not really necessary)
The image README says the image will expire after about a year. In my experience the system gets hobbled against multi-hour use, but is still usable for the kind of short periods that you might want when booting up to test a website. At worst you might have to go through these steps again, so be sure to put them somewhere where you can find them again after a year or so.
I think setting up a virtual machine (Virtualbox or VMWare or...) with a proper Windows will be your only (local) option.
I you don't have one, buy a used Windows XP license. XP is cheap (around 20-30 euros here in Germany, for example) and all relevant versions of IE run on it. Home edition is enough. No need for Windows 7 or anything.
You could install IETester on that to get all the IE versions on one OS. IETester has flaws and is not always 100% reliable in what it renders, but for a general CSS compatibility check it should be okay.
I've never tried IE using Wine, but even trying to imagine the combination gives me goose bumps :D
If you have a copy of Windows you could install it in a virtual machine (Virtualbox is a good, free option). Or if you don't mind a lot of lag time and publicly exposing your web pages you could use a service like BrowserShots.
I have not tried this on Ubuntu or anything but windows - but this seems to be a pretty good testing system over the web.
http://spoon.net/browsers/
however, I think your best result would be to use a VM if possible.
I have to add my voice to those opting for VirtualBox.
VMs are the only way to get an accurate representation of how IE platforms behave. They also allow you to keep your main Linux install free of WINE and IE gunk, which is otherwise always troublesome and fragile. (Especially if you're trying to run multiple IEs, which is unreliable and inaccurate even under Windows).
They're not necessarily that big, if you take care to prune the unneeded features, turn off swap, compact the disc image and so on. My XPSP3 test image is just over 800MB.
I didn't want to install all this stuff as I wanted to move forward quick.
I found public AWS images with pre installed browser that you just can start and use.
http://www.hens-teeth.net/html/products/cross_browser_testing.php
If you already have an AWS account this will take you only 5 min. Make sure that you enable the RDP port on the incoming traffic in your security group.
As I use ubuntu I was looking for a way to connect from it to MS Win.
I'm connection on to them via remote desktop.
The way to go here is rdesktop, a command line utility for Windows Remote Desktop. (sudo apt-get install rdesktop)
If you feel like a GUI use tsclient. It's very close to the windows version.
From a work flow perspective I develop for Chrome in Ubuntu first, then have a look at the other browsers via browserlab.adobe.com.
After that I start my new AWS instance to debug.
The small AWS Windows instance is a $0.12 per hour (http://aws.amazon.com/ec2/#pricing). I can work for a long time on that before it's worth installing all this stuff.
CrossBrowserTesting.com works from Linux. Allows you to access Mac, Windows, and Ubuntu configurations and all the browsers loaded on them via vinagre vnc client.

Running Visual Studio in Parallels for mac - problem with debugging sites sitting in os x drive

I've installed parallels desktop on my MacBook to be able to run Visual Studio 2008 in a XP installation. Everything works great except when I decided to put my websites in my sites folder in the os x file system (Which by default automatically happens because the My Documents folder is mapped to the Mac's Documents folder, and I'd rather put my code there so that both OS's can easily access it.).
When trying to build or debug I get this error:
Failed to start monitoring changes to 'Z:\xxx...'
How do I get it so that I can get it to work under Parallels, from the shared drive?
Parallels uses network drives to simulate folders on OS X, and Windows can't monitor changes to network drives, so if you do this directly, it'll be broken.
If you want to keep them in sync though, use Live Mesh (http://www.mesh.com) and install it on both the host and guest. A little roundabout, but it'll make it so both copies are maintained (and Live Mesh is handy for other things too)
I recently flipped over to putting my source code onto my Mac volume, so I could use Time Machine to back it up and immediately got this same problem with my ASP.NET app. Other, procedural applications, built just fine, by the way.
I tried all sorts of things, including using Samba on the Mac side to share the directory, which led into the "too many BIOS commands" error described elsewhere. Unfortunately for me, the Registry hacks to fix that problem never worked for some reason.
I finally found another solution that avoids Samba and just uses the regular Parallels Shared Folders. It too is a Registry hack, but this one simply turns off file change monitoring for ASP.NET. It is a bit heavy-handed, but gets my builds to work again.
The reference for this change is here:
http://support.microsoft.com/kb/911272
The downside to this approach, I am finding, is that you need to be more deliberate about recompiling, or restarting the web server, as changes during development don't just magically appear anymore. I am still deciding whether that is a useful tradeoff.
UPDATE: After several days of this, development was just too difficult and, sadly, what I reverted to was keeping my source inside the Parallels virtual disk. To enable Time Machine backups and Spotlight searches, I used a lightweight MS utility called SyncToy to push stuff out of Parallels and out to my Mac drive several times a day. Despite the high hack factor, it is working well.
I know this isnt strictly a solution but VMware fusion is superior when it comes to shared drive space on a virtual machine. Its what i currently use and hasn't let me down thus far...
People always give me odd looks when they see visual studio on my mac :P
Try moving the project on to the VMs C drive. Its not an ideal situation, but you can access the VMs C drive from OS X.
I have a similar problem with a php site that uses an MS Access database (its a clients system). I have alias's that point to the php site on the VM so that I can still do all of my coding in OS X. To do this I created a network share on the VM and then connected to it from OS X. Once connected make the alias's. If the network drive is not open and you open a file in OS X it will try to reconnect. It means the VM will need to be running to get to the files, but this isn't normally a problem since the VM is hosting the site anyways.
.NET has funny issues trying to debug the objects on a network drive.
make sure that you have full trust on your local network between your Mac and XP install.
Check out: http://msdn.microsoft.com/en-us/library/aa302361.aspx
If at the end of that research, I"m afraid you will have to look into the option of keeping it on the VMDisk and moving it when you need it.
I see a similar problem on my machine connected to the windows domain. My documents is mapped to a network share and I can't debug|run|etc. I had to eventually move to my local disk for debugging.
I definately recommend Live Mesh as a way to keep directories in sync. Just keep the VM's directory in sync with the Mac's directory.
Or use SVN to hold copies in both machines and do commit/update as appropriate. That way you get versioning, history and if your project grows bigger, you can share with other devs.
I know dropbox also has history and sharing, but not check in/check out/conflicts and all the other advantages of a real source control.
Oh, if you have money you can also go for TFS. I would but it is just too expensive :)

Sysinternals' Portmon: Error 2

When I try to connect to local ports, Computer -> Connect local, using Portmon v. 3.02, I'm getting an error message, Error 2, in a small error dialog box:
I run the tool as an administrator (if not, I get error 6).
By the way this is a Windows 7 x64. On 32-bit, in Windows 7 x86, it works fine. How can I fix this problem?
Sysinternals' Portmon works only on 32-bit versions of Windows. It does not support 64-bit (probably its driver is not signed).
From the Portmon homepage:
Runs on:
Client: Windows XP (32-bit) and higher (32-bit).
Server: Windows Server 2003 (32-bit) and higher (32-bit).
In Windows Explorer, right click on portmon.exe --> select Properties --> click the Compatibility tab, and Run in Windows XP compatibility mode. It works fine like that in Windows 7 64-bit.
"Error 2" is "Cannot find the file specified", that is, cannot find a required DLL file.
Originally, you got this error when you tried to run Portmon from a network location: that broke the security trust, causing Portmon to be untrusted (or perhaps just messing up the search path somehow).
On my copy of Windows 7 64 bit, Microsoft Dependency Walker (depends.exe) tells me that PORTMSYS.SYS (the file created/loaded by Portmon.exe), has unresolved dependencies on ci.dll, clfs.sys, hal.dll and kdcom.dll.
Those are the
code integrity
common log file system
hardware abstraction layer
kernel debugger com
libraries, and they aren't actually missing: if they were, Windows wouldn't boot. However, I don't see a copy of those files in SysWow64. This suggests to me that the problem is not with portman.sys: the problem is with the win32 compatibility layer in Windows 7/64 bit: It doesn't support debug properly.
It is now 2018. There is no 64-bit version of Portmon. Serial ports are a legacy standard. The Windows 7 problem was fixed by the release of Windows 8.1. However, there is a faint chance that some Visual Studio utility or security update back-ported to Windows 7 will fix the problem. Perhaps someone who is familiar with SysWow and debugging will comment.
Instead of portmon for Windows x64, you can use an emulator of a pair of virtual COM ports and a simple program that will connect the physical port and one of the virtual ones, as well as perform the logging function.
To create a pair of virtual COM ports you can use:
com0com (preferably version "com0com-2.2.2.0-x64-fre-signed", because it contains signed x64 driver)
Virtual Serial Ports Emulator (VSPE), every time it starts on x64 it asks to purchase a driver, but it works even if you refuse.
Simple mapping and logging program can be found e.g. here or you can write it yourself, it is simple.
The sequence of actions is follows:
Сreate a pair of virtual COM ports using emulator (for example, COM28 and COM29)
Let the external device be connected to the computer COM1 port. In the program, whose exchange with external device we want to listen to, we set up a port COM28 (instead of СОМ1) for communication.
In the mapping program, we set up that we want to bind and log ports COM1 and COM29 (don't forget to set the port baud rate).
I haven't tried it yet, but this question mentions com0com. It creates two virtual serial ports and emulates a null modem cable between them. It claims to be able to run on 64 bit Windows. I'm not sure whether it comes with software that lets you just pipe input from a real port into one of the virtual ports. One of the FAQ's says that you can turn on logging.
I guess in the worst case, you could write your own small program that pipes data from a real port to one of the virtual ports and logs it all.
There's also this question on open-source alternatives that mentions a couple of projects.
I've used AccessPort
http://sudt.com/en/ap/download.htm and it works great. Very similar to Portmon
Don't start Portmon from a network drive/path or something else.
Copy on to the hard disk drive, e.g. on the desktop, restart and try again!
If you run Portmon in compatibility mode, it will work.
Check Make older programs run in this version of Windows.
It says:
To run the Program Compatibility troubleshooter:
Open the Program Compatibility troubleshooter by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type troubleshooter, and then click Troubleshooting. Under Programs, click Run programs made for previous versions of Windows.
Follow the instructions in the troubleshooter.
The above is a public explanation from Microsoft for a common situation when running older applications in Windows.
But, I can say it briefly;
Right click on portmon.exe
Select menu about "troubleshooting compatibility problem" or something like that (I'm using a foreign version of Windows, so I don't see correct name of that menu in English.)
Select automatic mode
It will detect the problem and recommend Windows XP (SP2) mode
Select it and execute Portmon again.
I hope it works!
Instead of Portmon you can also use the IO Ninja program with the "Serial Monitor" plugin.
It gives a little less information than Portmon, but in a more understandable form. The main thing is, just like a Portmon, it allows you to see the data that is transmitted between a third-party application and an external device via a serial port. The program works under modern versions of Windows (I tried it myself on Windows 10 x64). The aforementioned plugin "Serial Monitor" is paid (but has an evaluation period).
Note: the port that you want to monitor must first be connected to the "IO Ninja" program, and then opened in a third-party application whose exchange with an external device you want to track.
Just to test that the hardware is working, you could perhaps boot a Linux live CD and run the statserial and/or minicom program to verify that it works. The Knoppix distribution seems to contain both those programs.
Serial ports on Linux are named /dev/ttyS0 for COM1, /dev/ttyS1 for COM2, etc.

Resources