| | |
File Search for Application Protection
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: May 2009
Posts: 108
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: 108
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: 903
Reputation:
Solved Threads: 144
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: 108
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 alignment app array barchart bitmap box broadcast c# c#gridviewcolumn cast check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datatable datetime degrees development draganddrop drawing elevated encryption enum event excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml






