win32.c
changeset 2952 58522ed8f0f1
parent 2940 2b86050d1a94
child 3204 1d8c8114e073
equal deleted inserted replaced
2951:2de6d3a59743 2952:58522ed8f0f1
   139 		uint32 crc = (uint32)-1;
   139 		uint32 crc = (uint32)-1;
   140 
   140 
   141 		file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
   141 		file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
   142 			OPEN_EXISTING, 0, 0);
   142 			OPEN_EXISTING, 0, 0);
   143 		if (file != INVALID_HANDLE_VALUE) {
   143 		if (file != INVALID_HANDLE_VALUE) {
   144 			while(true) {
   144 			for (;;) {
   145 				if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 ||
   145 				if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 ||
   146 						numread == 0)
   146 						numread == 0)
   147 					break;
   147 					break;
   148 				filesize += numread;
   148 				filesize += numread;
   149 				crc = CalcCRC(buffer, numread, crc);
   149 				crc = CalcCRC(buffer, numread, crc);
   357 	return b;
   357 	return b;
   358 }
   358 }
   359 
   359 
   360 static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM lParam)
   360 static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM lParam)
   361 {
   361 {
   362 	switch(msg) {
   362 	switch (msg) {
   363 	case WM_INITDIALOG:
   363 	case WM_INITDIALOG:
   364 		SetDlgItemText(wnd, 10, _crash_desc);
   364 		SetDlgItemText(wnd, 10, _crash_desc);
   365 		SetDlgItemText(wnd, 11, _crash_msg);
   365 		SetDlgItemText(wnd, 11, _crash_msg);
   366 		SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
   366 		SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
   367 		SetWndSize(wnd, -1);
   367 		SetWndSize(wnd, -1);
   368 		return TRUE;
   368 		return TRUE;
   369 	case WM_COMMAND:
   369 	case WM_COMMAND:
   370 		switch(wParam) {
   370 		switch (wParam) {
   371 		case 12: // Close
   371 		case 12: // Close
   372 			ExitProcess(0);
   372 			ExitProcess(0);
   373 		case 13: { // Emergency save
   373 		case 13: { // Emergency save
   374 			if (DoEmergencySave(wnd))
   374 			if (DoEmergencySave(wnd))
   375 				MessageBoxA(wnd, _save_succeeded, "Save successful", MB_ICONINFORMATION);
   375 				MessageBoxA(wnd, _save_succeeded, "Save successful", MB_ICONINFORMATION);