線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1958
推到 Plurk!
推到 Facebook!

要如何得知IDE channel與storage間的關連呢?

 
greatcat
一般會員


發表:7
回覆:9
積分:3
註冊:2005-01-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-12-18 20:34:52 IP:61.242.xxx.xxx 未訂閱
我可以用如下程式,使用hdc,diskdrive,cdrom,來找電腦上有哪些storage設備的訊息.
要如何得知IDE channel與storage間的關連呢?
例如得知,
IDE0,master,有Harddisk "HTS424040M9AT00"
IED1,slave,有DVDROM "QSI DVD-ROM SDR-081"

procedure TForm1.Button1Click(Sender: TObject);
var
st1,st2:string;
nLen:ULONG;
dw1,dw2:dword;
typeP,rs:DWORD;
DEviceName:array [0..600] of char;
label
loops;
begin
listbox1.Clear;
DeviceIndex:=0;
nLen:=255;
st1:=edit1.Text;
if not SetupDiClassGuidsFromName(pchar(st1),@guid1,1,nlen) then
begin
FormatMessage1('SetupDiClassGuidsFromName');
end;
if nlen=0 then
begin
listbox1.Items.Add('!!!No such class Setup GUID');
if autorun_flg=1 then
begin
timer1.Enabled:=true;
end;
exit;
end;
listbox1.Items.Add(guid2str(guid1));
NewDeviceInfoSet:=Pointer(INVALID_HANDLE_VALUE);
NewDeviceInfoSet:=SetupDiGetClassDevs(@guid1,nil,0,DIGCF_PRESENT);
if NewDeviceInfoSet=Pointer(INVALID_HANDLE_VALUE) then
begin
FormatMessage1('SetupDiGetClassDevs');
exit;
end;
loops:
DeviceInfoData.cbSize:=sizeof(TSPDEVINFODATA);
if not SetupDiEnumDeviceInfo(NewDeviceInfoSet,DeviceIndex,DeviceInfoData) then
begin
FormatMessage1('SetupDiEnumDeviceInfo');
if autorun_flg=1 then
begin
timer1.Enabled:=true;
end;
exit;
end;
if SetupDiGetDeviceRegistryProperty(NewDeviceInfoSet,DeviceInfoData,
SPDRP_DEVICEDESC,@typeP,@DEviceName,sizeof(DEviceName),@rs) then
begin
st1:=strpas(DEviceName);
listbox1.Items.Add(st1);
for dw1:=0 to $23 do
begin
if SetupDiGetDeviceRegistryProperty(NewDeviceInfoSet,DeviceInfoData,
dw1,@typeP,@DEviceName,sizeof(DEviceName),@rs) then
begin
st1:=format('%2.2x:',[dw1,length(strpas(DEviceName))]) strpas(DEviceName);
listbox1.Items.Add(st1);
end;
end;
listbox1.Items.Add('===========================');
inc(DeviceIndex);
goto loops;
end
else
begin
FormatMessage1('SetupDiGetDeviceRegistryProperty');
end;
end;
------
我喵故我在
系統時間:2024-05-09 7:54:52
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!