Changeset 543
- Timestamp:
- 11/13/2008 12:32:28 PM (3 years ago)
- Location:
- branches/eraser6/Installer/Bootstrapper
- Files:
-
- 3 edited
-
Bootstrapper.cpp (modified) (7 diffs)
-
Bootstrapper.h (modified) (1 diff)
-
Main.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Installer/Bootstrapper/Bootstrapper.cpp
r542 r543 23 23 #include "Bootstrapper.h" 24 24 25 class Handle 26 { 27 public: 28 Handle(HANDLE handle) 29 { 30 thisHandle = handle; 31 } 32 33 ~Handle() 34 { 35 CloseHandle(thisHandle); 36 } 37 38 operator HANDLE() 39 { 40 return thisHandle; 41 } 42 43 private: 44 HANDLE thisHandle; 45 }; 46 25 47 /// ISzInStream interface for extracting the archives. 26 48 struct LZFileStream … … 110 132 //Open the file 111 133 #if _DEBUG 112 H ANDLE srcFile =CreateFileW((Application::Get().GetPath() + L".7z").c_str(),113 GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ;134 Handle srcFile(CreateFileW((Application::Get().GetPath() + L".7z").c_str(), 135 GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 114 136 if (srcFile == INVALID_HANDLE_VALUE) 115 137 throw GetErrorMessage(GetLastError()); 116 138 #else 117 H ANDLE srcFile =CreateFileW(Application::Get().GetPath().c_str(), GENERIC_READ,118 FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ;139 Handle srcFile(CreateFileW(Application::Get().GetPath().c_str(), GENERIC_READ, 140 FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 119 141 if (srcFile == INVALID_HANDLE_VALUE) 120 142 throw GetErrorMessage(GetLastError()); … … 147 169 unsigned blockIndex = 0; 148 170 Byte* outBuffer = NULL; 149 size_t outBufferSize = 524288;171 size_t outBufferSize = 0; 150 172 for (unsigned i = 0; i < db.Database.NumFiles; ++i) 151 173 { 152 174 size_t offset = 0; 153 175 size_t processedSize = 0; 154 CFileItem *f= db.Database.Files + i;176 CFileItem* file = db.Database.Files + i; 155 177 SZ_RESULT result = SZ_OK; 156 178 … … 158 180 size_t convertedChars = 0; 159 181 wchar_t fileName[MAX_PATH]; 160 mbstowcs_s(&convertedChars, fileName, f ->Name, sizeof(fileName) / sizeof(fileName[0]));161 H ANDLE destFile =CreateFileW((pathToExtract + fileName).c_str(), GENERIC_WRITE, 0,162 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ;182 mbstowcs_s(&convertedChars, fileName, file->Name, sizeof(fileName) / sizeof(fileName[0])); 183 Handle destFile(CreateFileW((pathToExtract + fileName).c_str(), GENERIC_WRITE, 0, 184 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 163 185 if (destFile == INVALID_HANDLE_VALUE) 164 186 throw GetErrorMessage(GetLastError()); 165 unsigned long long destFileSize = f ->Size;187 unsigned long long destFileSize = file->Size; 166 188 167 189 //Extract the file … … 172 194 &allocTempImp); 173 195 if (result != SZ_OK) 174 _asm int 3;196 throw std::wstring(L"Could not decompress data as it is corrupt."); 175 197 176 198 DWORD bytesWritten = 0; … … 181 203 Application::Get().Yield(); 182 204 } 183 184 CloseHandle(destFile); 185 } 205 } 206 186 207 allocImp.Free(outBuffer); 187 208 } … … 276 297 tempDir += L"\\"; 277 298 std::wstring commandLine(L'"' + tempDir); 278 commandLine += L"dotnetfx .exe\"";299 commandLine += L"dotnetfx35.exe\""; 279 300 280 301 //And the return code is true if the process exited with 0. -
branches/eraser6/Installer/Bootstrapper/Bootstrapper.h
r542 r543 38 38 hWnd = hWndStatusLbl = hWndProgressBar = hWndCancelBtn = NULL; 39 39 } 40 41 /// Destructor. 42 ~MainWindow(); 40 43 41 44 /// Creates the Window. -
branches/eraser6/Installer/Bootstrapper/Main.cpp
r542 r543 176 176 177 177 std::map<HWND, MainWindow::WndProcData> MainWindow::OldWndProcs; 178 MainWindow::~MainWindow() 179 { 180 DestroyWindow(hWndStatusLbl); 181 DestroyWindow(hWndProgressBar); 182 DestroyWindow(hWndCancelBtn); 183 DestroyWindow(hWndPanel); 184 DestroyWindow(hWnd); 185 } 186 178 187 bool MainWindow::Create() 179 188 { … … 286 295 } 287 296 288 LRESULT MainWindow::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam,297 LRESULT MainWindow::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM /*lParam*/, 289 298 bool& handled) 290 299 { … … 297 306 break; 298 307 } 308 309 return 0; 299 310 } 300 311
Note: See TracChangeset
for help on using the changeset viewer.
