2013-03-29 89 views
0

我检查了microsoft technet论坛的VloumeID工具和“http://www.xboxharddrive.com/freeware.html”中的“硬盘序列号更改”工具。 但这些工具只提供更改VolumeID。疗法是一种安全的方式来产生,而不与可能在同一台PC生成一个新的卷ID

+0

我错过了这个问题与德尔福有什么关系。你可以解释吗?否则,它似乎更像是一个[su]的问题。 –

回答

4

我假设你想以编程方式设置卷序列号上不存在其他逻辑盘的其他VolumeIDs冲突的一个新的。

根据当前日期/时间生成卷序列号(VSN)。每个操作系统版本和/或用于格式的工具的具体实施细节可能有所不同。

请参见以下链接,了解更多信息:

从鲁弗斯源代码:

/* 
* 28.2 CALCULATING THE VOLUME SERIAL NUMBER 
* 
* For example, say a disk was formatted on 26 Dec 95 at 9:55 PM and 41.94 
* seconds. DOS takes the date and time just before it writes it to the 
* disk. 
* 
* Low order word is calculated: Volume Serial Number is: 
* Month & Day 12/26 0c1ah 
* Sec & Hundrenths 41:94 295eh 3578:1d02 
* ----- 
* 3578h 
* 
* High order word is calculated: 
* Hours & Minutes 21:55 1537h 
* Year 1995 07cbh 
* ----- 
* 1d02h 
*/ 

static DWORD GetVolumeID(void) 
{ 
SYSTEMTIME s; 
DWORD d; 
WORD lo,hi,tmp; 

GetLocalTime(&s); 

lo = s.wDay + (s.wMonth << 8); 
tmp = (s.wMilliseconds/10) + (s.wSecond << 8); 
lo += tmp; 

hi = s.wMinute + (s.wHour << 8); 
hi += s.wYear; 

d = lo + (hi << 16); 
return d; 
} 

它转换为以下Delphi代码:

type 
    TVolumeId = record 
    case byte of 
     0: (Id: DWORD); 
     1: (
     Lo: WORD; 
     Hi: WORD; 
    ); 
    end; 

function GetVolumeID: DWORD; 
var 
    dtNow: TDateTime; 
    vlid: TVolumeId; 
    st: SYSTEMTIME; 
begin 
    GetLocalTime(st); 
    vlid.Lo := st.wDay + (st.wMonth shl 8); 
    vlid.Lo := vlid.Lo + (st.wMilliseconds div 10 + (st.wSecond shl 8)); 

    vlid.Hi := st.wMinute + (st.wHour shl 8); 
    vlid.Hi := vlid.Hi + st.wYear; 

    Result := vlid.Id 
end; 
+0

MAX(HI)= 2013 + 59 + 23 * 256 = 0x1F18(也,头文件读取此方法就是不再在Windows中使用) – OnTheFly

+0

作为的Remko说,是的,我希望通过编程设定,但我一直在寻找将其设置为NTFS而不是FAT。无论如何,thx很多Remko。这对我生成一个新的VolumeID帮助很大。我会仔细看看的。 Thx再次。 – Bahaa