Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Tuesday, February 14, 2017

Troubleshooting Apple ITunes Update on Microsoft Windows

ITunes update on my Windows 7 PC. It had to be a trivial task... at least in theory. The only thing to do was just double clicking on the newest version of ITunes installer I downloaded before and waiting until it finished its job. You know, sometimes the reality goes beyond any imagination.

During the installation I got this error and as a result the entire update aborted.

"There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor".

Apple, aka the inventor of user friendliness, was telling me something cryptic: "a program required for this install to complete could not be run". Now, my first question was: which program? But no info was given about.

Dear Apple, sometimes I guess you deliver these riddles to Windows users in the hope to converting them to your platform, where everything is wonderful and these error messages do non exist just because all is working like a charm. Well... I like riddles.

So, after an entire week-end spent on it, I discovered the solution. Which program caused this error message? Apple Software Update. It was missing or not properly installed on my PC.

These are the steps to follow for solving the error and to install ITunes correctly.

From Add or remove programs panel uninstall these programs in this exact sequence.

  1. ITunes
  2. Apple Software Update (if not present, just skip this step)
  3. Apple Mobile Service Support
  4. Bonjour
  5. Apple Application Support (32 bit)
  6. Apple Application Support (64 bit)
Now install ITunes.

If the error still appears, open Add or remove programs panel. Right click on Apple Software Update (now it has to be present) and choose repair.

Run the ITunes installer again. Now it should complete with no errors.

Hope this help.

Saturday, January 31, 2009

Flash Player SecurityError: Error #2060

This post starts with a security error echoed by Flash Player: I'm talking about Error #2060, an error that is associated with the use of ExternalInterface.call.

For those of you that just don't remember what ExternalInterface is responsible of, I have to say that this class allows ActionScript to "talk" with the Flash Player container: in my current example, I was calling a JavaScript function from inside ActionScript. My idea was to allow ActionScript to run a user-specified Windows program through the intermediation of the ActiveX WScript.Shell, instantiated in a IE-managed HTML page.

So, the code for the ActionScript part looked like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="402" height="22"
backgroundColor="white">
<mx:Script>
<![CDATA[
private static const JS_FUNCTION_NAME: String = "jsRunProgram";

private function callExternalProgram(programName:String):void {
if (ExternalInterface.available) {
ExternalInterface.call(JS_FUNCTION_NAME, programName);
}
}
]]>
</mx:Script>
<mx:Label text="External program to call:"
y="0"
fontWeight="bold"/>
<mx:TextInput id="txtProgramName"
text="notepad"
x="151" y="-2" width="198"
enter="callExternalProgram(txtProgramName.text)"/>
<mx:Button label="Run" x="352" y="-2"
click="callExternalProgram(txtProgramName.text)"/>
</mx:Application>

... and inside HTML page I had this JavaScript fragment:
<script language="javascript" >
function jsRunProgram(programName) {
shellObj = new ActiveXObject("WScript.Shell");
shellObj.run(programName);
}
</script>

The idea here is not obvious, but pretty simple: the user enters a program name in a Flex TextInput, then presses the Enter key and voilĂ ... ActionScript calls the JavaScript function jsRunProgram providing it with the text just entered by the user. JavaScript, in turn, instantiates the ActiveX WScript.Shell and instructs it to run the program entered by the user. This way, ActionScript can run every Windows program the user typed: notepad, iexplore, cmd... just to name a few.

I developed this solution inside Adobe Flex Builder. Now, when I opened
inside the Flex Builder browser the HTML page containing the Flash control corresponding to the ActionScript code, all ran as expected. Cool!

The surprise came out when I closed the Flex Builder browser and tried to open the same page in IE. I couldn't believe my eyes: everytime ActionScript tried to call JavaScript a Flash error popped out complaining about error 2060: Security sandbox violation.

This behavior sounded so unbelievable to me for several reasons:
  1. Inside Flex Builder browser it ran without problems
  2. I couldn't imagine why Flash player had security concerns for accessing its containing HTML page.
I spent about a half weekend finding a solution.

Firstly, I browsed the Internet and I discovered that the same problem is not so uncommon. Some people suggest to deploy all the files in a web sever and, instead of accessing the HTML page via file system, access it via a HTTP connection to the web server. They say it works, but I was not interested in that solution primarily because I didn't want to introduce a web server.
So I didn't try that solution.

I found two different solutions.

The first:
  1. Change Flash Player security settings to allow it to access the local directory containing the HTML page. (To change Flash Player settings it's required to call this URL)
  2. Change IE security settings to allow the use of ActiveX WScript.Shell
The second:
  1. Rename the HTML page to HTA.

How to call a program as Windows service

It's really easy to call a program as a Windows service.
In order to proceed, you firstly need two programs: instsrv.exe and srvany.exe. These programs are produced by Microsoft and are parts of Windows Resource Kit Tools.

To call a program as a new Windows service, follow this procedure:
  1. Create a new directory, let's say winsrv, on drive c
  2. Store both instsrv.exe and srvany.exe on that directory
  3. Open a DOS window
  4. Type: cd /d c:\winsrv
  5. Type: instsrv "service name" c:\winsrv\srvany.exe
  6. Exit from DOS window
  7. Open regedit
  8. Navigate to this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
  9. Add a new key: Parameters
  10. Under the key Parameters, add these three string values: Application AppDirectory AppParameters
  11. Set the AppDirectory value to the directory where the program is stored into
  12. Set the Application value to the program name
  13. Set the AppParameters value to the command line parameters passed in program invocation
NOTE
In order to run the specified program, you may provide additional authentication information. This can be accomplished specifying log on parameters in the service properties.

To remove the new service, just follow this procedure:
  1. Open a DOS window
  2. Type cd /d c:\winsrv
  3. Type instsrv "service name" remove

Sunday, November 23, 2008

How to configure ToggleNic.exe to work with Windows XP italian

ToggleNic is a useful Windows tool for enabling and disabling network connections from the command prompt. It can be downloaded here.

After installation, ToggleNic is configured (by default) to run with the english version of Windows: in other words, it doesn't work with localized Windows version, like mine (italian).

In order to let it work with a localized Windows version, all you need to do is to modify the file ToggleNic.exe.config found inside ToggleNic installation folder.

This config file is a simple XML-based configuration file. Specifically, you need to look at (and change properly) these settings:
  • NetworkConnectionsFolderName
  • EnableVerbName
  • DisableVerbName
These items respectively collect: the localized names of network connections folder, the menu item corresponding to "enable connection" and the menu item corresponding to "disable connection". Obviously, for a localized Windows version, they cannot be like those in the default configuration.

For the italian version of Windows XP, I've checked the following values work.
  • NetworkConnectionsFolderName: Connessioni di rete
  • EnableVerbName: &amp;Abilita
  • DisableVerbName: &amp;Disabilita

Please notice the &amp; at the start of EnableVerbName and DisableVerbName: it's because menu items are provided with a keybord shortcut. (That's what &amp is meaning for).

A useful site for getting info on Windows processes

Sometimes it happens you don't know what a Windows running process is needed to or whether it's a normal Windows process or something different.

The Process Library site has a huge database of information about processes. So when in dubt...

When a good antivirus turns into a terrible virus

Some nights ago I was involved in an unexpected adventure: back at home after a day of work, I turned on my Windows XP laptop and after logging in I was alerted by AVG antivirus 8 Free edition that the file "user32.dll" contained a troian.

Although quite surprised, I didn't hesitate a moment and let my antivirus move the infected file into its vault.

It was a really bad move, because, after restarting, I wasn't able to start Windows XP anymore: a blue screen of death appeared regularly shortly after each restart and the computer booted up again coming at the blue screen of death and then restarting again.

I fought against this problem for about one hour, trying to find a way to get my "user32.dll" back in the right place. Finally, I came up with a solution: I booted from a Linux-live distro, then I copied the user32.dll under system32\dllcache into system32.

Now, thanks to Linux my Windows XP is back again. It's frightening to think that a good antivirus - as I consider AVG - turned suddenly into a terrible virus. For more information, check this out.

BTW during my Linux session I noticed Firefox is about 1.5x faster than the same version under Windows. I'm asking myself why I'm still using Windows...