-1

Consider the command line:

"c:\Program Files (x86)\WiX Toolset v3.9\bin\dark.exe" -out "d:\Test\Product.wxs" "d:\Test\Setup.msi" -ext "c:\Program Files (x86)\WiX Toolset v3.9\bin\WixUIExtension.dll" -x "d:\Test\Bin"

which successfully "decompiles" an in installer a "Product.wxs" file. I have to write a C# function that parametrizes the command line with the installer file. I wrote the following code:

 string Path = "C:\\Program Files (x86)\\WiX Toolset v3.9\\bin\\dark.exe";
 string Args = "D:\\Test\\Setup.msi -out D:\\Test\\Product.wxs -x D:\\Test\\Bin -ext C:\\Program Files (x86)\\WiX Toolset v3.9\\bin\\WixUIExtension.dll";
 Process pi = Process.Start(Path, Args);

But Process.Start function returns a Process whose MainModule throws a Win32 Exception, with message:

Only part of a ReadProcessMemory or WriteProcessMemory request was completed

Where is the error, and how can I fix it?

Solved!
If Args == "\"D:\\Test\\Setup.msi\" -out \"D:\\Test\\Product.wxs\" -x \"D:\\Test\\Bin\" -ext \"C:\\Program Files (x86)\\WiX Toolset v3.9\\bin\\WixUIExtension.dll\"" the programs works

Costanzo Ferraro
  • 169
  • 2
  • 12
  • What OS? It seems you are trying to mix 32/64 bit processes, see [this](https://stackoverflow.com/a/11134981/1997232). – Sinatr Nov 09 '17 at 09:09
  • Windows 7 Professional – Costanzo Ferraro Nov 09 '17 at 09:30
  • Try to change CPU of project where you starting process. [Set explicitly](https://stackoverflow.com/a/20909087/1997232) 32 bit (x86) or 64 bit and tell results. – Sinatr Nov 09 '17 at 10:16
  • @Sinatr, if I change the CPU of Project to 32 bit, `Process.Start` function calls a **Win32 Exception** with message _A 32 bit processes cannot access modules of a 64 bit process_. On the other hand, if I change CPU of protect to 64 bit, `Process.Start` calls the first Exception ! – Costanzo Ferraro Nov 10 '17 at 11:04
  • What happens when you comment out the line `Process pi = Process.Start(Path, Args);`? In other words, I suspect you aren't showing the relevant code. – Tom Blodget Nov 10 '17 at 22:22
  • @TomBlodget, you are right! If in `Args` I delete _-ext "c:\Program Files (x86)\WiX Toolset v3.9\bin\WixUIExtension.dll_, my function runs successfully! It looks like that `Process.Start` cannot access to the DLL. How can I fix it? – Costanzo Ferraro Nov 14 '17 at 13:11
  • I still don't follow how you can see the error you are getting with the code you are showing but try removing the trailing \ from D:\Test\\Bin\ – Tom Blodget Nov 14 '17 at 15:07
  • @TomBlodget, debugging my Program, I have just discovered that my question was wrong! Now I edited it,. Could you look at that? Thanks ! – Costanzo Ferraro Nov 28 '17 at 10:44
  • You still haven't added the code that causes the error nor the full exception so I can't go forward. – Tom Blodget Nov 28 '17 at 21:22

1 Answers1

0

Your command lines are not the same. Put the same command line into the Process.Start that you executed successfully. The command lines in your C# application are missing all the quotation marks. Add them and it should work.

nvoigt
  • 75,013
  • 26
  • 93
  • 142