Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to delete a file in AlluserProfile directory?

How to delete a file in AlluserProfile directory?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++jsontutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 0 Offline
    0 Offline
    0x8085
    wrote on last edited by
    #1

    Hi, I am newbie to vc++,So kindly bare with me. Some malicious exe file running in a folder c:\documentsandsetting\alluser\globel\phunk.exe I have killed the phunk.exe from the process and now i want to delete the file phunk.exe from the folder. how can i implement GetAllUsersProfileDirectory() APi to delete the file please can anyone put the same code for the above scenario.

    A C 2 Replies Last reply
    0
    • 0 0x8085

      Hi, I am newbie to vc++,So kindly bare with me. Some malicious exe file running in a folder c:\documentsandsetting\alluser\globel\phunk.exe I have killed the phunk.exe from the process and now i want to delete the file phunk.exe from the folder. how can i implement GetAllUsersProfileDirectory() APi to delete the file please can anyone put the same code for the above scenario.

      A Offline
      A Offline
      Aescleal
      wrote on last edited by
      #2

      Not an answer to your question, but when you say "kindly bare with me" it sounds like you're asking the reader to get naked with you. You need to use the spelling "bear" which means the big fuzzy ursine critters as well as carrying something. It's an easy mistake to make - quite a few Americans I know keep saying they support the right to bare arms, which is fairly non-controversial if you use sun-screen. Cheers, Ash

      0 1 Reply Last reply
      0
      • A Aescleal

        Not an answer to your question, but when you say "kindly bare with me" it sounds like you're asking the reader to get naked with you. You need to use the spelling "bear" which means the big fuzzy ursine critters as well as carrying something. It's an easy mistake to make - quite a few Americans I know keep saying they support the right to bare arms, which is fairly non-controversial if you use sun-screen. Cheers, Ash

        0 Offline
        0 Offline
        0x8085
        wrote on last edited by
        #3

        hi i am very sorry for my bad englsih...

        A 1 Reply Last reply
        0
        • 0 0x8085

          hi i am very sorry for my bad englsih...

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          No probs, wasn't a dig at your standard of English - it's an easy mistake to make. Ash

          1 Reply Last reply
          0
          • 0 0x8085

            Hi, I am newbie to vc++,So kindly bare with me. Some malicious exe file running in a folder c:\documentsandsetting\alluser\globel\phunk.exe I have killed the phunk.exe from the process and now i want to delete the file phunk.exe from the folder. how can i implement GetAllUsersProfileDirectory() APi to delete the file please can anyone put the same code for the above scenario.

            C Offline
            C Offline
            Code o mat
            wrote on last edited by
            #5

            Hi. Your question isn't quite clear. For one, why do you want to delete that file programatically, what you say suggests you simply want to delete a file, so locate it in windows explorer, right click it and select "Delete". You shouldn't have the need to write a program for that. For two, GetAllUsersProfileDirectory[^] simply gives you the path to the "All Users" folder, it doesn't delete anything, but i will assume you know that and you are simply asking how to use this function, something like this (not tested, error checking ommited):

            DWORD charsNeeded;
            GetAllUsersProfileDirectory(NULL, &charsNeeded);
            TCHAR *FolderPath = new TCHAR[charsNeeded + 1];
            GetAllUsersProfileDirectory(FolderPath, &charsNeeded);
            ... the path should be in the FolderPath buffer now, do whatever you want with it...
            delete []FolderPath;

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups