Changeset 2016


Ignore:
Timestamp:
5/2/2010 11:00:18 AM (5 years ago)
Author:
lowjoel
Message:

Don't block the Explorer UI while the Eraser process displays a modal dialog (the confirmation dialog).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Shell/CtxMenu.cpp

    r2015 r2016  
    916916            } 
    917917 
    918             //Wait for the process to finish. 
     918            //Clean up all the opened handles -- our job is done. 
    919919            Handle<HANDLE> hProcess(processInfo.hProcess), 
    920920                           hThread(processInfo.hThread); 
    921921            CloseHandle(writePipe); 
    922             WaitForSingleObject(hProcess, static_cast<DWORD>(-1)); 
    923             DWORD exitCode = 0; 
    924              
    925             if (GetExitCodeProcess(processInfo.hProcess, &exitCode)) 
    926                 if (exitCode == ERROR_ACCESS_DENIED) 
    927                 { 
    928                     //The spawned instance could not connect with the master instance 
    929                     //because it is running as an administrator. Spawn the new instance 
    930                     //again, this time as an administrator 
    931                     RunEraser(action, parameters, true, parent, show); 
    932                 } 
    933                 else if (exitCode) 
    934                 { 
    935                     char buffer[8192]; 
    936                     DWORD lastRead = 0; 
    937                     std::wstring output; 
    938  
    939                     while (ReadFile(readPipe, buffer, sizeof(buffer), &lastRead, NULL) && lastRead != 0) 
    940                     { 
    941                         size_t lastConvert = 0; 
    942                         wchar_t wBuffer[8192]; 
    943                         if (!mbstowcs_s(&lastConvert, wBuffer, sizeof(wBuffer) / sizeof(wBuffer[0]), 
    944                             buffer, lastRead)) 
    945                         { 
    946                             output += std::wstring(wBuffer, lastConvert); 
    947                         } 
    948                     } 
    949  
    950                     //Show the error message. 
    951                     throw output; 
    952                 } 
    953922        } 
    954923    } 
Note: See TracChangeset for help on using the changeset viewer.