China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-30 04:00
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Disk sector reading and writing, partition information management tool Dsptw (updated on 2008.11.29) View 112,538 Replies 565
Floor 376 Posted 2008-09-25 12:18 ·  中国 新疆 乌鲁木齐 电信
初级用户
Credits 37
Posts 20
Joined 2006-03-31 15:10
20-year member
UID 53103
Status Offline
Floor 377 Posted 2008-10-02 19:24 ·  中国 北京 海淀区 联通
中级用户
★★
Credits 256
Posts 133
Joined 2008-09-29 13:30
17-year member
UID 126984
Gender Male
Status Offline
A very useful tool, thanks to the楼主.
Floor 378 Posted 2008-10-03 18:14 ·  中国 河南 郑州 联通
新手上路
Credits 2
Posts 1
Joined 2008-09-07 10:34
17-year member
UID 125021
Gender Male
Status Offline
Floor 379 Posted 2008-10-07 00:51 ·  中国 重庆 渝中区 电信
新手上路
Credits 7
Posts 7
Joined 2008-09-27 11:14
17-year member
UID 126770
Gender Male
Status Offline
Great stuff, admire!!
Floor 380 Posted 2008-10-10 11:20 ·  中国 河北 唐山 联通
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
When there are two hard drives, some BIOS sets HDD0 as the first boot drive, and some sets HDD1 as the first boot. The former has no problem, but the latter will have problems:

Windows and GHOST show inconsistent hard drive numbers. For example, if both hard drive 0 and hard drive 1 have two partitions:

Under Windows (with GhostStyle parameter):

1:1 E:
1:2 F:

2:2 C:
2:2 D:

In DOS's GHOST, it shows as:

1:1 C:
1:2 D:

2:1 E:
2:2 F:

That is to say, DOS thinks that whoever boots is the boss, and does not consider the order of the IDE interface.

So, please ask the landlord to add a layer of judgment. If the hard drive number where the C drive is located is not the first hard drive, force it to be displayed as the first hard drive.

Editing idea:

Here, only up to 4 hard drives can be considered (because there are rarely more than 5):

When the C drive is on the first hard drive, it is displayed normally.
When the C drive is on the second hard drive, the original first one is displayed as the second one, and the original second one is displayed as the first one.
When the C drive is on the third hard drive, the original first one is displayed as the second one, the original second one is displayed as the third one, and the original third one is displayed as the first one.
When the C drive is on the fourth hard drive, the original first one is displayed as the second one, the original second one is displayed as the third one, the original third one is displayed as the fourth one, and the original fourth one is displayed as the first one.

The advantage of this is that parameters like 1:1 can be directly referenced in DOS without converting 2:1 to 1:1.

[ Last edited by gmy on 2008-10-10 at 11:40 ]
DOS之家 http://doshome.com 站长 葛明阳
Floor 381 Posted 2008-10-10 16:15 ·  中国 福建 厦门 电信
高级用户
★★★
Credits 741
Posts 366
Joined 2007-07-25 19:11
18-year member
UID 94024
Gender Male
Status Offline
The hard disk that is booted will be assigned the hard disk number 80H by the BIOS, so DOS mounts it to the drive letter C:. While WINDOWS directly assigns drive letters according to the scanning order. From the perspective of the BIOS, DOS is correct, and the hard disk number assigned to the booted hard disk is indeed the first one (although it may be the Second Channel Slave).

In addition, Dell's hidden partitions seem to be relatively standardized for DE, and DB should not be used as it will conflict with CT DOS. Other hidden partitions are A0: IBM Thinkpad hidden partition, 84: OS/2 hidden C:, 93: linux hidden, 1E: VFAT (LBA) hidden partition, 11: FAT12 hidden partition.

[ Last edited by netwinxp on 2008-10-10 at 16:36 ]
Floor 382 Posted 2008-10-11 08:01 ·  中国 北京 电信
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by gmy at 2008-10-10 11:20:
When there are two hard drives, some BIOS sets HDD0 as the first boot drive, and some set HDD1 as the First BOOT. The former has no problem, but the latter will have problems:

Windows and GHOST show inconsistent hard drive numbers. For example: Suppose both hard drive 0 and hard drive 1 have two partitions:

Under Windows (with GhostStyle parameter):

1:1 E:
1:2 F:

2:2 C:
2:2 D:

In DOS's GHOST, it shows:

1:1 C:
1:2 D:

2:1 E:
2:2 F:

That is to say, DOS thinks that whoever boots is the boss, regardless of the IDE interface order.


This is caused by the Windows operating system itself, not by my program. I provide a patch program to meet your requirements.


This program is specially used to process the results generated by the following commands:
dsptw /a /pdr
dsptw /a /pdr /reverse
After processing, the result is consistent with Dos's ghost.

Usage:
todosghs result.txt

Source of result.txt:
dsptw /a /pdr >result.txt
or
dsptw /a /pdr /reverse >result.txt

Download address:
http://upload.cn-dos.net/img/918.rar
Floor 383 Posted 2008-10-16 15:17 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Some antivirus software (such as avast, etc.) will report that dsptw contains a trojan, hope to solve it. I don't know if it is because of the reason that it is packed with a shell.
Windows 一键还原
http://www.yjhy.com
Floor 384 Posted 2008-10-17 20:32 ·  中国 北京 电信
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by lianjiang2004 at 2008-10-16 15:17:
Some antivirus software (such as avast, etc.) will detect dsptw as a trojan horse. Hope to solve this.
I wonder if it is because of the added shell.


