Changeset 21
- Timestamp:
- Apr 2, 2016, 11:12:47 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 lib 3 3 CoolDisk.lps 4 CoolDisk.exe
-
- Property svn:ignore
-
trunk/CoolDisk.lpi
r15 r21 140 140 <IsPartOfProject Value="True"/> 141 141 <ComponentName Value="Core"/> 142 <HasResources Value="True"/> 142 143 <ResourceBaseClass Value="DataModule"/> 143 144 </Unit10> -
trunk/Form/UFormMain.lfm
r16 r21 1 1 object FormMain: TFormMain 2 Left = 4423 Height = 9 414 Top = 3665 Width = 1 7032 Left = -26 3 Height = 925 4 Top = 276 5 Width = 1694 6 6 Caption = 'CoolDisk' 7 ClientHeight = 9098 ClientWidth = 17037 ClientHeight = 0 8 ClientWidth = 0 9 9 Menu = MainMenu1 10 10 OnClose = FormClose … … 13 13 OnDestroy = FormDestroy 14 14 OnShow = FormShow 15 LCLVersion = '1. 7'15 LCLVersion = '1.6.0.4' 16 16 object ToolBar1: TToolBar 17 17 Left = 0 18 18 Height = 26 19 19 Top = 0 20 Width = 170320 Width = 0 21 21 Caption = 'ToolBar1' 22 22 Images = Core.ImageList1 … … 28 28 end 29 29 object ToolButton2: TToolButton 30 Left = 2431 Top = 2 30 Left = 1 31 Top = 24 32 32 Action = AScanStop 33 33 end 34 34 object ToolButton3: TToolButton 35 Left = 4736 Top = 235 Left = 1 36 Top = 46 37 37 Action = AScanContinue 38 38 end 39 39 end 40 40 object Panel1: TPanel 41 Left = 59742 Height = 88343 Top = 2644 Width = 110641 Left = 0 42 Height = 0 43 Top = 0 44 Width = 0 45 45 Align = alClient 46 46 BevelOuter = bvNone 47 ClientHeight = 88348 ClientWidth = 110647 ClientHeight = 0 48 ClientWidth = 0 49 49 TabOrder = 1 50 50 object Image1: TImage 51 Left = 852 Height = 86753 Top = 854 Width = 109051 Left = 0 52 Height = 0 53 Top = 0 54 Width = 0 55 55 Align = alClient 56 56 BorderSpacing.Around = 8 … … 60 60 object Panel2: TPanel 61 61 Left = 0 62 Height = 88363 Top = 2662 Height = 0 63 Top = 0 64 64 Width = 592 65 65 Align = alLeft 66 66 BevelOuter = bvNone 67 ClientHeight = 88367 ClientHeight = 0 68 68 ClientWidth = 592 69 69 TabOrder = 2 … … 78 78 object Label1: TLabel 79 79 Left = 15 80 Height = 2480 Height = 15 81 81 Top = 675 82 Width = 10182 Width = 58 83 83 Caption = 'Sector size:' 84 84 ParentColor = False … … 86 86 object LabelSectorSize: TLabel 87 87 Left = 256 88 Height = 2488 Height = 15 89 89 Top = 675 90 Width = 1090 Width = 6 91 91 Caption = ' ' 92 92 ParentColor = False … … 94 94 object LabelSectorCount: TLabel 95 95 Left = 256 96 Height = 2496 Height = 15 97 97 Top = 704 98 Width = 1098 Width = 6 99 99 Caption = ' ' 100 100 ParentColor = False … … 102 102 object Label2: TLabel 103 103 Left = 15 104 Height = 24104 Height = 15 105 105 Top = 704 106 Width = 119106 Width = 70 107 107 Caption = 'Sector count:' 108 108 ParentColor = False … … 110 110 object LabelBlockCurrent: TLabel 111 111 Left = 256 112 Height = 24112 Height = 15 113 113 Top = 736 114 Width = 10114 Width = 6 115 115 Caption = ' ' 116 116 ParentColor = False … … 118 118 object Label3: TLabel 119 119 Left = 15 120 Height = 24120 Height = 15 121 121 Top = 736 122 Width = 136122 Width = 78 123 123 Caption = 'Current sector:' 124 124 ParentColor = False … … 126 126 object Label4: TLabel 127 127 Left = 15 128 Height = 24128 Height = 15 129 129 Top = 768 130 Width = 162130 Width = 94 131 131 Caption = 'Damaged sectors:' 132 132 ParentColor = False … … 134 134 object LabelBlockDamaged: TLabel 135 135 Left = 256 136 Height = 24136 Height = 15 137 137 Top = 764 138 Width = 10138 Width = 6 139 139 Caption = ' ' 140 140 ParentColor = False … … 142 142 object Label5: TLabel 143 143 Left = 15 144 Height = 24144 Height = 15 145 145 Top = 796 146 Width = 122146 Width = 70 147 147 Caption = 'Elapsed time:' 148 148 ParentColor = False … … 150 150 object LabelElapsedTime: TLabel 151 151 Left = 256 152 Height = 24152 Height = 15 153 153 Top = 792 154 Width = 10154 Width = 6 155 155 Caption = ' ' 156 156 ParentColor = False … … 158 158 object Label6: TLabel 159 159 Left = 15 160 Height = 24160 Height = 15 161 161 Top = 824 162 Width = 142162 Width = 82 163 163 Caption = 'Estimated time:' 164 164 ParentColor = False … … 166 166 object LabelEstimatedTime: TLabel 167 167 Left = 257 168 Height = 24168 Height = 15 169 169 Top = 820 170 Width = 10170 Width = 6 171 171 Caption = ' ' 172 172 ParentColor = False … … 174 174 object Label7: TLabel 175 175 Left = 15 176 Height = 24176 Height = 15 177 177 Top = 644 178 Width = 160178 Width = 93 179 179 Caption = 'Sectors per Block:' 180 180 ParentColor = False … … 182 182 object LabelSectorPerBlock: TLabel 183 183 Left = 256 184 Height = 24184 Height = 15 185 185 Top = 640 186 Width = 10186 Width = 6 187 187 Caption = ' ' 188 188 ParentColor = False … … 190 190 object LabelIOSpeed: TLabel 191 191 Left = 256 192 Height = 24192 Height = 15 193 193 Top = 848 194 Width = 10194 Width = 6 195 195 Caption = ' ' 196 196 ParentColor = False … … 198 198 object Label8: TLabel 199 199 Left = 15 200 Height = 24200 Height = 15 201 201 Top = 852 202 Width = 94202 Width = 54 203 203 Caption = 'I/O speed:' 204 204 ParentColor = False … … 223 223 object Label10: TLabel 224 224 Left = 15 225 Height = 24225 Height = 15 226 226 Top = 612 227 Width = 40227 Width = 23 228 228 Caption = 'Size:' 229 229 ParentColor = False … … 231 231 object LabelSize: TLabel 232 232 Left = 256 233 Height = 24233 Height = 15 234 234 Top = 608 235 Width = 10235 Width = 6 236 236 Caption = ' ' 237 237 ParentColor = False … … 283 283 object Label11: TLabel 284 284 Left = 17 285 Height = 24285 Height = 15 286 286 Top = 141 287 Width = 107287 Width = 61 288 288 Caption = 'Operations:' 289 289 ParentColor = False … … 299 299 object ComboBoxDrive: TComboBox 300 300 Left = 8 301 Height = 38301 Height = 23 302 302 Top = 16 303 303 Width = 416 304 304 Anchors = [akTop, akLeft, akRight] 305 ItemHeight = 0305 ItemHeight = 15 306 306 OnChange = ComboBoxDriveChange 307 307 Style = csDropDownList … … 326 326 end 327 327 object Splitter1: TSplitter 328 Left = 592329 Height = 883330 Top = 26328 Left = 0 329 Height = 0 330 Top = 0 331 331 Width = 5 332 332 end -
trunk/Form/UFormMain.pas
r20 r21 242 242 DriveInfo.Assign(TDriveInfo(ComboBoxDrive.Items.Objects[ComboBoxDrive.ItemIndex])); 243 243 Modified := True; 244 Core.Project.ScanProfile.SectorCount := DriveInfo.SectorCount; 245 Core.Project.ScanProfile.SectorStart := 0; 246 Core.Project.ScanProfile.SectorEnd := Core.Project.ScanProfile.SectorCount - 1; 244 Core.Project.ScanProfile.LoadFromDriveInfo(DriveInfo); 247 245 UpdateInterface; 248 246 Redraw; … … 307 305 ComboBoxDrive.ItemIndex := Core.DriveList.IndexOf(Core.DriveList.FindByModel(Core.Project.DriveInfo.Model)); 308 306 if (ComboBoxDrive.ItemIndex = -1) and (ComboBoxDrive.Items.Count > 0) then ComboBoxDrive.ItemIndex := 0; 309 ComboBoxDriveChange(Self); 307 if ComboBoxDrive.ItemIndex <> -1 then 308 Core.Project.DriveInfo.Assign(TDriveInfo(ComboBoxDrive.Items.Objects[ComboBoxDrive.ItemIndex])); 309 Core.Project.ScanProfile.LoadFromDriveInfo(Core.Project.DriveInfo); 310 310 311 311 Redraw; -
trunk/Form/UFormOperation.pas
r19 r21 61 61 ComboBoxRunMode.ItemIndex := Integer(DriveScan.Mode); 62 62 EditPattern.Text := '0x' + IntToHex(DriveScan.WritePattern, 2); 63 SpinEditLastSector.MaxValue := DriveScan.SectorCount ;63 SpinEditLastSector.MaxValue := DriveScan.SectorCount - 1; 64 64 SpinEditFirstSector.Value := DriveScan.SectorStart; 65 65 SpinEditLastSector.Value := DriveScan.SectorEnd; -
trunk/UBlockMap.pas
r18 r21 222 222 begin 223 223 ItemsCount := Point(Trunc(FDrawSize.X / BlockSize.X), Trunc(FDrawSize.Y / BlockSize.Y)); 224 FSectorPerBlock := Ceil(SectorCount / (ItemsCount.X * ItemsCount.Y)); 224 if (ItemsCount.X > 0) and (ItemsCount.Y > 0) then begin 225 FSectorPerBlock := Ceil(SectorCount / (ItemsCount.X * ItemsCount.Y)); 226 end else FSectorPerBlock := 1; 227 if FSectorPerBlock < 1 then FSectorPerBlock := 1; 225 228 SetBlockCount(Ceil(SectorCount / FSectorPerBlock)); 226 229 end; -
trunk/UDriveScan.pas
r19 r21 7 7 uses 8 8 Classes, SysUtils, Syncobjs, UBlockMap, Forms, DOM, 9 UXMLUtils, Contnrs ;9 UXMLUtils, Contnrs, UPhysDrive; 10 10 11 11 type … … 27 27 end; 28 28 29 { TDriveScanProfile } 30 29 31 TDriveScanProfile = class 30 32 SectorCount: Integer; … … 33 35 Mode: TRunMode; 34 36 WritePattern: Byte; 37 procedure LoadFromDriveInfo(DriveInfo: TDriveInfo); 35 38 end; 36 39 … … 94 97 SUnknownRunMode = 'Unknown run mode'; 95 98 99 { TDriveScanProfile } 100 101 procedure TDriveScanProfile.LoadFromDriveInfo(DriveInfo: TDriveInfo); 102 begin 103 SectorCount := DriveInfo.SectorCount; 104 SectorStart := 0; 105 SectorEnd := DriveInfo.SectorCount - 1; 106 end; 107 96 108 { TDriveScanList } 97 109 -
trunk/UPhysDrive.pas
r20 r21 6 6 7 7 uses 8 Classes, SysUtils, Contnrs, UFindFile, UCommon; 8 Classes, SysUtils, Contnrs, UFindFile, UCommon 9 {$IFDEF Windows},ActiveX,ComObj,Variants 10 {$ENDIF}; 9 11 10 12 type … … 29 31 procedure LoadToStrings(Strings: TStrings); 30 32 procedure Detect; 33 private 34 {$IFDEF Windows} 35 procedure GetWin32DiskDriveInfo; 36 {$ENDIF} 31 37 end; 32 38 … … 109 115 end; 110 116 {$ENDIF} 117 {$IFDEF Windows} 118 GetWin32DiskDriveInfo; 119 {$ENDIF} 111 120 // Drive located using filename 112 121 NewDriveInfo := TDriveInfo.Create; … … 120 129 end; 121 130 131 {$IFDEF Windows} 132 procedure TDriveList.GetWin32DiskDriveInfo; 133 const 134 WbemUser = ''; 135 WbemPassword = ''; 136 WbemComputer = 'localhost'; 137 wbemFlagForwardOnly = $00000020; 138 var 139 FSWbemLocator: OLEVariant; 140 FWMIService: OLEVariant; 141 FWbemObjectSet: OLEVariant; 142 FWbemObject: OLEVariant; 143 oEnum: IEnumvariant; 144 OutVar: LongWord; 145 NewDriveInfo: TDriveInfo; 146 begin; 147 FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); 148 FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, 149 WbemPassword); 150 FWbemObjectSet := FWMIService.ExecQuery('SELECT * FROM Win32_DiskDrive', 151 'WQL', wbemFlagForwardOnly); 152 oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; 153 while oEnum.Next(1, FWbemObject, OutVar) = 0 do begin 154 NewDriveInfo := TDriveInfo.Create; 155 NewDriveInfo.Kind := dkPhysical; 156 NewDriveInfo.Model := FWbemObject.Properties_.Item('Caption').Value; 157 //NewDriveInfo.Model := FWbemObject.Properties_.Item('Model').Value; 158 NewDriveInfo.Size := FWbemObject.Properties_.Item('Size').Value; 159 NewDriveInfo.SectorSize := 4096; 160 NewDriveInfo.SectorCount := NewDriveInfo.Size div NewDriveInfo.SectorSize; 161 NewDriveInfo.Path := FWbemObject.Properties_.Item('DeviceID').Value; 162 Add(NewDriveInfo); 163 164 FWbemObject := Unassigned; 165 end; 166 end; 167 {$ENDIF} 168 169 122 170 end. 123 171
Note:
See TracChangeset
for help on using the changeset viewer.