Launching an exe from firefox extension in Vista with UAC on - Mozilla

This is a discussion on Launching an exe from firefox extension in Vista with UAC on - Mozilla ; I am launching googletalk.exe from the firefox extension using the nSIProcess object. here is the code: var process = Components.classes["@mozilla.org/process/util; 1"].createInstance(Components.interfaces.nsIProcess); process.init(googletalkpath); var args = [""]; try{ process.run(false, args, args.length); }catch(e){alert(e.message);} This is running fine in Windows xp, but when ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Launching an exe from firefox extension in Vista with UAC on

  1. Launching an exe from firefox extension in Vista with UAC on

    I am launching googletalk.exe from the firefox extension using the
    nSIProcess object.

    here is the code:
    var process = Components.classes["@mozilla.org/process/util;
    1"].createInstance(Components.interfaces.nsIProcess);
    process.init(googletalkpath);

    var args = [""];
    try{
    process.run(false, args, args.length);
    }catch(e){alert(e.message);}

    This is running fine in Windows xp, but when I am trying this on Vista
    with UAC(User Account
    Control) on. I am not able to run the googletalk.exe. It throws a
    "ns_error_file_execution_failed" error.
    It does not even show the UAC message asking the user whether he wants
    to run the exe or not. Is there any way to make sure it shows the UAC
    message?? So that the user may click on continue to run the exe.

  2. Re: Launching an exe from firefox extension in Vista with UAC on

    On Nov 25, 12:28*am, Robert Strong wrote:
    > Instead of using nsIProcess which uses CreateProcess you should use the
    > launch method provided by nsILocalFile. The launch method will use
    > ShellExecute which honors the binary file's manifest.
    >
    > Robert
    >
    > On 11/24/2008 2:19 AM, soume...@gmail.com wrote:
    >
    > > I am launching googletalk.exe from the firefox extension using the
    > > nSIProcess object.

    >
    > > here is the code:
    > > * * * * * *var process = Components.classes["@mozilla.org/process/util;
    > > 1"].createInstance(Components.interfaces.nsIProcess);
    > > * * * * * *process.init(googletalkpath);

    >
    > > * * * * * *var args = [""];
    > > * * * * * *try{
    > > * * * * * *process.run(false, args, args.length);
    > > * * * * * *}catch(e){alert(e.message);}

    >
    > > This is running fine in Windows xp, but when I am trying this on Vista
    > > with UAC(User Account
    > > Control) on. I am not able to run the googletalk.exe. It throws a
    > > "ns_error_file_execution_failed" error.
    > > It does not even show the UAC message asking the user whether he wants
    > > to run the exe or not. Is there any way to make sure it shows the UAC
    > > message?? So that the user may click on continue to run the exe.
    > > _______________________________________________
    > > dev-extensions mailing list
    > > dev-extensi...@lists.mozilla.org
    > >https://lists.mozilla.org/listinfo/dev-extensions



    But I need to call googletalk with commandline arguments like
    "googletalk.exe /mailto". That was the reason I was using nSIProcess
    object. I am assuming this cannot be done with "nsILocalFile.launch
    ()".
    I tried creating a batch file "temp.bat" with the below lines and
    running it.

    googletalk.exe /mailto

    When I do this the batch file runs but the googletalk.exe fails.
    Is there any other way?

  3. Re: Launching an exe from firefox extension in Vista with UAC on

    On Nov 25, 2:56*pm, Robert Strong wrote:
    > On 11/25/2008 1:04 AM, SS wrote:> But I need to call googletalk with commandline arguments like
    > > "googletalk.exe /mailto". That was the reason I was using nSIProcess
    > > object. I am assuming this cannot be done with "nsILocalFile.launch
    > > ()".
    > > I tried creating a batch file "temp.bat" with the below lines and
    > > running it.

    >
    > > googletalk.exe /mailto

    >
    > > When I do this the batch file runs but the googletalk.exe fails.
    > > Is there any other way?

    >
    > You would most likely need to create your own component to launch the
    > exe using ShellExecute though it might be possible to come up with a
    > different way to do this though I personally wouldn't recommend it.
    > Using the batch file example perhaps setting it to always run as admin
    > might work and there are probably other ways.
    >
    > Also, you might be able to accomplish this with a JS component using
    > JSctypes and thereby avoid having to create a binary component https://wiki.mozilla.org/JSctypes
    >
    > I've looked at making nsIProcess use ShellExecute but there are other
    > requirements for nsIProcess that make it a significant amount of work to
    > take on.
    >
    > Robert


    My knowledge regarding this is limited, so I needed some clarification
    on this post:

    > Calling ShellExecute from my code:

    How can I this be done? Can I call it directly from javascript? do I
    need to write a xpcom object that in turn calls ShellExecute ?

    > JS component using JSctypes

    It is not available with my current Firefox executable. how do i get
    this jscomponent? Can i package it with my xpi?

+ Reply to Thread