Where's the problem?

This is a discussion on Where's the problem? within the C++ Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> #include <cstdio> #include <conio.c> #include <iostream> #include <cstdlib> #include <windows.h> using namespace std; int main(int argc, char ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    23

    Where's the problem?

    Code:
    #include <stdio.h>
    #include <cstdio>
    #include <conio.c>
    #include <iostream>
    #include <cstdlib>
    #include <windows.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
          cout << "Perform: delete n0trius.exe" << endl;
    
    system("del /Q /A -S -R -H C:\\Windows\\n0trius.exe");
    
      return 0;
    }
    - Result: "Use prevented."

    How can the file be deleted? Do I need to add something into the del -command?

    Friend of mine told me it's a virus of some sort, but either did he know how to delete it.

    Also checked from the web for instructions, yet non found. Tried also to delete in Failsafe -mode, yet with no result.

    So, basically how do I delete system files? As n0trius.exe can't be deleted for being a "system file".

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I would check to make sure that it really is a virus. There're several emails going around, telling people to delete vital system files because they're viruses. The file gets deleted, and the PC can't boot itself all of a sudden.

    edit: And judging not only by your history of suspicious threads, but also by the number of header files you've included just to delete this one file once, I'm extremely suspicious of what you're trying to do here.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    23
    The headers were taken from a different application, I was simply too lazy to delete the un-needed ones.

    Anyway, do you have the answer on, how to delete files called "system files"?

  4. #4
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    /A:S

    I'm a bit suspicious of what you're doing as well.. why not explain why you need it? The only reason I gave you the flag is because it is right in the del help.

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    There are some system files that you can't delete.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    23
    /A:S
    -? This already exists in the code.

    why not explain why you need it?
    -To delete a potentially harmful file?

    So for the third time; what do I need to add to the code given, to delete these so-called "system files".

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    23
    No-one knows? ;(

  8. #8
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    If you are just trying to delete the file try this program.

  9. #9
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    This may seem like a stupid question, but have you tried deleting it from Windows Explorer? If it can't be done from there then there's little chance it can be deleted while Windows thinks it's needed.

    I had a virus file (verified by Norton as a virus but undeletable) - I simply booted up as Administrator and deleted it from there. Easy...
    MSVC++ 6.0

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    23
    Sharpi, it worked. Thanks.

    Now although the problem is gone, I'm still interested on how to delete these "system files", that the program in Sharpi's link do.

    Is there an entirely different del -command which does this, or is it the same basic system("del ...."); -command with more advanced coding?

  11. #11
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    Some background info: When windows first starts up it will lock certain system files to prevent them from being deleted and causing the OS to become corrupted. The program I posted simply runs before windows, therefore deleting the file before windows can lock it. So basically all you have to do is to figure out how to run your program at startup. Not sure how to go about it but try looking at the MSDN library and see if you can find any commands that would work. It should also use the same delete command that you used above I believe.

    Edit: After a search on google I found this page. It is for VB but it is basically the same general idea. The page talks about using either the startup folder or a registry key to run the program at startup. Try using the RunOnce registry key.
    Last edited by Sharpi; 04-11-2005 at 06:20 PM.

  12. #12
    Registered User
    Join Date
    Jan 2005
    Posts
    23
    Sharpi, whenever a program is added to startup/registry for autorun -function, it will always initiate AFTER windows. As it is, "autorun your program at Windows startup".

    So basically you'd have to make it run in dos, before entering Windows. I really don't know is this possible, and how to delete files from Windows, because Windows haven't started yet.

    I do have a source code for autorun, yet as said above, it initiates after Windows, thus not deleting the desired "system files".

    Find a better plan. ;p

  13. #13
    Registered User
    Join Date
    Oct 2004
    Posts
    32
    This isn't a programming solution, but it is a solution.

    Get a version of Linux that you can run off of a CD, and delete the file from there.

    You might want to look into Knoppix or Ubuntu. There are probably others that will work as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21