Changeset 2333


Ignore:
Timestamp:
10/30/2011 1:20:05 AM (2 years ago)
Author:
lowjoel
Message:

Merged revision(s) 2332 from trunk/eraser: Behaviour change: DuplicateHandle? when not provided a handle pointer to clone the source handle to will leak handles from Windows 7 onwards. Prevent that (and restore locked file erasure functionality)

Location:
branches/eraser6/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0

  • branches/eraser6/6.0/Eraser.Util.Unlocker/Eraser.Util.Unlocker.cpp

    r1677 r2333  
    121121 
    122122        //Forcibly close the handle 
     123        HANDLE duplicateHandle = NULL; 
    123124        DuplicateHandle(processHandle, static_cast<void*>(Handle), GetCurrentProcess(), 
    124             NULL, 0, false, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 
     125            &duplicateHandle, 0, false, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); 
     126        CloseHandle(duplicateHandle); 
    125127 
    126128        //Check if the handle is closed 
    127129        bool result = true; 
    128         HANDLE duplicateHandle = NULL; 
    129130        if (DuplicateHandle(processHandle, static_cast<void*>(Handle), GetCurrentProcess(), 
    130131            &duplicateHandle, 0, false, DUPLICATE_SAME_ACCESS)) 
Note: See TracChangeset for help on using the changeset viewer.