Try this version, I recompiled it
http://upload.cn-dos.net/img/954.rar
Floor 385 Posted 2008-10-18 07:52 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Thanks, I'll have someone try it.
Windows 一键还原
http://www.yjhy.com
Floor 386 Posted 2008-10-18 11:22 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Some people reported that the antivirus software avast that originally detected viruses no longer detects viruses for the new version. Thanks.
Windows 一键还原
http://www.yjhy.com
Floor 387 Posted 2008-10-25 12:36 ·  中国 北京 电信
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Changes from the original version

1. Add parameter Offset
This parameter is used to specify the offset position inside the file, with a default value of 0 (the start of the file)
If the value of Offset is given but the file does not exist, the given Offset value is ignored.
Example:
Diskrw C: 0 10 /S sector.bin 10
Write 10 sectors from the starting position of disk C: to file sector.bin. If the file does not exist, the size of sector.bin is 5120 bytes.
If the file exists, if the file size is less than 10 bytes, the program will give an error message. If the file size is greater than or equal to 10 bytes, the program will write the sector content into the 5120 bytes starting from offset 10 in the file. The original information in the file will be overwritten (if the file length is less than 5130 bytes, the file length will increase).


DISKRW
Disk: 0-First Hard Disk, 1-Second Hard Disk, ...
A:, B:, C:, D: ...
Start: Disk Absolute Sector Number
Sectors: Total Sectors to be Processed
/S: Save Disk Sector Info to File
/R: Restore Disk Sector Info from File
/C: Compare Disk Sector Info with File
FileName: Disk Sector Info File
/Offset: The Offset In FileName

2. Add function /M
This function has long been implemented in the win32 version. Move the content of Sectors sectors starting from position Start on disk Disk to the position of Offset on disk DstDisk. After moving, the sector information at the corresponding position on Disk will be cleared. If the positions of the moved-out sectors and the moved-in sectors overlap, the program will intelligently select the part of the sector to be cleared.

DISKRW
/D: Duplicate Disk Sector Info from Disk to DstDisk
/O: cOmpare Disk Sector Info with DstDisk
/M: Move Disk Sector Info from Disk to DstDisk
DstDisk: 0-First Hard Disk, 1-Second Hard Disk, ...
A:, B:, C:, D: ...
Offset: Disk Absolute Sector Number

3. Add parameter /Asc
Editing the disk can directly use ASCII code, with a length not exceeding 16 characters.

DISKRW :
SectorNo: Disk Absolute Secotor Number
Offset: Offset in Specified Sector (0..511)
/E: Edit Disk Sector Info
/Hex: Hex Style
/Asc: ASCII Style
Value: Hex_Digital/ASCII String (32/16 Characters Maximum)

4. Sector internal processing command (only process a single sector)
If Bytes input is 0 or the input data is relatively large (exceeds the sector boundary), the program will process the number of bytes from Offset to the end of the sector

Example:
Diskrw 0 0 446 /b 64 mbr.dat Backup 64 bytes starting from offset position 446 in the first sector (sector 0) of the first hard disk (disk 0) to file mbr.dat. (Here, the partition table information in the disk MBR is backed up)



DISKRW
/B: Backup Disk Sector Info to File
/V: Vertify Disk Sector Info with File
/U: Update Disk Sector Info from File
Bytes: Bytes to Process (0..512)

[ Last edited by 19951001 on 2008-10-29 at 21:02 ]
Floor 388 Posted 2008-11-01 16:50 ·  中国 北京 电信
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
2008.11.11 Diskrw program update

[ Last edited by 19951001 on 2008-11-11 at 23:31 ]
Attachments
diskrw.rar (25.37 KiB, Downloads: 317)
Floor 389 Posted 2008-11-13 14:20 ·  中国 北京 鹏博士BGP
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
This version is the final version of Diskrw for Dos. If no bugs are found, there will be no more updates in the future.

The changes from the previous version are as follows:

Add commands:

1. Sector internal filling command
DISKRW
/I: Fill Disk Sector Data with Value

Example:
diskrw 0 10 2 /i 10 5
Fill 10 bytes starting from offset position 2 of sector 10 on disk 0 with 5.
If the Value is not entered, the default is 0.

If Bytes is entered as 0, then Bytes = 512 - Offset;

2. Sector internal data copy, move, compare command
DISKRW
SectNo: Disk Absolute Sector Number
/T: duplicaTe Disk Sector Data from Disk to dstDisk
/A: Move Disk Sector Data from Disk to dstDisk
/P: comPare Disk Sector Data with dstDisk

Example:
diskrw 0 0 446 /T 0 1 446 64
Copy 64 bytes starting from offset position 446 of sector 0 on disk 0 to offset position 446 of sector 1 on disk 0

If Bytes is entered as 0, then Bytes takes the smaller value of the number of bytes from Offset to the end of the sector in the source disk and the destination disk;

If the entered value of Bytes satisfies Bytes + Offset > 512, that is, exceeding one sector, then Bytes = 512 - Offset, that is, in any case, it will not exceed the sector processing.
Attachments
DISKRW.rar (18.42 KiB, Downloads: 647)
Floor 390 Posted 2008-11-13 17:56 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Received, thank you.
Windows 一键还原
http://www.yjhy.com
‹ Prev 1 24 25 26 27 28 38 Next ›
Forum Jump: