On one of the recent updates, Microsoft removed the setting on the Context menu to submit individual files to the MSE... (checking for viruses, trojans etc... on selected files) So, I am trying to build an app, which will let me drag a file to a VFP app to do the same. When I use the Run command it works just fine. But trying to implement the ShellExecute I seem to run into briers. In the code below I use both techniques.
As I said, the RUN Command works just fine.
On the ShellExecute line I get this error which appears for a fleeting moment and I had to use a camera to catch the error:
So like a good boy I go to that log file and fetched the log recording of the failed command, whose command line is supposedly invalid.
The funny thing is that if I take that Command Line as it is recorded in the Log file and run it into the CMD window to test how it fails, IT WORKS PERFECT! And, yes, I am piping the result to a file called F:\A_A\FileVirusCheck.danny.
Trump was right... It is all fixed behind the curtains... .
Please help...
Dennis Kean
Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
Code:
* Test file for viruses and bugs with MSE, now that they removed the right click ability to test individual files.
? FileVirusCheck()
FUNCTION FileVirusCheck
LPARAMETERS cFileName, cDirectory, cOptions, pathFile, resultFilePath
LOCAL cOpts
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
cAction = "open"
cFileName = "C:\Program Files\Microsoft Security Client\MpCmdRun.exe "
cDirectory = ""
cOptions = "-Scan -ScanType 3 -File "
pathFile = "C:\Users\Dennis\Desktop\CH341SER.EXE "
resultFilePath = " > "+SYS(5)+ CURDIR()+"FileVirusCheck.danny" && LOCAL path where the result file should be created
cOpts= cOptions + pathFile + resultFilePath
CMD = cDirectory + cFileName + cOpts
RUN &CMD && THIS WORKS FINE
ShellExecute(0,cAction,cFileName,cOpts,cDirectory,1) && THIS FAILS NO MATTER WHAT I TRY
*MODIFY FILE safetyTest.danny
RETURN FILETOSTR(SYS(5)+ CURDIR()+"FileVirusCheck.danny")
ENDFUNC
As I said, the RUN Command works just fine.
On the ShellExecute line I get this error which appears for a fleeting moment and I had to use a camera to catch the error:
ERROR said:Bad Command Line - Command Line - Option should start with '-' or '/'
CmdTool: Failed with hr = 0x80070667. Check C:\Users\Dennis\AppData\Local\Temp\McmdTool.log for more information:
CmdTool: Invalid command line argument
So like a good boy I go to that log file and fetched the log recording of the failed command, whose command line is supposedly invalid.
Log file listing said:-------------------------------------------------------------------------------------
MpCmdRun: Command Line: "C:\Program Files\Microsoft Security Client\MpCmdRun.exe" -Scan -ScanType 3 -File C:\Users\Dennis\Desktop\CH341SER.EXE > F:\A_A\FileVirusCheck.danny
Start Time: Thu Nov 17 2016 16:31:57
MpCmdRun: End Time: Thu Nov 17 2016 16:31:57
-------------------------------------------------------------------------------------
The funny thing is that if I take that Command Line as it is recorded in the Log file and run it into the CMD window to test how it fails, IT WORKS PERFECT! And, yes, I am piping the result to a file called F:\A_A\FileVirusCheck.danny.
Trump was right... It is all fixed behind the curtains... .
Please help...
Dennis Kean
Simplicity is the extreme degree of sophistication.
Leonardo da Vinci