std::string VolumeViewHelper::getStrippedVolumeName(const VolumeBase* handle) { if (!handle) return "no volume"; else { std::string volumePath = getVolumeName(handle); // remove trailing slash (dicom) std::string::size_type separator = volumePath.find_last_of("/\\"); if (separator == volumePath.size()-1) volumePath = volumePath.substr(0, volumePath.size()-1); return tgt::FileSystem::fileName(volumePath); } }
INT_PTR CALLBACK Dialog1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); PostQuitMessage(0); return (INT_PTR)TRUE; } switch (LOWORD(wParam)) { case IDC_VOLUME_INFO: { mBootSector mbs; //HWND val = GetDlgItem(hDlg, IDC_EDIT_VOLUME); //TCHAR temp[1024]; //char ctemp[1024]; /*GetDlgItemText(hDlg, IDC_EDIT_VOLUME, temp, 1024); for (int i = 0; i < lstrlen(temp); ++i) ctemp[i] = temp[i]; ctemp[lstrlen(temp)] = 0;*/ char vol[1024]; getVolumeName(hDlg, vol); if (readBootSector(vol, mbs)) { writeBootSectorToLog(mbs); CreateThread(NULL, 1024, (LPTHREAD_START_ROUTINE)showLog, 0, 0, NULL); } else MessageBox(hDlg, L"Cannot open volume", L"Error", MB_OK); //system("notepad log.txt"); break; } case IDC_DRIVE_INFO: { mMBR mbr; //HWND val = GetDlgItem(hDlg, IDC_EDIT_PHYSICAL_DRIVE); int driveNumber;// = GetDlgItemInt(hDlg, IDC_EDIT_PHYSICAL_DRIVE, 0, false);//get getPhysicalNumber(hDlg, driveNumber); if (readMBR(driveNumber, mbr)) { writeMBRtoLog(mbr); CreateThread(NULL, 1024, (LPTHREAD_START_ROUTINE)showLog, 0, 0, NULL); } else MessageBox(hDlg, L"Cannot open drive", L"Error", MB_OK); //system("notepad log.txt"); break; } case IDC_IMAGE_PHYDRIVE: { int num; char path[1024], dest[1024]; getPhysicalNumber(hDlg, num); getPathPhysicalDrive(num, path); srcdest* temp = new srcdest; temp->src = std::string(path); saveFile(hDlg, dest); temp->dest = std::string(dest); CreateThread(NULL, 1024, (LPTHREAD_START_ROUTINE)makeImage, temp, 0, NULL); //CreateImage(path, "temp.img", NULL); break; } case IDC_IMAGE_VOLUME: { char vol[1024]; char path[1024], dest[1024]; getVolumeName(hDlg, vol); getPathVolume(vol, path); srcdest* temp = new srcdest; temp->src = std::string(path); saveFile(hDlg, dest); temp->dest = std::string(dest); CreateThread(NULL, 1024, (LPTHREAD_START_ROUTINE)makeImage, temp, 0, NULL); //CreateImage(path, "temp.img", NULL); break; } default: return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; }