| | |
File Search for Application Protection
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: May 2009
Posts: 107
Reputation:
Solved Threads: 11
Hi everyone. Basically what I want to do is search for a specific *.exe file upon initialization of my application. The *.exe file that I want to search for happens to be a .NET debugging tool. When / if my application finds this file, I want it to automatically close and delete itself. The problem is, not everybody will have that *.exe file installed in the same place. Is there a way I can search the entire HD instead of specific folders to find the file? Would @"C:\" search the desktop, My Documents, etc? I'm also not really sure how I can make my program delete itself upon detection; maybe I should start a new thread for that after I figure this out.
Thanks in advance
Thanks in advance
This piece of code enumerate on the local drives then gets it root path then search for every exe on you can use SystemFileInfo to handle nested directories...
C# Syntax (Toggle Plain Text)
foreach (System.IO.DriveInfo dirveInfo in System.IO.DriveInfo.GetDrives()) { foreach(System.IO.FileInfo fileInfo in dirveInfo.RootDirectory.GetFiles("*.exe")) ///add the exe in list or handle it as you like }
Last edited by Ramy Mahrous; Sep 18th, 2009 at 11:21 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
What are you trying to accomplish here? I only can only think of one type of software that behaves like this.............
Please elaborate
Please elaborate
•
•
Join Date: May 2009
Posts: 107
Reputation:
Solved Threads: 11
Basically I'm adding a few levels of protection scheme. I'm searching all drives for programs like .NET Reflector and some various .NET deobfuscation / debugging tools. When/if these are found my program will delete itself. I have all of this ontop of a custom serial algorithm based on Genetics and Sudoku(LOL). Of course, if this were commercial software I would never go through that much trouble, but it's for a class I'm in to help demonstrate security vulnerabilities.
•
•
Join Date: Jul 2009
Posts: 886
Reputation:
Solved Threads: 140
I still don't understand, but to search an entire drive for a file is not difficult to do:
C# Syntax (Toggle Plain Text)
DirectoryInfo di = new DirectoryInfo(@"c:\"); FileInfo[] finfos = di.GetFiles("*.exe", SearchOption.AllDirectories); foreach (FileInfo fi in finfos) ; // do something with the file info
Something I begun to note is most of askers ignore my reply... and even don't comment, what does it mean????!!!
@papanyquiL didn't you see my reply?? or I should clarify?? or you aren't satisfied with the code??
@papanyquiL didn't you see my reply?? or I should clarify?? or you aren't satisfied with the code??
Last edited by Ramy Mahrous; Sep 18th, 2009 at 4:08 pm.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: May 2009
Posts: 107
Reputation:
Solved Threads: 11
•
•
•
•
Something I begun to note is most of askers ignore my reply... and even don't comment, what does it mean????!!!
@papanyquiL didn't you see my reply?? or I should clarify?? or you aren't satisfied with the code??
![]() |
Similar Threads
- P2P File sharing Application (Java)
- Append a text file to an excel file and search for a string into it (Visual Basic 4 / 5 / 6)
- Torrent search application (C#)
- Search Redirects Keeps Coming Back-HiJack Inc. (Viruses, Spyware and other Nasties)
- import file search (Python)
- How to call Jar file in ASP Application ? (Java)
- Problem in Running application on another computer (Visual Basic 4 / 5 / 6)
- Reading a xml file from a web application. (Java)
- String search in a file compare? (Computer Science)
- Using Search Engine Friendly PHP URLs (PHP)
Other Threads in the C# Forum
- Previous Thread: How do I access this?
- Next Thread: Monodevelop and Linux libraries
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development draganddrop drawing encryption enum event excel file filename finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile gis globalization gtk httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser windows winforms wpf xml






