| 1 | ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
|
|---|
| 2 | ;
|
|---|
| 3 | ; This file is part of AiR-BOOT
|
|---|
| 4 | ;
|
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under
|
|---|
| 6 | ; the terms of the GNU General Public License as published by the Free
|
|---|
| 7 | ; Software Foundation, either version 3 of the License, or (at your option)
|
|---|
| 8 | ; any later version.
|
|---|
| 9 | ;
|
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 11 | ; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
|
|---|
| 12 | ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|---|
| 13 | ; details.
|
|---|
| 14 | ;
|
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with
|
|---|
| 16 | ; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 17 | ;
|
|---|
| 18 | ;---------------------------------------------------------------------------
|
|---|
| 19 | ; AiR-BOOT / PARTiTiON SCANNING
|
|---|
| 20 | ;---------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | IFDEF ModuleNames
|
|---|
| 24 | DB 'PARTSCAN',0
|
|---|
| 25 | ENDIF
|
|---|
| 26 |
|
|---|
| 27 | ; Note: This is complex code. So make sure that you know what you are doing in
|
|---|
| 28 | ; here.
|
|---|
| 29 |
|
|---|
| 30 | PARTSCAN_ScanForPartitions Proc Near Uses
|
|---|
| 31 | ; Reset X-Reference
|
|---|
| 32 | call PARTSCAN_ResetXref
|
|---|
| 33 |
|
|---|
| 34 | mov dh, TotalHarddiscs
|
|---|
| 35 | xor al, al
|
|---|
| 36 | mov NewPartitions, al
|
|---|
| 37 |
|
|---|
| 38 | mov CurIO_Scanning, 1 ; Set flag due scanning partitions
|
|---|
| 39 | mov dl, 80h ; is first harddisc
|
|---|
| 40 | PSSFP_HarddiscLoop:
|
|---|
| 41 | push dx
|
|---|
| 42 | call PARTSCAN_ScanDriveForPartitions
|
|---|
| 43 | pop dx
|
|---|
| 44 | inc dl
|
|---|
| 45 | dec dh
|
|---|
| 46 | jnz PSSFP_HarddiscLoop
|
|---|
| 47 | mov CurIO_Scanning, 0 ; Reset flag due scanning complete
|
|---|
| 48 |
|
|---|
| 49 | ; Use X-Reference to sync NewPartitionTable with Hide-Config
|
|---|
| 50 | call PARTSCAN_SyncHideConfigWithXref
|
|---|
| 51 |
|
|---|
| 52 | ; Now we copy the new IPT over the old one...
|
|---|
| 53 | mov si, offset NewPartTable
|
|---|
| 54 | mov di, offset PartitionTable
|
|---|
| 55 | ;movzx ax, NewPartitions
|
|---|
| 56 | mov al,NewPartitions
|
|---|
| 57 | mov ah,0
|
|---|
| 58 |
|
|---|
| 59 | mov CFG_Partitions, al
|
|---|
| 60 | mov bl, LocIPT_LenOfIPT
|
|---|
| 61 | mul bl
|
|---|
| 62 | mov cx, ax
|
|---|
| 63 | rep movsb
|
|---|
| 64 |
|
|---|
| 65 | ; and the New Logical Drive Letter table as well...
|
|---|
| 66 | mov si, offset NewDriveLetters
|
|---|
| 67 | mov di, offset DriveLetters
|
|---|
| 68 | mov cx, LocIPT_MaxPartitions
|
|---|
| 69 | rep movsb
|
|---|
| 70 |
|
|---|
| 71 | ; [Linux support removed since v1.02]
|
|---|
| 72 | ; ; Search for any Linux partition and remember, if it got found...
|
|---|
| 73 | ; mov si, offset PartitionTable
|
|---|
| 74 | ; movzx cx, CFG_Partitions
|
|---|
| 75 | ; xor dl, dl ; DL - Is Linux here ?
|
|---|
| 76 | ; or cx, cx
|
|---|
| 77 | ; jz PSSFP_NoPartitions
|
|---|
| 78 | ; PSSFP_LinuxLoop:
|
|---|
| 79 | ; cmp bptr [si+LocIPT_SystemID], 083h ; Hard-Coded
|
|---|
| 80 | ; jne PSSFP_NoLinux
|
|---|
| 81 | ; mov dl, 1 ; Linux found...
|
|---|
| 82 | ; PSSFP_NoLinux:
|
|---|
| 83 | ; add si, LocIPT_LenOfIPT
|
|---|
| 84 | ; loop PSSFP_LinuxLoop
|
|---|
| 85 | ; PSSFP_NoPartitions:
|
|---|
| 86 | ; mov GotLinux, dl ; Set Flag
|
|---|
| 87 |
|
|---|
| 88 | ; ...and finally check, if we need to set a Drive-Letter
|
|---|
| 89 | mov dl, AutoDrvLetter
|
|---|
| 90 | or dl, dl
|
|---|
| 91 | jz PSSFP_NoAutoDriveLetter
|
|---|
| 92 | ;movzx cx, CFG_Partitions
|
|---|
| 93 | mov cl,CFG_Partitions
|
|---|
| 94 | mov ch,0
|
|---|
| 95 |
|
|---|
| 96 | or cx, cx
|
|---|
| 97 | jz PSSFP_NoAutoDriveLetter
|
|---|
| 98 | mov si, offset PartitionTable
|
|---|
| 99 | mov di, offset DriveLetters
|
|---|
| 100 | mov ax, wptr [AutoDrvLetterSerial]
|
|---|
| 101 | mov bx, wptr [AutoDrvLetterSerial+2]
|
|---|
| 102 | PSSFP_AutoDrvLetterLoop:
|
|---|
| 103 | cmp ax, [si+LocIPT_Serial]
|
|---|
| 104 | jne PSSFP_AutoDrvLetterNoMatch
|
|---|
| 105 | cmp bx, [si+LocIPT_Serial+2]
|
|---|
| 106 | jne PSSFP_AutoDrvLetterNoMatch
|
|---|
| 107 | ; We got a match, so set Drive-Letter in DL
|
|---|
| 108 | or bptr [si+LocIPT_Flags], Flags_DriveLetter
|
|---|
| 109 | mov [di], dl
|
|---|
| 110 | PSSFP_AutoDrvLetterNoMatch:
|
|---|
| 111 | add si, LocIPT_LenOfIPT
|
|---|
| 112 | inc di
|
|---|
| 113 | loop PSSFP_AutoDrvLetterLoop
|
|---|
| 114 | mov AutoDrvLetter, 0 ; Disable after processing...
|
|---|
| 115 | PSSFP_NoAutoDriveLetter:
|
|---|
| 116 | ret
|
|---|
| 117 | PARTSCAN_ScanForPartitions EndP
|
|---|
| 118 |
|
|---|
| 119 | ; Scannt die Festplatte auf jegliche Partitionstabellen...
|
|---|
| 120 | ; Falls eine fehlerhafte Partition gefunden wird, wird abgebrochen.
|
|---|
| 121 | ; falls eine Extended Partition (DOS) gefunden wird, wird erneut gescannt.
|
|---|
| 122 | PARTSCAN_ScanDriveForPartitions Proc Near Uses
|
|---|
| 123 | xor ax, ax
|
|---|
| 124 | xor bx, bx ; Location Absoluter Sektor 0
|
|---|
| 125 | mov cx, 0001h
|
|---|
| 126 | xor dh, dh ; Location Zylinder 0, Side 0, Sektor 1 MBR
|
|---|
| 127 | mov [ExtendedAbsPosSet], al
|
|---|
| 128 | mov wptr [ExtendedAbsPos+0], ax
|
|---|
| 129 | mov wptr [ExtendedAbsPos+2], ax
|
|---|
| 130 | PSSDFP_LoadThisPartition:
|
|---|
| 131 |
|
|---|
| 132 | call DriveIO_LoadPartition ; Load a partition record
|
|---|
| 133 |
|
|---|
| 134 | jc PSSDFP_InvalidPartition
|
|---|
| 135 |
|
|---|
| 136 | ; LVM Support - Reads LVM Information Sector
|
|---|
| 137 | call DriveIO_LoadLVMSector ; Load LVM sector
|
|---|
| 138 |
|
|---|
| 139 | call PARTSCAN_ScanPartition
|
|---|
| 140 | IFDEF ReleaseCode
|
|---|
| 141 | call DriveIO_SavePartition
|
|---|
| 142 | ENDIF
|
|---|
| 143 | call PARTSCAN_ScanPartitionForExtended
|
|---|
| 144 | jc PSSDFP_LoadThisPartition
|
|---|
| 145 | PSSDFP_InvalidPartition:
|
|---|
| 146 | ret
|
|---|
| 147 | PARTSCAN_ScanDriveForPartitions EndP
|
|---|
| 148 |
|
|---|
| 149 | ; Scans Current Partition for Extended Partitions, if found, AX,BX,CX,DX will
|
|---|
| 150 | ; be set to this location and Carry will be set
|
|---|
| 151 | PARTSCAN_ScanPartitionForExtended Proc Near Uses si
|
|---|
| 152 | mov si, offset PartitionSector+446 ; DS:SI - 1st partition entry
|
|---|
| 153 | xor ax, ax
|
|---|
| 154 | PSSPFE_ScanLoop:
|
|---|
| 155 | mov al, [si+LocBRPT_SystemID]
|
|---|
| 156 | cmp al, 5 ; Is Partition EXTENDED ?
|
|---|
| 157 | je PSSPFE_ExtendedPartition
|
|---|
| 158 | cmp al, 0Fh ; Is Partition EXTENDED (M$) ?
|
|---|
| 159 | je PSSPFE_ExtendedPartition
|
|---|
| 160 | jmp PSSPFE_IgnorePartition
|
|---|
| 161 | PSSPFE_ExtendedPartition:
|
|---|
| 162 | mov ax, wptr [si+LocBRPT_RelativeBegin]
|
|---|
| 163 | mov bx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 164 | add ax, wptr [ExtendedAbsPos+0] ; Adjust...
|
|---|
| 165 | adc bx, wptr [ExtendedAbsPos+2] ; (Shit Design!)
|
|---|
| 166 | test [ExtendedAbsPosSet], 1
|
|---|
| 167 | jnz PSSPFE_ExtendedMainKnown
|
|---|
| 168 | mov wptr [ExtendedAbsPos+0], ax
|
|---|
| 169 | mov wptr [ExtendedAbsPos+2], bx
|
|---|
| 170 | mov [ExtendedAbsPosSet], 1
|
|---|
| 171 | PSSPFE_ExtendedMainKnown:
|
|---|
| 172 | mov cx, wptr [si+LocBRPT_BeginSector] ; Cylinder/Sector
|
|---|
| 173 | mov dh, bptr [si+LocBRPT_BeginHead] ; Head
|
|---|
| 174 | mov dl, bptr [CurPartition_Location+4] ; Drive
|
|---|
| 175 | stc
|
|---|
| 176 | jmp PSSPFE_EndOfSearch
|
|---|
| 177 | PSSPFE_IgnorePartition:
|
|---|
| 178 | add si, LocBRPT_LenOfEntry
|
|---|
| 179 | cmp si, 500+offset PartitionSector
|
|---|
| 180 | jb PSSPFE_ScanLoop
|
|---|
| 181 | clc
|
|---|
| 182 | PSSPFE_EndOfSearch:
|
|---|
| 183 | ret
|
|---|
| 184 | PARTSCAN_ScanPartitionForExtended EndP
|
|---|
| 185 |
|
|---|
| 186 | ; The following routines have NOT *DS* set to CS, so we must address via ES
|
|---|
| 187 | PARTSCAN_ScanPartition Proc Near Uses ax si
|
|---|
| 188 | mov si, offset PartitionSector+446 ; DS:SI - 1st Partition-Entry
|
|---|
| 189 | PSSP_ScanLoop:
|
|---|
| 190 | mov al, bptr [si+LocBRPT_SystemID]
|
|---|
| 191 | cmp al, 5 ; Is Partition EXTENDED ?
|
|---|
| 192 | je PSSP_IgnorePartition
|
|---|
| 193 | cmp al, 0Fh ; Is Partition EXTENDED (M$-DOS7) ?
|
|---|
| 194 | je PSSP_IgnorePartition
|
|---|
| 195 | cmp al, 0 ; Is Partition EMPTY ?
|
|---|
| 196 | je PSSP_IgnorePartition
|
|---|
| 197 | ; Ignore these partitions, because there are no real Partitions
|
|---|
| 198 | call PARTSCAN_CheckThisPartition
|
|---|
| 199 | PSSP_IgnorePartition:
|
|---|
| 200 | ; Lscht das Boot-Able Flag...
|
|---|
| 201 | and byte ptr [si+LocBRPT_Flags], 7Fh ; Reset the Active-Flag
|
|---|
| 202 | add si, LocBRPT_LenOfEntry ; 16 Bytes per partition entry
|
|---|
| 203 | cmp si, 500+offset PartitionSector
|
|---|
| 204 | jb PSSP_ScanLoop
|
|---|
| 205 | ; If we are on first HDD and in primary partition table -> mark primary
|
|---|
| 206 | cmp bptr [CurPartition_Location+4], 80h ; Drive
|
|---|
| 207 | jne PSSP_NoMarkPrimary
|
|---|
| 208 | cmp wptr [CurPartition_Location+0], 0
|
|---|
| 209 | jne PSSP_NoMarkPrimary
|
|---|
| 210 | cmp wptr [CurPartition_Location+2], 0 ; Absolute Location
|
|---|
| 211 | jne PSSP_NoMarkPrimary
|
|---|
| 212 | call PART_MarkFirstGoodPrimary
|
|---|
| 213 | PSSP_NoMarkPrimary:
|
|---|
| 214 | ret
|
|---|
| 215 | PARTSCAN_ScanPartition EndP
|
|---|
| 216 |
|
|---|
| 217 | MBR_NoName_Patched db 15 dup (0)
|
|---|
| 218 |
|
|---|
| 219 | ; Will insert this partition into NewPartTable and compare it to our "old"
|
|---|
| 220 | ; LocIPT-table. If the same partition is found there, Flags&CRC are taken from
|
|---|
| 221 | ; the old table, otherwise they are generated freshly.
|
|---|
| 222 | ; Will also fill out PartitionXref to sync HideConfig later
|
|---|
| 223 | ; In: SI - Points to Partition-Entry (16-Bytes)
|
|---|
| 224 | PARTSCAN_CheckThisPartition Proc Near Uses di si
|
|---|
| 225 | local PartSystemID:byte, PartTypeFlags:byte
|
|---|
| 226 | local PartCRC:word, PartPtr:word
|
|---|
| 227 |
|
|---|
| 228 | mov wptr [PartPtr], si ; Save Pointer to PartitionEntry
|
|---|
| 229 |
|
|---|
| 230 | mov al, bptr [si+LocBRPT_SystemID]
|
|---|
| 231 | mov PartSystemID, al
|
|---|
| 232 |
|
|---|
| 233 | mov cx, wptr [si+LocBRPT_BeginSector] ; Cylinder/Sector
|
|---|
| 234 | mov dh, bptr [si+LocBRPT_BeginHead] ; Head
|
|---|
| 235 | mov dl, bptr [CurPartition_Location+4] ; Drive
|
|---|
| 236 | mov ax, wptr [si+LocBRPT_RelativeBegin] ; Absolute Sector
|
|---|
| 237 | mov bx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 238 | add ax, wptr [CurPartition_Location+0] ; +Partition-Absolute
|
|---|
| 239 | adc bx, wptr [CurPartition_Location+2] ; sectors
|
|---|
| 240 | call DriveIO_LoadTmpSector ; Loads Boot record ; Rousseau: LOAD PARTITION BOOT RECORD !!
|
|---|
| 241 | ; Sets up DS:SI - TmpSector
|
|---|
| 242 |
|
|---|
| 243 | push si
|
|---|
| 244 | mov bx, 4B4Dh ; Magic 'MK' :)
|
|---|
| 245 | call MBR_GetCheckOfSector
|
|---|
| 246 | mov PartCRC, bx ; Save Partition's-CRC
|
|---|
| 247 |
|
|---|
| 248 | ; ------------------------------ Gets internal infos of partition type
|
|---|
| 249 | mov al, PartSystemID
|
|---|
| 250 | call PART_SearchFileSysName
|
|---|
| 251 | ; Replies AH - FileSysFlags, AL - UnhiddenID, SI - FileSystemNamePtr
|
|---|
| 252 | mov di, si
|
|---|
| 253 | mov PartTypeFlags, ah
|
|---|
| 254 | mov PartSystemID, al ; Use Unhidden-ID
|
|---|
| 255 | pop si
|
|---|
| 256 |
|
|---|
| 257 | ;================================
|
|---|
| 258 | ; AL - File System ID (Unhidden)
|
|---|
| 259 | ; AH - File System Flags
|
|---|
| 260 | ; SI - Boot-Record of Partition
|
|---|
| 261 | ; DI - File System Name
|
|---|
| 262 | ;================================
|
|---|
| 263 |
|
|---|
| 264 | cmp PartSystemID, 07h ; We got IFS here?
|
|---|
| 265 | jne PCCTP_IFSdone
|
|---|
| 266 | ; Check, if 'JFS ' is at DWORD offset 36h ; Rousseau: JFS check (LVM / IPT?)
|
|---|
| 267 | cmp wptr [si+36h], 'FJ'
|
|---|
| 268 | jne PCCTP_IFSnoJFS
|
|---|
| 269 | cmp wptr [si+38h], ' S'
|
|---|
| 270 | jne PCCTP_IFSnoJFS
|
|---|
| 271 | mov PartSystemID, 0FCh ; FC is JFS internally
|
|---|
| 272 | jmp PCCTP_IFSdone
|
|---|
| 273 | PCCTP_IFSnoJFS:
|
|---|
| 274 | ; Check, if 'HPFS' is at DWORD offset 36h
|
|---|
| 275 | cmp wptr [si+36h], 'PH'
|
|---|
| 276 | jne PCCTP_ProbablyNTFS
|
|---|
| 277 | cmp wptr [si+38h], 'SF'
|
|---|
| 278 | je PCCTP_IFSdone ; 07 is HPFS internally
|
|---|
| 279 | PCCTP_ProbablyNTFS:
|
|---|
| 280 | inc PartSystemID ; 08 is NTFS instead of 07
|
|---|
| 281 | PCCTP_IFSdone:
|
|---|
| 282 |
|
|---|
| 283 | ; First check, if LVM Information Sector is available and this partition
|
|---|
| 284 | ; is supported.
|
|---|
| 285 | push ax dx si di
|
|---|
| 286 | mov si, wptr [PartPtr]
|
|---|
| 287 | mov ax, wptr [si+LocBRPT_RelativeBegin] ; Absolute Sector
|
|---|
| 288 | mov dx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 289 | add ax, wptr [CurPartition_Location+0] ; +Partition-Absolute
|
|---|
| 290 | adc dx, wptr [CurPartition_Location+2] ; sectors
|
|---|
| 291 | mov si, offset LVMSector
|
|---|
| 292 | call LVM_SearchForPartition ; Search for DX:AX partition
|
|---|
| 293 | jnc PCCTP_CheckBootRecord
|
|---|
| 294 | ; Check, if volume has driveletter assigned and remember it for later
|
|---|
| 295 | mov al, [si+LocLVM_VolumeLetter]
|
|---|
| 296 | or al, al
|
|---|
| 297 | jnz PCCTP_HasVolumeLetter
|
|---|
| 298 | mov al, 1 ; 0 would mean "not LVM supported"
|
|---|
| 299 | PCCTP_HasVolumeLetter:
|
|---|
| 300 | ; Save VolumeLetter in separate table
|
|---|
| 301 | ;movzx bx, NewPartitions ; NewPartitions is one behind here, so
|
|---|
| 302 | mov bl,NewPartitions ; NewPartitions is one behind here, so
|
|---|
| 303 | mov bh,0
|
|---|
| 304 |
|
|---|
| 305 | mov [PartitionVolumeLetters+bx], al ; it's already a zero-based offset
|
|---|
| 306 | ; Now copy VolumeID and VolumeName to temporary space
|
|---|
| 307 | mov di, offset MBR_NoName_Patched
|
|---|
| 308 | mov ax, [si+LocLVM_PartitionID]
|
|---|
| 309 | stosw
|
|---|
| 310 | mov ax, [si+LocLVM_PartitionID+2]
|
|---|
| 311 | stosw
|
|---|
| 312 | ; Set Serial-Field to LVM-VolumeID
|
|---|
| 313 | push di
|
|---|
| 314 | add si, LocLVM_PartitionName
|
|---|
| 315 |
|
|---|
| 316 | mov cx, 5
|
|---|
| 317 | rep movsw ; Copy LVM-PartitionName to Temp Space
|
|---|
| 318 | movsb ; (11 bytes in total)
|
|---|
| 319 |
|
|---|
| 320 | pop di
|
|---|
| 321 | cmp PartSystemID, 0ah
|
|---|
| 322 |
|
|---|
| 323 | jne PCCTP_NoIbmBm
|
|---|
| 324 | mov si, offset ibm_bm_name
|
|---|
| 325 | mov cx,5
|
|---|
| 326 | rep movsw
|
|---|
| 327 | movsb
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 | PCCTP_NoIbmBm:
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 | pop di si dx ax
|
|---|
| 335 | mov si, offset MBR_NoName_Patched
|
|---|
| 336 | xor ah, ah ; no Flags_NoPartName
|
|---|
| 337 | jmp PCCTP_NameSearchInIPT
|
|---|
| 338 |
|
|---|
| 339 | PCCTP_CheckBootRecord:
|
|---|
| 340 | pop di si dx ax
|
|---|
| 341 | test ah, FileSysFlags_NoName ; No-Name-Flag ? -> No Partition Name
|
|---|
| 342 |
|
|---|
| 343 | jz PCCTP_ThereIsAName
|
|---|
| 344 | jmp PCCTP_ThereIsNoName ; available
|
|---|
| 345 |
|
|---|
| 346 | PCCTP_ThereIsAName:
|
|---|
| 347 |
|
|---|
| 348 | ; We check for NTFS (got detected a little bit earlier in this routine)
|
|---|
| 349 | cmp PartSystemID, 08h ; We got IFS/NTFS here?
|
|---|
| 350 | jne PCCTP_IsNoNTFS
|
|---|
| 351 | jmp PCCTP_ThereIsNoName ; NTFS has no volume label
|
|---|
| 352 | PCCTP_IsNoNTFS:
|
|---|
| 353 | add si, 2Bh ; DS:SI - Partition-Name
|
|---|
| 354 | test ah, FileSysFlags_FAT32 ; FAT32 specific name getting ?
|
|---|
| 355 |
|
|---|
| 356 | jz PCCTP_ResumeNormal
|
|---|
| 357 |
|
|---|
| 358 | add si, 1Ch ; Fix for FAT 32, shiat
|
|---|
| 359 | PCCTP_ResumeNormal:
|
|---|
| 360 | mov cx, 11 ; 11 bytes length
|
|---|
| 361 | call PART_CheckForValidPartName
|
|---|
| 362 | jc PCCTP_ThereIsAName2
|
|---|
| 363 |
|
|---|
| 364 | jmp PCCTP_ThereIsNoName
|
|---|
| 365 |
|
|---|
| 366 | PCCTP_ThereIsAName2:
|
|---|
| 367 |
|
|---|
| 368 | sub si, 4 ; DS:SI -> Serial&Name (15-Bytes)
|
|---|
| 369 | xor ah, ah ; no Flags_NoPartName
|
|---|
| 370 | ; jmp PCCTP_NameSearchInIPT
|
|---|
| 371 |
|
|---|
| 372 | ;=======================================================
|
|---|
| 373 | ; NAME SEARCH in IPT-Table
|
|---|
| 374 | ; DS:SI - Serial&Name of Current Partition (15-Bytes)
|
|---|
| 375 | ; AH - NoPartName-Flag (!MUST! be merged with Flags)
|
|---|
| 376 | ;=======================================================
|
|---|
| 377 | PCCTP_NameSearchInIPT:
|
|---|
| 378 | xor ah, ah ; no Flags_NoPartName cause PartName valid
|
|---|
| 379 | mov di, offset PartitionTable ; ES:DI - IPT-Start
|
|---|
| 380 | mov dl, CFG_Partitions
|
|---|
| 381 | or dl, dl
|
|---|
| 382 | jnz PCCTP_SerialNameCompLoop
|
|---|
| 383 | jmp PCCTP_CompareFailed
|
|---|
| 384 | PCCTP_SerialNameCompLoop:
|
|---|
| 385 | mov al, [di+LocIPT_Flags]
|
|---|
| 386 | test al, Flags_NowFound
|
|---|
| 387 | jnz PCCTP_SerialNameAlreadyFound
|
|---|
| 388 | ; Now compare IPT with current Partition
|
|---|
| 389 | mov cx, 15 ; Serial&Name (15-Bytes)
|
|---|
| 390 | push si di
|
|---|
| 391 | repz cmpsb
|
|---|
| 392 | pop di si
|
|---|
| 393 |
|
|---|
| 394 | jne PCCTP_NoMatchYet
|
|---|
| 395 |
|
|---|
| 396 | jmp PCCTP_Match
|
|---|
| 397 |
|
|---|
| 398 | PCCTP_NoMatchYet:
|
|---|
| 399 |
|
|---|
| 400 | PCCTP_SerialNameAlreadyFound:
|
|---|
| 401 | add di, LocIPT_LenOfIPT
|
|---|
| 402 | dec dl
|
|---|
| 403 | jnz PCCTP_SerialNameCompLoop
|
|---|
| 404 |
|
|---|
| 405 | ; if we didn't find Serial&Name, let's try Name-only without Serial
|
|---|
| 406 | mov di, offset PartitionTable ; ES:DI - IPT-Start
|
|---|
| 407 | mov dl, CFG_Partitions
|
|---|
| 408 | PCCTP_NameCompLoop:
|
|---|
| 409 | mov al, [di+LocIPT_Flags]
|
|---|
| 410 | test al, Flags_NowFound
|
|---|
| 411 | jnz PCCTP_NameAlreadyFound
|
|---|
| 412 | ; Now compare IPT with current Partition
|
|---|
| 413 | mov cx, 11 ; Name only (11-Bytes)
|
|---|
| 414 | push si di
|
|---|
| 415 | add si, 4
|
|---|
| 416 | add di, 4 ; Skip over Serial-Field
|
|---|
| 417 | repz cmpsb
|
|---|
| 418 | pop di si
|
|---|
| 419 | jne PCCTP_NameNoMatch
|
|---|
| 420 | mov cx, [si+0] ; Get Serial
|
|---|
| 421 | mov [di+0], cx
|
|---|
| 422 | mov cx, [si+2]
|
|---|
| 423 | mov [di+2], cx ; ...and put it into IPT
|
|---|
| 424 | jmp PCCTP_Match
|
|---|
| 425 | PCCTP_NameNoMatch:
|
|---|
| 426 | PCCTP_NameAlreadyFound:
|
|---|
| 427 | add di, LocIPT_LenOfIPT
|
|---|
| 428 | dec dl
|
|---|
| 429 | jnz PCCTP_NameCompLoop
|
|---|
| 430 | PCCTP_NameCompFailed:
|
|---|
| 431 |
|
|---|
| 432 | ; So finally we search for Location and PartitionID
|
|---|
| 433 | push si
|
|---|
| 434 | ; Initialize some stuff for Location-Search
|
|---|
| 435 | mov dh, PartSystemID
|
|---|
| 436 | mov si, [PartPtr] ; DS:SI - Cur Partition Table
|
|---|
| 437 | ; Relative Sector to MBR/EPR
|
|---|
| 438 | mov cx, wptr [si+LocBRPT_RelativeBegin]
|
|---|
| 439 | mov bx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 440 | add cx, [CurPartition_Location+0]
|
|---|
| 441 | add bx, [CurPartition_Location+2]
|
|---|
| 442 | ; BX:CX - Absolute First Sector of Partition on HDD
|
|---|
| 443 | pop si
|
|---|
| 444 | mov di, offset PartitionTable ; ES:DI - IPT-Start
|
|---|
| 445 | mov dl, CFG_Partitions
|
|---|
| 446 | PCCTP_NameLocCompLoop:
|
|---|
| 447 | mov al, [di+LocIPT_Flags]
|
|---|
| 448 | test al, Flags_NowFound
|
|---|
| 449 | jnz PCCTP_NameLocAlreadyFound
|
|---|
| 450 | ; Now compare IPT with current Partition
|
|---|
| 451 | cmp dh, [di+LocIPT_SystemID]
|
|---|
| 452 | jne PCCTP_NameLocMismatch
|
|---|
| 453 | cmp cx, [di+LocIPT_AbsoluteBegin]
|
|---|
| 454 | jne PCCTP_NameLocMismatch
|
|---|
| 455 | cmp bx, [di+LocIPT_AbsoluteBegin+2]
|
|---|
| 456 | jne PCCTP_NameLocMismatch
|
|---|
| 457 | ; We matched location, now copy the current PartitionID and Name to
|
|---|
| 458 | ; the old IPT.
|
|---|
| 459 | push di
|
|---|
| 460 | add di, LocIPT_Serial ; DS:SI - LocIPT-Serial&Name
|
|---|
| 461 | mov cx, 15
|
|---|
| 462 | rep movsb ; Copy 15 bytes
|
|---|
| 463 | pop di
|
|---|
| 464 | jmp PCCTP_Match
|
|---|
| 465 | PCCTP_NameLocMismatch:
|
|---|
| 466 | PCCTP_NameLocAlreadyFound:
|
|---|
| 467 | add di, LocIPT_LenOfIPT
|
|---|
| 468 | dec dl
|
|---|
| 469 | jnz PCCTP_NameLocCompLoop
|
|---|
| 470 | ; None of the searches worked, so forget it...
|
|---|
| 471 | jmp PCCTP_CompareFailed
|
|---|
| 472 |
|
|---|
| 473 | PCCTP_ThereIsNoName:
|
|---|
| 474 | ; Try to find this partition by comparing location and PartitionID
|
|---|
| 475 | ; aka LocIPT_AbsoluteBegin:dword and LocIPT_SystemID
|
|---|
| 476 | ; If found, simply go to the normal match-routine, otherwise use the
|
|---|
| 477 | ; File-System-Name to build the Volume-Label for the New IPT Entry.
|
|---|
| 478 | mov dh, PartSystemID
|
|---|
| 479 | mov si, [PartPtr] ; DS:SI - Cur Partition Table
|
|---|
| 480 | ; Relative Sector to MBR/EPR
|
|---|
| 481 | mov cx, wptr [si+LocBRPT_RelativeBegin]
|
|---|
| 482 | mov bx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 483 | add cx, [CurPartition_Location+0]
|
|---|
| 484 | add bx, [CurPartition_Location+2]
|
|---|
| 485 | ; Build a standard-Volume Label from FileSystemNamePtr
|
|---|
| 486 | ; We have to call SearchFileSysName again because of NTFS
|
|---|
| 487 | push ax cx
|
|---|
| 488 | mov al, dh
|
|---|
| 489 | call PART_SearchFileSysName ; We want SI here <- FileSystemNamePtr
|
|---|
| 490 | mov di, offset MBR_NoName_Patched
|
|---|
| 491 | xor ax, ax
|
|---|
| 492 | stosw
|
|---|
| 493 | stosw ; Set Serial-Field to "NUL"
|
|---|
| 494 | mov cx, 4
|
|---|
| 495 | rep movsw ; Copy FileSystemName to Temp Space
|
|---|
| 496 | xor ax, ax
|
|---|
| 497 | stosw
|
|---|
| 498 | stosb ; Fill last 3 bytes with "NUL"
|
|---|
| 499 | mov si, offset MBR_NoName_Patched
|
|---|
| 500 | pop cx ax
|
|---|
| 501 | ;=======================================================
|
|---|
| 502 | ; LOCATION SEARCH in IPT-Table
|
|---|
| 503 | ; DH - PartitionID of Current Partition
|
|---|
| 504 | ; BX:CX - AbsoluteBegin of Current Partition
|
|---|
| 505 | ; AH - NoPartName-Flag (!MUST! be merged with Flags)
|
|---|
| 506 | ; DS:SI - Serial&Name of Current Partition (15-Bytes)
|
|---|
| 507 | ;=======================================================
|
|---|
| 508 | PCCTP_LocSearchInIPT:
|
|---|
| 509 | mov ah, Flags_NoPartName ;set Flags_NoPartName, PartName invalid
|
|---|
| 510 | mov di, offset PartitionTable ; ES:DI - IPT-Start
|
|---|
| 511 | mov dl, CFG_Partitions
|
|---|
| 512 | or dl, dl
|
|---|
| 513 | jz PCCTP_LocCompFailed
|
|---|
| 514 | PCCTP_LocCompLoop:
|
|---|
| 515 | mov al, [di+LocIPT_Flags]
|
|---|
| 516 | test al, Flags_NowFound
|
|---|
| 517 | jnz PCCTP_LocAlreadyFound
|
|---|
| 518 | ; Now compare IPT with current Partition
|
|---|
| 519 | cmp dh, [di+LocIPT_SystemID]
|
|---|
| 520 | jne PCCTP_LocMismatch
|
|---|
| 521 | cmp cx, [di+LocIPT_AbsoluteBegin]
|
|---|
| 522 | jne PCCTP_LocMismatch
|
|---|
| 523 | cmp bx, [di+LocIPT_AbsoluteBegin+2]
|
|---|
| 524 | jne PCCTP_LocMismatch
|
|---|
| 525 | jmp PCCTP_Match
|
|---|
| 526 | PCCTP_LocMismatch:
|
|---|
| 527 | PCCTP_LocAlreadyFound:
|
|---|
| 528 | add di, LocIPT_LenOfIPT
|
|---|
| 529 | dec dl
|
|---|
| 530 | jnz PCCTP_LocCompLoop
|
|---|
| 531 | PCCTP_LocCompFailed:
|
|---|
| 532 | jmp PCCTP_CompareFailed
|
|---|
| 533 |
|
|---|
| 534 | ; ==================================
|
|---|
| 535 | ; =MATCH=, found partition in IPT...
|
|---|
| 536 | ; AH - NoPartName-Flag (!MUST! be merged with Flags)
|
|---|
| 537 | ; DL - IPT Partition Number from Loop (inverted)
|
|---|
| 538 | ; ES:DI - LocIPT-Pointer to found IPT-entry
|
|---|
| 539 | ; ==================================
|
|---|
| 540 | PCCTP_Match:
|
|---|
| 541 | mov ch, ah
|
|---|
| 542 | ; Save the new location of this partition in the Xref-Table
|
|---|
| 543 | ; for converting HideConfig.
|
|---|
| 544 | mov dh, dl
|
|---|
| 545 | mov dl, CFG_Partitions
|
|---|
| 546 | sub dl, dh
|
|---|
| 547 | mov dh, NewPartitions ; is actually a counter
|
|---|
| 548 | call PARTSCAN_DefXref ; DL-IPT-Partition, DH-NewPartition
|
|---|
| 549 |
|
|---|
| 550 | ; Get Saved-Flags...
|
|---|
| 551 | mov cl, bptr [di+LocIPT_Flags] ; Use saved Flags
|
|---|
| 552 |
|
|---|
| 553 | ; ...and Saved-CRC if available...
|
|---|
| 554 | mov ax, wptr [di+LocIPT_BootRecordCRC]
|
|---|
| 555 | or ax, ax
|
|---|
| 556 | jz PCCTP_UseNewComputedCRC
|
|---|
| 557 | mov PartCRC, ax ; Use saved IPT-CRC
|
|---|
| 558 | PCCTP_UseNewComputedCRC:
|
|---|
| 559 | ; ...and mark partition in IPT as already found
|
|---|
| 560 | or bptr [di+LocIPT_Flags], Flags_NowFound
|
|---|
| 561 | ; ...get Serial&Name from IPT-table...
|
|---|
| 562 | mov si, di
|
|---|
| 563 | add si, LocIPT_Serial ; DS:SI - LocIPT-Serial&Name
|
|---|
| 564 | jmp PCCTP_AddToNew
|
|---|
| 565 |
|
|---|
| 566 | ; =================================
|
|---|
| 567 | ; =FAILED= search, not found in IPT
|
|---|
| 568 | ; AH - NoPartName-Flag (!MUST! be merged with Flags)
|
|---|
| 569 | ; DS:SI - Serial&Name of Current Partition (15-Bytes)
|
|---|
| 570 | ; =================================
|
|---|
| 571 | PCCTP_CompareFailed:
|
|---|
| 572 | mov ch, ah
|
|---|
| 573 | ; Default Flags hinzufgen...
|
|---|
| 574 | mov cl, LocIPT_DefaultFlags
|
|---|
| 575 |
|
|---|
| 576 | mov al, PartTypeFlags
|
|---|
| 577 | ; May I auto-add partitions ?
|
|---|
| 578 | test CFG_PartitionsDetect, 1
|
|---|
| 579 | jz PCCTP_MayNotAddAny ; add, but non-bootable
|
|---|
| 580 | test al, FileSysFlags_BootAble ; AH kam von SearchFileSysName
|
|---|
| 581 | jnz PCCTP_PerhapsBootAble
|
|---|
| 582 | PCCTP_MayNotAddAny:
|
|---|
| 583 | mov cl, LocIPT_DefaultNonBootFlags
|
|---|
| 584 | PCCTP_PerhapsBootAble:
|
|---|
| 585 |
|
|---|
| 586 | ; On FAT32-partitions, default to P-Flag (which means using M$-hack)
|
|---|
| 587 | ; Anyway, this hack has to be globaly activated by the user manually...
|
|---|
| 588 | cmp PartSystemID, 09h ; Hardcoded: FAT32
|
|---|
| 589 | je PCCTP_NeedsExtMShack
|
|---|
| 590 | cmp PartSystemID, 0Bh
|
|---|
| 591 | je PCCTP_NeedsExtMShack
|
|---|
| 592 | cmp PartSystemID, 0Ch
|
|---|
| 593 | je PCCTP_NeedsExtMShack
|
|---|
| 594 | cmp PartSystemID, 0Eh ; FAT16 above 8 GB
|
|---|
| 595 | jne PCCTP_NoExtMShack
|
|---|
| 596 | ; We only get here, when the SystemID seems to be an M$ "invention"...
|
|---|
| 597 | PCCTP_NeedsExtMShack:
|
|---|
| 598 | or cl, Flags_ExtPartMShack
|
|---|
| 599 | PCCTP_NoExtMShack:
|
|---|
| 600 |
|
|---|
| 601 | ;================================================
|
|---|
| 602 | ; CL - IPT-Partition-Flags, CH - NoPartName-Flag
|
|---|
| 603 | ; DS:SI - PartSerial&Name (15-Bytes)
|
|---|
| 604 | ;================================================
|
|---|
| 605 | PCCTP_AddToNew:
|
|---|
| 606 | mov al, Flags_NoPartName ; Unset NoPartName
|
|---|
| 607 | not al
|
|---|
| 608 | and cl, al
|
|---|
| 609 | or cl, ch ; CL = Both CL and CH merged
|
|---|
| 610 |
|
|---|
| 611 | ; Calculate Pointer to IPT
|
|---|
| 612 | mov di, offset NewPartTable ; ES:DI - NewPartTable
|
|---|
| 613 | ;movzx ax, NewPartitions
|
|---|
| 614 | mov al,NewPartitions
|
|---|
| 615 | mov ah,0
|
|---|
| 616 |
|
|---|
| 617 | mov bl, LocIPT_LenOfIPT
|
|---|
| 618 | mul bl
|
|---|
| 619 | add di, ax ; ES:DI - Last+1 Entry of NewPartTable
|
|---|
| 620 |
|
|---|
| 621 | ; Now finally write this partition to our IPT
|
|---|
| 622 | ;=============================================
|
|---|
| 623 | push cx
|
|---|
| 624 | mov cx, 15 ; Copy Serial&Name...
|
|---|
| 625 | rep movsb
|
|---|
| 626 | pop cx
|
|---|
| 627 |
|
|---|
| 628 | mov si, [PartPtr] ; DS:SI - Cur Partition Entry
|
|---|
| 629 | mov al, bptr [CurPartition_Location+4] ; Drive
|
|---|
| 630 | stosb
|
|---|
| 631 | mov al, PartSystemID ; Unhidden SystemID
|
|---|
| 632 | stosb
|
|---|
| 633 | mov al, cl ; Partition-Flags from register...
|
|---|
| 634 | stosb
|
|---|
| 635 | mov ax, PartCRC ; BootRecordCRC...
|
|---|
| 636 | stosw
|
|---|
| 637 | mov al, bptr [si+LocBRPT_BeginHead]
|
|---|
| 638 | stosb
|
|---|
| 639 | mov ax, wptr [si+LocBRPT_BeginSector] ; Cylinder/Sector
|
|---|
| 640 | stosw
|
|---|
| 641 | mov al, bptr [CurPartition_Location+5] ; Head of Part-Table
|
|---|
| 642 | stosb
|
|---|
| 643 | mov ax, wptr [CurPartition_Location+6] ; Cylinder/Sector
|
|---|
| 644 | stosw
|
|---|
| 645 | mov ax, wptr [si+LocBRPT_RelativeBegin]
|
|---|
| 646 | mov bx, wptr [si+LocBRPT_RelativeBegin+2]
|
|---|
| 647 | mov cx, wptr [CurPartition_Location+0] ; +Partition-Absolute
|
|---|
| 648 | mov dx, wptr [CurPartition_Location+2] ; sectors
|
|---|
| 649 | add ax, cx
|
|---|
| 650 | adc bx, dx
|
|---|
| 651 | stosw
|
|---|
| 652 | mov ax, bx
|
|---|
| 653 | stosw
|
|---|
| 654 | mov ax, cx ; Absolute sector of partition table
|
|---|
| 655 | stosw
|
|---|
| 656 | mov ax, dx
|
|---|
| 657 | stosw
|
|---|
| 658 | inc NewPartitions ; NEW IPT Entry DONE
|
|---|
| 659 |
|
|---|
| 660 | cmp NewPartitions, LocIPT_MaxPartitions
|
|---|
| 661 | jbe PCCTP_NotTooManyPartitions
|
|---|
| 662 | mov si, offset TXT_TooManyPartitions
|
|---|
| 663 | call MBR_Teletype
|
|---|
| 664 | jmp MBR_HaltSystem
|
|---|
| 665 |
|
|---|
| 666 | PCCTP_NotTooManyPartitions:
|
|---|
| 667 | ; UNHIDE PARTITION, if it was hidden previously
|
|---|
| 668 | mov al, PartSystemID
|
|---|
| 669 | cmp al, 08h ; internally IFS/NTFS?
|
|---|
| 670 | je PCCTP_GotInternalIFS
|
|---|
| 671 | cmp al, 0FCh ; internally IFS/JFS?
|
|---|
| 672 | jne PCCTP_NoInternalIFS
|
|---|
| 673 | PCCTP_GotInternalIFS:
|
|---|
| 674 | mov al, 07h
|
|---|
| 675 | PCCTP_NoInternalIFS:
|
|---|
| 676 | mov bptr [si+LocBRPT_SystemID], al
|
|---|
| 677 |
|
|---|
| 678 | ; Calculate Size of this partition and put it into separate table...
|
|---|
| 679 | ;movzx ax, NewPartitions
|
|---|
| 680 | mov al,NewPartitions
|
|---|
| 681 | mov ah,0
|
|---|
| 682 |
|
|---|
| 683 | dec ax
|
|---|
| 684 | mov bx, ax
|
|---|
| 685 | shl ax, 1
|
|---|
| 686 | shl bx, 2
|
|---|
| 687 | add ax, bx ; My way [tm] of multiplying with 6
|
|---|
| 688 | mov di, offset PartitionSizeTable
|
|---|
| 689 | add di, ax ; DI - Partition Size-Element
|
|---|
| 690 | mov ax, wptr [si+LocBRPT_AbsoluteLength] ; Sector-Size
|
|---|
| 691 | mov bx, wptr [si+LocBRPT_AbsoluteLength+2]
|
|---|
| 692 | call PART_FillOutSizeElement
|
|---|
| 693 | ret
|
|---|
| 694 | PARTSCAN_CheckThisPartition EndP
|
|---|
| 695 |
|
|---|
| 696 | ; ===================
|
|---|
| 697 | ; X-REFERENCE STUFF -> PartitionXref
|
|---|
| 698 | ; ===================
|
|---|
| 699 |
|
|---|
| 700 | ; Reset X-Reference
|
|---|
| 701 | PARTSCAN_ResetXref Proc Near Uses ax cx di
|
|---|
| 702 | mov di, offset PartitionXref ; X-Reference for later syncing
|
|---|
| 703 | mov cx, LocIPT_MaxPartitions
|
|---|
| 704 | mov ax, 0FFFFh ; Fill up with FFh
|
|---|
| 705 | rep stosb
|
|---|
| 706 | mov di, offset NewHidePartTable ; Temporary Hide-Config Table
|
|---|
| 707 | mov cx, 450 ; Size is 900
|
|---|
| 708 | rep stosw ; Fill up with FFFFh
|
|---|
| 709 | mov di, offset NewDriveLetters
|
|---|
| 710 | mov cx, 15 ; Temporary Logical-Drive Letter Table
|
|---|
| 711 | xor ax, ax ; Size is 30
|
|---|
| 712 | rep stosw ; Fill up with 0000h
|
|---|
| 713 | ret
|
|---|
| 714 | PARTSCAN_ResetXref EndP
|
|---|
| 715 |
|
|---|
| 716 | ; In: DL - Partition Number in IPT
|
|---|
| 717 | ; DH - Partition Number in NewPartitionTable
|
|---|
| 718 | ; Destroyed: None
|
|---|
| 719 | PARTSCAN_DefXref Proc Near Uses ax bx cx dx si di
|
|---|
| 720 | ;movzx bx, dl
|
|---|
| 721 | mov bl,dl
|
|---|
| 722 | mov bh,0
|
|---|
| 723 |
|
|---|
| 724 | mov bptr [PartitionXref+bx], dh ; X-Reference
|
|---|
| 725 | ; Copy Hide-Config of IPT partition to new location in new table
|
|---|
| 726 | mov si, offset HidePartitionTable
|
|---|
| 727 | mov di, offset NewHidePartTable
|
|---|
| 728 | mov bl, LocIPT_MaxPartitions
|
|---|
| 729 | mov al, dl
|
|---|
| 730 | mul bl
|
|---|
| 731 | add si, ax
|
|---|
| 732 | mov al, dh
|
|---|
| 733 | mul bl
|
|---|
| 734 | add di, ax
|
|---|
| 735 | mov cx, LocIPT_MaxPartitions
|
|---|
| 736 | rep movsb ; Copy Hide-Config to NewHideTable
|
|---|
| 737 | ; Process Logical-Drive-Letter table as well...
|
|---|
| 738 | ;movzx bx, dl
|
|---|
| 739 | mov bl,dl
|
|---|
| 740 | mov bh,0
|
|---|
| 741 |
|
|---|
| 742 | mov al, bptr [DriveLetters+bx] ; Get Drv-Letter from org. pos
|
|---|
| 743 | ;movzx bx, dh
|
|---|
| 744 | mov bl,dl
|
|---|
| 745 | mov bh,0
|
|---|
| 746 |
|
|---|
| 747 | mov bptr [NewDriveLetters+bx], al ; Put Drv-Letter to new pos
|
|---|
| 748 | ret
|
|---|
| 749 | PARTSCAN_DefXref EndP
|
|---|
| 750 |
|
|---|
| 751 | ; In: DL - Partition Number in previous IPT
|
|---|
| 752 | ; Out: DH - Partition Number in NewPartitionTable
|
|---|
| 753 | ; Destroyed: None
|
|---|
| 754 | PARTSCAN_GetXref Proc Near Uses bx
|
|---|
| 755 | ;movzx bx, dl
|
|---|
| 756 | mov bl,dl
|
|---|
| 757 | mov bh,0
|
|---|
| 758 |
|
|---|
| 759 | mov dh, bptr [PartitionXref+bx] ; X-Reference
|
|---|
| 760 | ret
|
|---|
| 761 | PARTSCAN_GetXref EndP
|
|---|
| 762 |
|
|---|
| 763 | ; This here updates the contents of the Hide-Configuration to the current IPT
|
|---|
| 764 | ; table.
|
|---|
| 765 | PARTSCAN_SyncHideConfigWithXref Proc Near Uses ax bx cx dx si di
|
|---|
| 766 | mov si, offset NewHidePartTable
|
|---|
| 767 | mov di, offset HidePartitionTable
|
|---|
| 768 | mov ch, LocIPT_MaxPartitions
|
|---|
| 769 | PSSHCWX_SyncPartLoop:
|
|---|
| 770 | mov cl, LocIPT_MaxPartitions
|
|---|
| 771 | xor dl, dl ; Partition Lost Counter
|
|---|
| 772 | PSSHCWX_SyncLoop:
|
|---|
| 773 | lodsb ; Get Part-Pointer from Hide-Cfg
|
|---|
| 774 | cmp al, 0FFh
|
|---|
| 775 | je PSSHCWX_SyncEmpty
|
|---|
| 776 | ;movzx bx, al
|
|---|
| 777 | mov bl,al
|
|---|
| 778 | mov bh,0
|
|---|
| 779 |
|
|---|
| 780 | mov al, [PartitionXref+bx] ; Translate it
|
|---|
| 781 | cmp al, 0FFh
|
|---|
| 782 | je PSSHCWX_PartLost
|
|---|
| 783 | PSSHCWX_SyncEmpty:
|
|---|
| 784 | stosb ; Put translated pointer to new table
|
|---|
| 785 | dec cl
|
|---|
| 786 | jnz PSSHCWX_SyncLoop
|
|---|
| 787 | jmp PSSHCWX_SyncLoopEnd
|
|---|
| 788 | PSSHCWX_PartLost:
|
|---|
| 789 | inc dl ; One partition got lost...
|
|---|
| 790 | dec cl
|
|---|
| 791 | jnz PSSHCWX_SyncLoop
|
|---|
| 792 |
|
|---|
| 793 | PSSHCWX_SyncLoopEnd:
|
|---|
| 794 | or dl, dl
|
|---|
| 795 | jz PSSHCWX_NothingLost
|
|---|
| 796 | mov al, 0FFh
|
|---|
| 797 | PSSHCWX_LostFillLoop:
|
|---|
| 798 | stosb
|
|---|
| 799 | dec cl
|
|---|
| 800 | jnz PSSHCWX_LostFillLoop
|
|---|
| 801 | PSSHCWX_NothingLost:
|
|---|
| 802 | dec ch
|
|---|
| 803 | jnz PSSHCWX_SyncPartLoop
|
|---|
| 804 | ret
|
|---|
| 805 | PARTSCAN_SyncHideConfigWithXref EndP
|
|---|
| 806 |
|
|---|
| 807 | ibm_bm_name: db 'IBM BootMan',0
|
|---|
| 808 | ;win_bm_name: db 'BOOTMGR',0
|
|---|