mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
#34398 06/07/03 07:02 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i know, i admit it im wrong, and i shouldnt of posted in the 1st place.


new username: tidy_trax
#34399 07/07/03 07:33 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Actually, I agree with saxon and there are ways to determine if /run can execute a file before it actually executes the file with ShellExecute.

First you'd check the system PATH to see if the file can be found ($ispath would be cool). If a file is located then trace the file extension through the registry to see if it's associated with an application or not (I believe an API exists for this even). Then you would test if the file is locked by the system by attempting to OPEN the file (doesn't have to physically read it, just requests permission to access it). If the OPEN fails, then /run is certain to fail aswell.

Granted, it would be impossible to cover all possible errors... eg: WinZip Error "File Appears Corrupt", could not possibly be anticipated... but the file still successfully /ran, and that's all that $run needs to do.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#34400 07/07/03 03:12 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Association does not imply execution. For example, I have an association setup for .a23 files, however all the association does is make it so an icon is displayed for a23 files, if I click the file I get the standard "select a program" dialog box. File associations do not determine whether a file can be executed. And opening a file doesn't test a lock. I can lock bytes 23 through 29. Opening it will succeed, however when I try to read bytes 23 through 29 that will fail.

#34401 07/07/03 03:19 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Files which are only associated for an icon don't have a 'command' folder with a value pointing to an application or reference. This is an obvious distinction that would be looked for.

files that are locked surely have some way to test for this regardless of what parts are locked.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#34402 11/07/03 04:28 PM
Joined: Jun 2003
Posts: 195
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
From MSDN

GetBinaryType

The GetBinaryType function determines whether a file is executable, and if so, what type of executable file it is. That last property determines which subsystem an executable file runs under

BOOL GetBinaryType(
LPCTSTR lpApplicationName,
LPDWORD lpBinaryType
);

Wouldnt this be exactly what you want the $run identifier to do?


Have Fun smile
#34403 12/07/03 01:25 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Yep. grin
And any other "if file cannot be accessed" checks that might be possible.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Page 2 of 2 1 2

Link Copied to Clipboard