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-07-27 10:28
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Add some motivation to the forum!! Here's a little project!! Hard drive serial number View 2,451 Replies 4
Original Poster Posted 2009-11-30 21:15 ·  中国 黑龙江 伊春 伊美区 联通
初级用户
Credits 25
Posts 8
Joined 2009-03-12 00:01
17-year member
UID 141040
Gender Male
Status Offline
Hope that the experts in the forum can do me a favor and compile a small program under DOS!

Requirement: Read the hard disk serial number (SN serial number includes serial port large hard disk) under pure DOS, any language is okay, need EXE and source code or driver, preferably like MHDD to read directly without going through BIOS!~

I am willing to pay 100 RMB as an encouragement (no backtracking, you can rest assured about this), just a little token of appreciation.

I know there are many experts, so the first come first served. If everyone makes one, I really can't afford it, heh heh

Those who have time and the ability please contact me by phone first (I will call back)! Thank you!

Contact number: 15046565050 Tong Li
Email: tongli.net@126.com (please attach your Agricultural Bank or Industrial and Commercial Bank account when sending the program) Payment immediately upon success!

Why no one replies? Is it impossible to implement under DOS, or what's the reason?

[ Last edited by tongli on 2009-12-6 at 10:55 ]
Floor 2 Posted 2010-01-02 23:36 ·  中国 台湾 中华电信(HiNet)数据中心
初级用户
Credits 68
Posts 17
Joined 2008-03-02 14:38
18-year member
UID 111866
Gender Male
Status Offline
Free ~~~~~~~~~~~~


// Pass in drive letter A / B / C - Z
// Turbo C / Borland C writing method
long GetDiskSerial(char driver)
{
union REGS regs;
struct SREGS sregs;

struct DISK
{
unsigned code;
long serial;
char volume;
char type;
} SERIAL;

regs.h.ah = 0x69;
regs.h.al = 0x00;
regs.h.bl = toupper(driver) - 'A' + 1;
regs.x.dx = FP_OFF(&SERIAL);
sregs.ds = FP_SEG(&SERIAL);

intdosx(&regs, &regs, &sregs);
if (regs.x.cflag == 0) return (SERIAL.serial); else return (0);
}


// Pass in drive letter A / B / C - Z
// Writing method under WINDOWS with MINGW32
DWORD GetDiskSerial(char driver)
{
char lpRootPathName;
char lpVolumeNameBuffer;
DWORD nVolumeNameSize = 256;
DWORD lpVolumeSerialNumber;
DWORD lpMaximumComponentLength;
DWORD lpFileSystemFlags;
char lpFileSystemNameBuffer;
DWORD nFileSystemNameSize = 256;

sprintf(lpRootPathName, "%c:\\", driver);

GetVolumeInformation(
lpRootPathName,
lpVolumeNameBuffer,
nVolumeNameSize,
&lpVolumeSerialNumber,
&lpMaximumComponentLength,
&lpFileSystemFlags,
lpFileSystemNameBuffer,
nFileSystemNameSize );

return(lpVolumeSerialNumber);
}


// Pass in drive letter A / B / C - Z
// Writing method under DOS with DJGPP
DWORD GetDiskSerial(char driver)
{
__dpmi_regs regs;
char Buffer;
char *ts, *ss;
unsigned Serial;

if (driver < 'A' || driver > 'Z') return (0);

regs.h.ah = 0x69;
regs.h.al = 0x00;
regs.h.bl = driver - 'A' + 1;
regs.x.ds = __tb >> 4;
regs.x.dx = __tb & 0x0f;

__dpmi_int (0x21, &regs);
if (regs.x.flags & 1) return (0);

dosmemget (__tb, 30, &Buffer);
ts = &Buffer;
ss = (char *)&Serial;
*ss++ = *ts++;
*ss++ = *ts++;
*ss++ = *ts++;
*ss++ = *ts++;
return (Serial);
}
Floor 3 Posted 2010-01-04 15:33 ·  中国 辽宁 大连 金州区 联通
中级用户
★★
www.ecgui.com
Credits 272
Posts 123
Joined 2006-09-23 07:38
19-year member
UID 63446
Status Offline
The code posted by the user upstairs is quite good!
eCGUI-微型嵌入式GUI/ DOS/Linux/uC/OS-II/等 图形界面开发
www.ecgui.com
Floor 4 Posted 2010-01-04 17:57 ·  中国 北京 电信
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by winson4829 at 2010-1-2 23:36:
FREE~~~~~~~~~~~~


// Pass the drive letter A / B / C - Z
// Turbo C / Borland C syntax
long GetDiskSerial(char driver)
{
union REGS regs;
struct SREGS sregs;

struct DISK
...

I think the landlord wants the hard disk serial number, it should be the following one, right
Attachments
未命名x.GIF
Floor 5 Posted 2010-10-05 22:48 ·  中国 安徽 合肥 电信
新手上路
Credits 19
Posts 8
Joined 2010-01-08 11:08
16-year member
UID 158225
Gender Male
Status Offline
Yeah. .. Where is the number... I also need this. The motherboard serial number, hard drive serial number, etc. As long as it's a hardware number, but unfortunately I just can't find it
Forum Jump: