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. Database & SysAdmin
  3. System Admin
  4. Help verfy Windows XP Home Bug ?

Help verfy Windows XP Home Bug ?

Scheduled Pinned Locked Moved System Admin
helpc++question
3 Posts 2 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.
  • M Offline
    M Offline
    Miroslav Rajcic
    wrote on last edited by
    #1

    I am having classical code to delete file to the recycle bin: bool DeleteToRecycleBin(const char *pszFilePath) { //double-zero terminated string char szFile[1024]; strncpy(szFile, pszFilePath, sizeof(szFile)-1); szFile[strlen(szFile)+1] = '\0'; SHFILEOPSTRUCT fileop; ZeroMemory(&fileop, sizeof(SHFILEOPSTRUCT)); fileop.wFunc = FO_DELETE; fileop.pFrom = szFile; fileop.pTo = NULL; fileop.fFlags = FOF_ALLOWUNDO | FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION; if(SHFileOperation(&fileop) != 0) { //failed to delete to recycle return false; } return (0 != _access(szFile, 0)); //return true; } I found this very spooky problem when calling this function on the following file ararngement: 1. inside some test directory create directory "VC6-ch04-Documents and Views_files" 2. inside test directory create file "VC6-ch04-Documents and Views.htm" 3. when trying to delete the file, as a bonus, function also deletes the directory !!!! (grrr, I've lost some important data this way). I also repeated this problem using delete feature from Total Commander file manager on the same OS plaform. I didn't test if this bug is "available" on other versions. Can anyone verify this bug (OS: windows XP Home, SP1, Compiler: VC++ 6.0) ? Also, if this is the bug, where can I report it officialy ? Miroslav Rajcic

    M 1 Reply Last reply
    0
    • M Miroslav Rajcic

      I am having classical code to delete file to the recycle bin: bool DeleteToRecycleBin(const char *pszFilePath) { //double-zero terminated string char szFile[1024]; strncpy(szFile, pszFilePath, sizeof(szFile)-1); szFile[strlen(szFile)+1] = '\0'; SHFILEOPSTRUCT fileop; ZeroMemory(&fileop, sizeof(SHFILEOPSTRUCT)); fileop.wFunc = FO_DELETE; fileop.pFrom = szFile; fileop.pTo = NULL; fileop.fFlags = FOF_ALLOWUNDO | FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION; if(SHFileOperation(&fileop) != 0) { //failed to delete to recycle return false; } return (0 != _access(szFile, 0)); //return true; } I found this very spooky problem when calling this function on the following file ararngement: 1. inside some test directory create directory "VC6-ch04-Documents and Views_files" 2. inside test directory create file "VC6-ch04-Documents and Views.htm" 3. when trying to delete the file, as a bonus, function also deletes the directory !!!! (grrr, I've lost some important data this way). I also repeated this problem using delete feature from Total Commander file manager on the same OS plaform. I didn't test if this bug is "available" on other versions. Can anyone verify this bug (OS: windows XP Home, SP1, Compiler: VC++ 6.0) ? Also, if this is the bug, where can I report it officialy ? Miroslav Rajcic

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Don't be so quick to blame the OS. FOF_NO_CONNECTED_ELEMENTS --Mike-- Latest blog entry: *drool* (Alyson) [May 10] Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

      M 1 Reply Last reply
      0
      • M Michael Dunn

        Don't be so quick to blame the OS. FOF_NO_CONNECTED_ELEMENTS --Mike-- Latest blog entry: *drool* (Alyson) [May 10] Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

        M Offline
        M Offline
        Miroslav Rajcic
        wrote on last edited by
        #3

        Thanks for your help, problem is soleved now However, I still consider this an awfull practice. MSDN coming with Visual C++ 6.0 never mentions theis flag. That means that all older programs will live in ilusion thet they have implemented single file deletion (example might be already mentioned Total Commander). They might be surprised a lot just like me. I managed to compile the code only by manually definig this flag (value found by google). Anyway, enough ranting, thanks. Miroslav Rajcic

        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