I have downloaded a Window Gadget and found this function from the javascript. What this function does? Is it malicious?
Before I run the Widget, I commented out first the function call and it seems this function is not necessary to run the widget.
function LaunchPowerApplet()
{
System.Shell.execute(System.Environment.getEnvironmentVariable("SystemRoot") + "\\system32\\mblctr.exe");
}
System.Shell.execute is a method from the Windows Sidebar API that is used to launch an application.
%WINDIR%\system32\mblctr.exe
is the executable for the Windows Mobility Center, a tool that «puts commonly used laptop settings in one spot so you can access them easily on the go».
Whether it's necessary or not is hard to say without knowing what the gadget needs to accomplish. The function is called LaunchPowerApplet
and Windows Mobility Center allows to configure the battery usage settings. It makes sense if the gadget is a battery level meter, it doesn't if it's a solitaire.
BTW, a gadget is «a collection of XML, HTML, Microsoft JScript, and Cascading Style Sheets (CSS) files» so it's technically not JavaScript but JScript (Microsoft's ECMAScript implementation)