locked
Run a service installation program from a process RRS feed

  • Question

  • Hi,

    The InstallPnP.exe is a program to install a windows service. If run the program fro the folder where is, it can successfully install the service. when run "installPnP.exe" from a process in my application, it failed on install the service.

    My PC OS is Windows 7 Pro 32 bit.  VS .net 2010 Pro. My application program using .net 4.

    My code is:

    Example 1:

    Diagnostics::Process^ pDriver = Process::Start(pDriverPath);

    Example 2:

    Diagnostics::Process^ pDriver = gcnew Process();

    pDriver->StartInfo->WindowStyle = ProcessWindowStyle::Normal;

    pDriver->StartInfo->FileName = pDriverPath;

    pDriver->StartInfo->UseShellExecute = false

    ;

    pDriver->StartInfo->RedirectStandardOutput = true

    ;

    pDriver->StartInfo->RedirectStandardError = true;

    pDriver->StartInfo->Verb = "runas";

    pDriver->StartInfo->LoadUserProfile = true

    ;

    pDriver->Start();

     

    Both examples are not work. when click install button on the window of the installPnP.exe program. It produce an error message as: Error Copying service.exe! please refer to the following screen capture.

    

    Thank you for your help.

     

    

    

     

     





    • Edited by CWXie Monday, September 5, 2011 11:09 AM
    Monday, September 5, 2011 10:58 AM

All replies

  • Ofcourse! The process needs admin priviledge to install a service at minimum. If you are sure that your process has the required elevated priviledge, then you should use a tool like procmon or process explorer to find out the exact problem. You likely don't have that problem because when you run the application from a folder, you have admin privileges on the machine.
    Wednesday, September 7, 2011 5:21 PM
  • Hi Thank you for your information.

    I will install the tool you suggested and try again.

    Monday, September 12, 2011 3:55 PM
  • Hi Vapor,

    Based on your suggestion, I use procmon tool captured the information for both case and found the difference of run "installPnP.exe" from a folder and from a process in my application file.

    In the start up procedure of run  "installPnP.exe" from folder, it query a lots of file open, such as: hid.dll, dwmapi.dll, profapi.dll, etc.. and also copied the file "netemppnp.exe" from the folder of the  "installPnP.exe" file folder into system32 folder.

    In the start up procedure of run  "installPnP.exe" from my application program, it does not query lots of file open as above. it also did not copy the  file "netemppnp.exe" from the folder of the  "installPnP.exe" file folder into system32 folder.

    Do you know how to sort this out?

     

     

     

    Tuesday, September 13, 2011 9:46 AM