Obtain msiexec command line at install custom action (vs setup project) - c++

I'm wondering if there is an option to obtain msiexec command line at "install" custom action (we use vs2008 "setup project" for the installer).
We know that we can access "CustomActionData" parameters but if we run the following command:
msiexec /i demo.msi /quiet user=test log=true
we know how to access "CustomActionData" parameters (user=test log=true), but we don't know how to access whole msiexec command line parameters (including "/i /quiet")...
Is it even possible because in Process Monitor we can see that at install action, this msiexec process (running as SYSTEM) is run with command the following command:
C:\Windows\system32\MsiExec.exe -Embedding 3E439F7DA7DE174205150FEBCEB7B14F E Global\MSI0000
So, is it possible to obtain "msiexec" command line parameters inside the installer (c++) code?

Related

How can I debug a C program installed using guix?

I installed flatpak using guix, but it segfaulted on startup. I wanted to debug it, but guix installs a wrapper script for flatpak, so I get this error when trying to run it under gdb:
"/home/user/.guix-profile/bin/flatpak": not in executable format: file format not recognized
and I tried to edit the wrapper script to call gdb, but this wrapper script is not even editable by root, because it is owned by root and has read-only permissions.
Simply copy the script to your current working directory:
cp /home/user/.guix-profile/bin/flatpak .
Mark it as writable:
chmod +w flatpak
Edit the script with your favourite text editor, to replace the string exec -a with exec gdb --args.
And finally, run it with any arguments you provided before, when it misbehaved:
./flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo
In this particular case, this wasn't immediately super-useful, because a debug symbol output hasn't been built for this package. But at least I could get a backtrace out of gdb.

Visual Studio cross platform makefile project, command not found

I'm trying to build a cross platform project for Ubuntu. In my makefile I have the line
"PSPSDK=$(shell psp-config --pspsdk-path)"
which gives the error "psp-config: Command not found."
psp-config is in my path and running make from the Ubuntu system on the files that get copied over from Visual Studio works fine. It also works if I manually ssh into the Ubuntu system from windows and run the command from there.
Why can't it find the command when run through Visual Studio?
You should update PATH at the beginning of "~/.bashrc" file (and not at the end) because it starts with somethign like:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Also, if you add code before these lines, it will be invoked for every subshell execution, so it is better to add a guard for it as well so it is invoked only once per session:
if [ -z $HOME_OPT_PATH_SET ]; then
export PATH=$PATH:$HOME/opt
export HOME_OPT_PATH_SET=1
fi
# If not running interactively, don't do anything
...

'cmake' is not recognised as an internal or external command - Polaris

My clone project path from github "C:\Users\Addy\Documents\polaris\"
I have created build directory "C:\Users\Addy\Documents\polaris\build"
From cmd.exe I access build directory path "C:\Users\Addy\Documents\polaris\build"
And run this command
"cmake -G "Visual Studio 10 Win64" -DCMAKE_CONFIGURATION_TYPES=Release;Debug .."
I am running this command on windows7 cmd. But it gives me the error.
**'cmake' is not recognised as an internal or external command**
As per the steps given in the
website(https://github.com/anl-polaris/polaris/wiki/Getting-Started)
It sounds like you don't have cmake in your path variables. Simple test, type 'echo %PATH%' in the command prompt, this will list all paths your OS will look for the executable in. If you can't see a path to your cmake executable then you need to add it.
Control Panel >> System >> Advanced System settings (left side on windows 10), too bring up the 'System Properties' window. In this window select 'Environmental Variables' to bring up a new window, then scroll down to PATH and enter the path to cmake.exe, click OK and close all windows to secure new settings.
On some versions of Windows this operation requires a restart before it takes affect, others you just need to open a new command prompt. I would start my opening a new command prompt and reentering 'echo %PATH%' command, looking for the new cmake path, if it's not here then restart Windows.

'sc' is not recognized as an internal or external command

I am trying to create a svnserver using cmd after i changed svnserve.conf by uncommenting the following lines in the file,
anon-access = read
auth-access = write
command execute in cmd is,
sc create svnserver binpath= "C:\Program Files\TortoiseSVN\bin\svnserve.exe --service -r c:\Goods\Repo" DisplayName= "Subversion" depend= tcpip start= auto
but i am getting error
'sc' is not recognized as an internal or external command
I am not sure what i am doing wrong. I have installed tortoise SVN Client and Visual SVN Server.
Can someone please let me know what i am missing here.
you will need to add the path to sc.exe ("c:\windows\system32\") in your Path environment variable. Do this by hitting windows key + Pause|Break then selecting advanced system settings - environment variables is at the bottom. Just add an extra entry after the last - separated by semi-colons. If this isn't possible, simply give the command the full path of sc.exe e.g.
"c:\windows\system32\sc.exe" create svnserver....

Execute shell command in c++

I have a question regarding executing shell commands in c++. I'm building an application in winforms, vs 2008. My application has a button, when clicked should decode a binary file to a .csv file. I can decode files by first going to the right directory (cd Test_Copy2) and then execute a command in the command prompt (java -jar tool.jar -b x.fit x.csv). I tried a lot of different stuff but unfortunately got none to work!
I tried using:
system, _popen, ShellExecute(NULL, L"open", L"C:\\WINDOWS\\system32\\cmd.exe ", L"java -jar Tool.jar -b x.fit x.csv", L"C:\\Test_Copy2", SW_SHOWNORMAL)
Can anyone please provide me with an example on how to do that? I dont know where I'm going wrong, most of the time the command prompt opens but no command is executed!
If you really want to run the jar in a cmd.exe instance, you need to add one of the correct command line switches to cmd.exe for it to work the way you want it to:
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
For instance, your command string should be:
C:\\WINDOWS\\system32\\cmd.exe /c java -jar Tool.jar -b x.fit x.csv
You can use the system() function to execute shell commands.
For example:
system("DIR") executes the DIR command in the CMD shell. The default directory at the start is the directory you're .exe file is located.
'system("PAUSE")` executes the PAUSE command.
The command/s you wannt to execute should be passed as a constant string to the function.
Edit:
For you paritcular program the syntax (IMO) would be:
system("java -jar Tool.jar -b x.fit x.csv")