Recently I've made some investigation of how FAR executes files (on ENTER, shift+ENTER, cmd line).
For files ending with good extension (.exe, .com. bat) FAR makes a CreateProcess API call with parameters:
"C:\windows\system32\cmdexe /C program.exe" (program.exe = executed file).
This is rather good.
But for every other file (not ending with .exe, .com, ...) FAR makes a ShellExecuteEx API call.
This is particulary good, because CreateProcess cann't execute documents for example.
The problem is that I've disabled "Traverse Folder / Execute File" NTFS permission on some files (mostly .exe files) so I cann't execute them accidently.
With FAR this works fine for .exe files (because of that CreateProcess). But for documents and other files this doesn't work, because ShellExecuteEx don't execute documents directly.
So my idea is to execute all files using CreateProcess, with parameter "C:\windows\system32\cmdexe /C file params".
This woul'd help in my case and I think it is a better solution in general (so users can disable execution of any file).
Another way of executing files
geordi
I think you got something wrong. Document files are never executed (they just can't be) they only get opened (read) by the program that works with them - so in reallity the program that can read such files is the one that is executed. So setting the execute permission for documents has no real value. And second of all CreateProcess has nothing to do with opening documents.
I think you got something wrong. Document files are never executed (they just can't be) they only get opened (read) by the program that works with them - so in reallity the program that can read such files is the one that is executed. So setting the execute permission for documents has no real value. And second of all CreateProcess has nothing to do with opening documents.
Sorry, maybe I explained it badly.
I know how things work
I try to describe what happens when you do something like this:
cmdexe /C document.txt
Cmdexe tries to call CreateProcess(document.txt, ...). It will fail obviously. But GetLastError returns error 0xC1 and so cmdexe tries to call ShellExecuteEx, which works in standard way (finds associated program and runs it with parameter document.txt).
And when permissions of that document.txt are set with "Execute File" disabled, CreateProcess will fail, but GetLastError returns 0x05 (acces denied).
So that's the difference.
And I want to suggest you to do it the same way in FAR.
I know how things work
I try to describe what happens when you do something like this:
cmdexe /C document.txt
Cmdexe tries to call CreateProcess(document.txt, ...). It will fail obviously. But GetLastError returns error 0xC1 and so cmdexe tries to call ShellExecuteEx, which works in standard way (finds associated program and runs it with parameter document.txt).
And when permissions of that document.txt are set with "Execute File" disabled, CreateProcess will fail, but GetLastError returns 0x05 (acces denied).
So that's the difference.
And I want to suggest you to do it the same way in FAR.
Look, I'm working in an antivirus company, so I know much about security and how to handle such "hot" files. But NTFS file system (with it's permissions) gives us posibility to make manipulation with viruses and malware even safer.
We are using FAR for a long time because it is best file manager for things we do. And I saw some progress in FAR development recently (1.70 final, 1.71 alpha ...). So I want to ask if this is technically problem to slightly change the way FAR executes files.
That's all.
We are using FAR for a long time because it is best file manager for things we do. And I saw some progress in FAR development recently (1.70 final, 1.71 alpha ...). So I want to ask if this is technically problem to slightly change the way FAR executes files.
That's all.