473,394 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to prevent .exe running on CD or USB port

Hi.

Exe should run only PC.

Exe should not run from either CD or USB port.

Is there a way to check whether it is directory or CD or port?

Can I use File system object to solve this problem?


Regards,
Prakash.s
Oct 24 '07 #1
10 1650
For CD follow this Microsoft Link:
http://support.microsoft.com/kb/155217

For USB follow thia link:

http://features.engadget.com/2004/06...un-on-windows/
Oct 24 '07 #2
Killer42
8,435 Expert 8TB
I think the FileSystemObject will tell you a drive type, so you might be able to check that before allowing anything to happen. Specifically, go to your documentation and check out the DriveType property.
Oct 25 '07 #3
I think the FileSystemObject will tell you a drive type, so you might be able to check that before allowing anything to happen. Specifically, go to your documentation and check out the DriveType property.
I did not read the Filesystem Object.....ant thought a diff problem
Oct 26 '07 #4
kadghar
1,295 Expert 1GB
I think the FileSystemObject will tell you a drive type, so you might be able to check that before allowing anything to happen. Specifically, go to your documentation and check out the DriveType property.
But that wont prevent the EXE to be run. That'll only make it stop before it makes anything.

... but ignore me, im just suscribing here for interest.
Oct 26 '07 #5
But that wont prevent the EXE to be run. That'll only make it stop before it makes anything.

... but ignore me, im just suscribing here for interest.

Hi

I want to stop executing that's all
that means enough to throw message to user so that user can know
app is not running in CD or USB Port.


Regards

Prakash.S
Oct 26 '07 #6
9815402440
180 100+
HI
it is very simple
try to create a text file in app.path at the startup (Use file system object to create file). file name should be greater than 8 chars and it must have atleast a space in it.
if app.path refers to a cd drive then it will genrate run time error. trap this error and respond the user accordingly.

if app.path refers a pen drive, there will be no run time error and file system object dont create file on pen drives. now check the existance of the file. if file exists then it is hard drive else it is a flash drive.

regards
manpreet singh dhillon hoshiarpur
Oct 26 '07 #7
Killer42
8,435 Expert 8TB
... if app.path refers to a cd drive then it will genrate run time error ... file system object dont create file on pen drives ...
Hang on! Surely you can create a file on a CD drive if the CD is rewritable? And are you saying that the FSO cannot create files on a flash drive? That is certainly news to me!
Oct 28 '07 #8
9815402440
180 100+
hi

i am very sorry for my last post. i dont know why i wrote that fileSystemObject dont create file on pen drive. it may be in hurry.

i tried creating file on re-writable cd using FSO. but it genrates an error.

sorry once again for the wrong code.

regards
manpreet singh dhillon hoshiarpur
Oct 28 '07 #9
QVeen72
1,445 Expert 1GB
Hi,

Add Reference "Microsoft Scripting RunTime" to your Project and write this code @ runtime in MDIForm_load:


Expand|Select|Wrap|Line Numbers
  1.     Dim fso As New FileSystemObject
  2.     Dim drv As Object
  3.     Dim fileType As String
  4.     Set drv = fso.GetDrive(fso.GetDriveName(App.Path))
  5.     fileType = Choose((drv.DriveType + 1), "Unknown", "Removable", "Fixed", "Network", "CD-ROM", "RAM Disk")
  6.     MsgBox fileType
  7.     Set drv = Nothing
  8.     Set fso = Nothing
  9.  
  10.  
In above code if fileType is not Fixed, then end..


Regards
Veena
Oct 28 '07 #10
Killer42
8,435 Expert 8TB
Nice piece of work there, Qveen. Although I don't think fileType is a good name for the result, since it's misleading. Perhaps something like fileLocation would be better.
Oct 29 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bon Bon | last post by:
I am trying to run the Java PetStore Demo using clouldscape. But my default RMI registry port 1099 is taken by some other program. So I am running cloudscape on port 2001. But then the deployment...
3
by: Andrew Weaver | last post by:
How do you change the port in which CDONTS will look for Microsoft SMTP server? I have Imail running on port 25, and I have SMTP service running on port 26. Any help you can provide me would be...
7
by: VB Programmer | last post by:
I have both ASP.NET 1.1 and 2.0 on my system. Most of my sites are 1.1. All of a sudden when I load any solution I get this error: VS.NET has detected that the specified Web server is not...
7
by: pradeep_TP | last post by:
hello all, I want to know how can I check whether a web site us running or not. I have used HttpWebRequest but when I give a web site address, It takes few number of seconds to throw exception...
6
by: tommaso.gastaldi | last post by:
Hi I am creating a pdf by just printing on Acrobat Distiller. This is fine. I need to create a pdf which has a given prespecified name and I do not wish that Distiller prompts me for a name....
10
by: TS | last post by:
i just noticed the website i created in VS 2005 is running on a different port than the default. I see that it is running on the local web server, and also that the website i created isn't in IIS....
2
by: comp.lang.php | last post by:
I came up with functions that I thought would do the trick: if (!function_exists('smtp_close')) { /** * This function will close a socket resource handle * * Original function found at...
4
by: David | last post by:
Is the Development Server part of the .net 2x runtime package or installed with one installs VS 2005? I wish to run a small web app on a machine, with the runtime installed, and need to know if I...
3
by: chernevik | last post by:
Here is a newbie question: how do I get the server examples in the Preview chapter of "Progamming Python" (Lutz) to run? The code is supposed to be a little webserver on which to run examples,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.