Changeset 1278 for trunk/eraser6


Ignore:
Timestamp:
10/19/09 10:43:42 (5 years ago)
Author:
lowjoel
Message:

-Display a useful error message when an error is encountered initiating a setup program - say whether it is the .NET runtime or the Eraser binary that didn't start
-Refresh the progress bar when extracting the setup files

Location:
trunk/eraser6/Installer/Bootstrapper
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Installer/Bootstrapper/Bootstrapper.cpp

    r1277 r1278  
    143143 
    144144        LZMemStream* s = static_cast<LZMemStream*>(object); 
     145 
     146        //Copy the memory to the provided buffer. 
     147        *size = std::min(std::min(*size, s->BufferSize - s->CurrentOffset), 
     148            static_cast<size_t>(32768)); 
    145149        char* dstBuffer = reinterpret_cast<char*>(SzAlloc(object, *size)); 
     150        memcpy(dstBuffer, s->Buffer + s->CurrentOffset, *size); 
     151 
     152        *buf = dstBuffer; 
     153        s->BufferRead += *size; 
     154 
     155        MainWindow& mainWin = Application::Get().GetTopWindow(); 
     156        mainWin.SetProgress((float)((double)s->BufferRead / s->BufferSize)); 
     157        return SZ_OK; 
     158    } 
     159 
     160    static SRes LZMemStreamRead(void* object, void* buf, size_t* size) 
     161    { 
     162        LZMemStream* s = static_cast<LZMemStream*>(object); 
    146163 
    147164        //Copy the memory to the provided buffer. 
    148         *size = std::min(*size, s->BufferSize - s->CurrentOffset); 
    149         memcpy(dstBuffer, s->Buffer + s->CurrentOffset, *size); 
    150         *buf = dstBuffer; 
    151         return SZ_OK; 
    152     } 
    153  
    154     static SRes LZMemStreamRead(void* object, void* buf, size_t* size) 
    155     { 
    156         LZMemStream* s = static_cast<LZMemStream*>(object); 
    157  
    158         //Copy the memory to the provided buffer. 
    159         *size = std::min(*size, s->BufferSize - s->CurrentOffset); 
     165        *size = std::min(std::min(*size, s->BufferSize - s->CurrentOffset), 
     166            static_cast<size_t>(32768)); 
    160167        memcpy(buf, s->Buffer + s->CurrentOffset, *size); 
    161168 
     
    194201        if (newPos > s->BufferSize || newPos < 0) 
    195202            return SZ_ERROR_INPUT_EOF; 
    196         s->CurrentOffset = newPos; 
     203        s->CurrentOffset = static_cast<size_t>(newPos); 
    197204        *position = newPos; 
    198205        return SZ_OK; 
     
    241248    unsigned blockIndex = 0; 
    242249    Byte* outBuffer = NULL; 
    243     size_t outBufferSize = 0; 
     250    size_t outBufferSize = 0; 
    244251    for (unsigned i = 0; i < db.db.NumFiles; ++i) 
    245252    { 
     
    322329} 
    323330 
    324 int CreateProcessAndWait(const std::wstring& commandLine) 
     331int CreateProcessAndWait(const std::wstring& commandLine, const std::wstring& appName) 
    325332{ 
    326333    //Get a mutable version of the command line 
     
    337344    { 
    338345        delete[] cmdLine; 
    339         throw GetErrorMessage(GetLastError()); 
     346        throw L"Error while executing " + appName + L": " + GetErrorMessage(GetLastError()); 
    340347    } 
    341348    delete[] cmdLine; 
     
    379386 
    380387    //And the return code is true if the process exited with 0. 
    381     return CreateProcessAndWait(commandLine) == 0; 
     388    return CreateProcessAndWait(commandLine, L".NET Framework Installer") == 0; 
    382389} 
    383390 
     
    415422     
    416423    //And the return code is true if the process exited with 0. 
    417     return CreateProcessAndWait(commandLine) == 0; 
    418 } 
     424    return CreateProcessAndWait(commandLine, L"Eraser") == 0; 
     425} 
  • trunk/eraser6/Installer/Bootstrapper/Main.cpp

    r815 r1278  
    345345{ 
    346346    EnableWindow(hWndCancelBtn, enable); 
     347    Application::Get().Yield(); 
    347348} 
    348349 
     
    353354        SetWindowLongPtr(hWndProgressBar, GWL_STYLE, pbStyle & (~PBS_MARQUEE)); 
    354355    SendMessage(hWndProgressBar, PBM_SETPOS, (int)(progress * 1000), 0); 
     356    Application::Get().Yield(); 
    355357} 
    356358 
     
    360362        GetWindowLongPtr(hWndProgressBar, GWL_STYLE) | PBS_MARQUEE); 
    361363    SendMessage(hWndProgressBar, PBM_SETMARQUEE, true, 100); 
     364    Application::Get().Yield(); 
    362365} 
    363366 
     
    365368{ 
    366369    SetWindowTextW(hWndStatusLbl, message.c_str()); 
     370    Application::Get().Yield(); 
    367371} 
    368372 
Note: See TracChangeset for help on using the changeset viewer.