Changeset 546
- Timestamp:
- 11/13/2008 3:08:07 PM (3 years ago)
- Location:
- branches/eraser6/Installer/Bootstrapper
- Files:
-
- 3 edited
-
Bootstrapper.cpp (modified) (3 diffs)
-
Bootstrapper.h (modified) (1 diff)
-
Main.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Installer/Bootstrapper/Bootstrapper.cpp
r545 r546 60 60 61 61 DWORD lastOperation = 0; 62 //char buffer[262144]; 63 char* buffer = new char[2621440]; 64 unsigned bufsize = 2621440; 65 while (ReadFile(srcFile, buffer, bufsize, &lastOperation, NULL) && lastOperation) 62 char buffer[262144]; 63 while (ReadFile(srcFile, buffer, sizeof(buffer), &lastOperation, NULL) && lastOperation) 66 64 WriteFile(destFile, buffer, lastOperation, &lastOperation, NULL); 67 65 … … 71 69 throw std::wstring(L"The file size of the binary is larger than the data " 72 70 L"offset position; recompile the package, increasing DataOffset."); 73 ZeroMemory(buffer, bufsize);71 ZeroMemory(buffer, sizeof(buffer)); 74 72 while (amountToWrite > 0) 75 73 { 76 WriteFile(destFile, buffer, std::min<unsigned>(amountToWrite, bufsize),74 WriteFile(destFile, buffer, std::min<unsigned>(amountToWrite, sizeof(buffer)), 77 75 &lastOperation, NULL); 78 76 amountToWrite -= lastOperation; … … 86 84 int error; 87 85 SetLastError(0); 88 while (ReadFile(packageFile, buffer, bufsize, &lastOperation, NULL) && lastOperation)86 while (ReadFile(packageFile, buffer, sizeof(buffer), &lastOperation, NULL) && lastOperation) 89 87 { 90 88 WriteFile(destFile, buffer, lastOperation, &lastOperation, NULL); -
branches/eraser6/Installer/Bootstrapper/Bootstrapper.h
r545 r546 44 44 /// Creates the Window. 45 45 bool Create(); 46 47 /// Shows or hides the window. 48 void Show(bool show); 49 50 /// Enables or disables the cancel button. 51 void EnableCancellation(bool enable); 46 52 47 53 /// Sets the progress of the current operation. -
branches/eraser6/Installer/Bootstrapper/Main.cpp
r544 r546 134 134 //Create the parent window and the child controls 135 135 ::hInstance = hInstance; 136 Application::Get(); 136 Application& app = Application::Get(); 137 MainWindow& mainWin = app.GetTopWindow(); 137 138 138 139 //OK, now we do the hard work. Create a folder to place our payload into … … 148 149 TempDir dir(tempDir); 149 150 ExtractTempFiles(tempDir); 151 mainWin.EnableCancellation(false); 150 152 151 153 //Install the .NET framework … … 154 156 155 157 //Then install Eraser! 158 mainWin.Show(false); 156 159 InstallEraser(tempDir); 157 160 } … … 267 270 268 271 //Create the window 269 hWnd = CreateWindowW(szWindowClass, L"Eraser Setup", WS_CAPTION | WS_SYSMENU,272 hWnd = CreateWindowW(szWindowClass, L"Eraser Setup", WS_CAPTION, 270 273 CW_USEDEFAULT, 0, 300, 130, NULL, NULL, hInstance, NULL); 271 274 … … 306 309 } 307 310 311 void MainWindow::Show(bool show) 312 { 313 ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE); 314 } 315 316 void MainWindow::EnableCancellation(bool enable) 317 { 318 EnableWindow(hWndCancelBtn, enable); 319 } 320 308 321 void MainWindow::SetProgress(float progress) 309 322 {
Note: See TracChangeset
for help on using the changeset viewer.
