Thread View: pl.comp.programming
12 messages
12 total messages
Started by stud... Tomasz Frontczak
Mon, 22 Jan 1996 00:00
Numer seryjny HDD
Author: stud... Tomasz Frontczak
Date: Mon, 22 Jan 1996 00:00
Date: Mon, 22 Jan 1996 00:00
6 lines
531 bytes
531 bytes
Moze ktos wie jak programowo w Pascalu lub C odczytac numer seryjny twardego dysku. Prosze o informacje. Pozdrawiam Tomasz Frontczak tfro...@i17linuxa.ists.pwr.wroc.pl
Re: Numer seryjny HDD
Author: Rafal Siejca
Date: Tue, 23 Jan 1996 00:00
Date: Tue, 23 Jan 1996 00:00
12 lines
859 bytes
859 bytes
On 22 Jan 1996, Tomasz Frontczak wrote: > Moze ktos wie jak programowo w Pascalu lub C odczytac numer seryjny > twardego dysku. > Prosze o informacje. Wiem, a nawet kiedys napisalem procedurki do tego. Jak mi przypomnisz (przyslij mail'a bo mam short memory) to Ci nawet moge przeslac... Procedurki sa w Paszczal'u i chyba nawet niezle je opisalem.... CUL8R :)
Re: Numer seryjny HDD
Author: Grzegorz Szyszlo
Date: Mon, 29 Jan 1996 00:00
Date: Mon, 29 Jan 1996 00:00
20 lines
1323 bytes
1323 bytes
Rafal Siejca <rsi...@zodiac19.mimuw.edu.pl> wrote:
>
>
>On 22 Jan 1996, Tomasz Frontczak wrote:
>
>> Moze ktos wie jak programowo w Pascalu lub C odczytac numer seryjny
>> twardego dysku.
>> Prosze o informacje.
>
>Wiem, a nawet kiedys napisalem procedurki do tego. Jak mi przypomnisz
>(przyslij mail'a bo mam short memory) to Ci nawet moge przeslac...
>Procedurki sa w Paszczal'u i chyba nawet niezle je opisalem....
>CUL8R :)
proponuje na liste :) mysle ze wiecej osob byloby zainteresowanych. (ja tak)
--
oOOo /===================================\
/=====\__/=====/ http://avalon.wbc.lublin.pl/~znik |
| Grzegorz Szyszlo mailto:ZN...@avalon.wbc.lublin.pl |
\===================================================/
Re: Numer seryjny HDD
Author: ar... Marcin
Date: Mon, 29 Jan 1996 00:00
Date: Mon, 29 Jan 1996 00:00
153 lines
4761 bytes
4761 bytes
Grzegorz Szyszlo <ZN...@avalon.wbc.lublin.pl> wrote:
>Rafal Siejca <rsi...@zodiac19.mimuw.edu.pl> wrote:
>>
>>
>>On 22 Jan 1996, Tomasz Frontczak wrote:
>>
>>> Moze ktos wie jak programowo w Pascalu lub C odczytac numer seryjny
>>> twardego dysku.
>>> Prosze o informacje.
>proponuje na liste :) mysle ze wiecej osob byloby zainteresowanych. (ja tak)
>--
Maly prezencik:
NUMBER : 1759
PRODUCT : Pascal
VERSION : All
OS : DOS
DATE : December 13, 1995
TITLE : Getting and setting a disks serial number
The following program shows how to read and write the serial
number on a disk drive. It uses interrupt $21 function $69
and reads the information back and forth into a record with
the following declaration:
TSerPacket = record
Info:Word;
SerNo: Longint;
Vol: Array[1..11] of char;
FileType: Array[1..8] of char;
end;
The first word of the above record should always contain
zero, the second contains the serial number, the third
the volume label and the fourth the FileType, which is usually
either FAT 16 or FAT 12.
When setting a new serial number, the programs first reads the
current information, and then sets the new serial number
and writes it to disk.
The code shown below provides the user with three functions:
GetSerialInfo: Get the current serial number
SetSerialInfo: Set a new serial number
DisplaySerialInfo: Display the information in the current
variable of type TPacket.
Notice that DisplaySerialInfo does not write information
to a disk drive, but only displays that information to
the user via the screen. All of these routines depend
on a global variable of type TSerPacket, which is called
SPacket. It makes no sense to call DisplaySerialInfo
before calling GetSerialInfo.
The drive specification is passed as a number, where
the default drive is zero, drive A is one, drive
B is two, etc.
program SetDiskSer;
{$A+,B-,D+,E+,F-,G+,I+,L+,N-,O-,P-,Q-,R-,S-,T-,V+,X+,Y+}
{$M 16384,0,655360}
type
TSerPacket = record
Info:Word; { Info level always zero }
SerNo: Longint; { Disk }
Vol: Array[1..11] of char;
FileType: Array[1..8] of char;
end;
var
SPacket: TSerPacket;
function GetSerialInfo(Drive: Byte): Byte; assembler;
asm
mov ah, 69h
mov al, 0 { This is where you 1 set serial, 0 to get serial
number }
mov bl, 1 { drive number 0 = default, 1 = A, 2 = B , 3 = C }
mov dx, offset [SPacket]
int 21h
end;
function SetSerialInfo(Drive: Byte; SerNo: LongInt): Boolean;
var
S: String;
begin
GetSerialInfo(Drive);
SPacket.SerNo := SerNo;
asm
mov ah, 69h
mov al, 1 { This is where you 1 set serial, 0 to get serial
number }
mov bl, Drive { drive number 0 = default, 1 = A, 2 = B ,
3 = C }
mov dx, offset [SPacket]
int 21h
end;
end;
procedure DisplaySerialInfo;
var
S: String;
begin
WriteLn('Info level: ', SPacket.Info);
WriteLn('Serial Num: ', SPacket.SerNo);
FillChar(S, SizeOf(S), #0);
Move(SPacket.Vol[1], S[1], 11);
S[0] := #11;
WriteLn('Vol: ', S);
FillChar(S, SizeOf(S), #0);
Move(Spacket.FileType,S[1], 8);
S[0] := #8;
WriteLn('Type: ', S);
end;
begin
SetSerialInfo(1, 12); { One means Drive A, 16 is the serial
number }
GetSerialInfo(1);
DisplaySerialInfo;
ReadLn;
end.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.
Pozdrawiam
Marcin
*************************************************************
* Marcin Szumiela * ART4 Comp Group * Where any view *
* ar...@pdi.lodz.pl * PC&AMIGA progr. * of Money exists Art *
*------------------*-----------------* cannot be carried on.*
* http://www.pdi.net/~art4 * William Blake *
*************************************************************
* Private ArtGallery: http://www.pdi.net/~art4/gallery.html *
*************************************************************
Re: Numer seryjny HDD
Author: slo... Tomasz Slodkowicz
Date: Fri, 09 Feb 1996 00:00
Date: Fri, 09 Feb 1996 00:00
18 lines
1191 bytes
1191 bytes
Tomasz Frontczak (stud...@ldscoux.immt.pwr.wroc.pl) wrote:
> Moze ktos wie jak programowo w Pascalu lub C odczytac numer seryjny
> twardego dysku.
Ale o co tu chodzi ?
- o serial number dosu (takie cyferki nadawane przy formatowaniu)
- o serial & model number (te cyferki na obudowie dysku)?
ad1 - przeczytac bootsector....
ad2 - zaprogramowac IDE HDC (wlasnie sie tym bawilem, jesli ktos chce to
podesle zrodla. przy okazji pojawily sie inne ciekawe problemy - jezeli ktos
sie tym zajmowal/uje to niech da znac... :)
Tomek
--
Tomasz Slodkowicz Institute of Computer Science
Jagiellonian University, Cracow, Poland
e-mail: slo...@ii.uj.edu.pl
www : http://www.uj.edu.pl/~slodki
Re: Numer seryjny HDD
Author: las... Jurek
Date: Fri, 09 Feb 1996 00:00
Date: Fri, 09 Feb 1996 00:00
14 lines
946 bytes
946 bytes
slo...@infoserv.ii.uj.edu.pl (Tomasz Slodkowicz) wrote: >ad1 - przeczytac bootsector.... >ad2 - zaprogramowac IDE HDC (wlasnie sie tym bawilem, jesli ktos chce to >podesle zrodla. przy okazji pojawily sie inne ciekawe problemy - jezeli ktos >sie tym zajmowal/uje to niech da znac... :) > Tomek Chetnie bym zobaczyl. A przy okazji moze wiesz albo masz cos na temat roznych trybow "uspienia" IDE? Jest ich kilka, probowalem cos z tym robic i czasem system mi wiesza, czasem nie - nie bardzo wiem dlaczego. Jurek
Re: Numer seryjny HDD
Author: le... Leslaw Frydel
Date: Mon, 12 Feb 1996 00:00
Date: Mon, 12 Feb 1996 00:00
22 lines
1435 bytes
1435 bytes
las...@ctrvax.vanderbilt.edu (Jurek) wrote:
>slo...@infoserv.ii.uj.edu.pl (Tomasz Slodkowicz) wrote:
>Chetnie bym zobaczyl. A przy okazji moze wiesz albo masz cos na temat
^^^^^^^^^^^^^^^^^^^^^ ja tez .
>roznych trybow "uspienia" IDE? Jest ich kilka, probowalem cos z tym
to zalezy co chcesz uspic ? (moze mysz :)? jak HDD to mpge Ci podeslac
zrodlo
--
_/ _/_/_/ _/_/_/ _/ _/ _/ +-----------------------------+
_/ _/ _/ _/ _/ | Leslaw Frydel |
_/ _/_/ _/_/_/ _/ _/ _/ | E-mail: |
_/ _/ _/ _/ _/ _/ | le...@zeus.polsl.gliwice.pl |
_/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/ | WWW: |
| www.polsl.gliwice.pl/~lesiu |
Enjoy Your Life... Play More Games! +-----------------------------+
-------------------------------------------------------------------------
Re: Numer seryjny HDD
Author: las... Jurek
Date: Mon, 12 Feb 1996 00:00
Date: Mon, 12 Feb 1996 00:00
18 lines
1230 bytes
1230 bytes
le...@zeus.polsl.gliwice.pl (Leslaw Frydel) wrote: >>roznych trybow "uspienia" IDE? Jest ich kilka, probowalem cos z tym >to zalezy co chcesz uspic ? (moze mysz :)? jak HDD to mpge Ci podeslac >zrodlo Gratuluje domyslnosci! Tak, istotnie chce "uspic" HDD. Problem nie w programie - jest banalnie prosty - ale w tym, ze jest kilka rozkazow, ktore powoduja zadany efekt. Niestety nie wiem, czym sie roznia pomiedzy soba. Machnalbym na to reka, ale czasem gdy Windoze nagle wpadnie na pomysl "obudzenia" HDD calosc zawiesza sie dokumentnie. Co ciekawe, szanse na poprawny start sa dobrze ponad 50%, ale klopoty zdarzaja sie na tyle czesto, ze trudno to zaakceptowac. BTW - chetnie zobacze zrodlo, moze cos pomoze :-). Jurek
Re: Numer seryjny HDD
Author: le... Leslaw Frydel
Date: Mon, 12 Feb 1996 00:00
Date: Mon, 12 Feb 1996 00:00
22 lines
1435 bytes
1435 bytes
las...@ctrvax.vanderbilt.edu (Jurek) wrote:
>slo...@infoserv.ii.uj.edu.pl (Tomasz Slodkowicz) wrote:
>Chetnie bym zobaczyl. A przy okazji moze wiesz albo masz cos na temat
^^^^^^^^^^^^^^^^^^^^^ ja tez .
>roznych trybow "uspienia" IDE? Jest ich kilka, probowalem cos z tym
to zalezy co chcesz uspic ? (moze mysz :)? jak HDD to mpge Ci podeslac
zrodlo
--
_/ _/_/_/ _/_/_/ _/ _/ _/ +-----------------------------+
_/ _/ _/ _/ _/ | Leslaw Frydel |
_/ _/_/ _/_/_/ _/ _/ _/ | E-mail: |
_/ _/ _/ _/ _/ _/ | le...@zeus.polsl.gliwice.pl |
_/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/ | WWW: |
| www.polsl.gliwice.pl/~lesiu |
Enjoy Your Life... Play More Games! +-----------------------------+
-------------------------------------------------------------------------
Re: Numer seryjny HDD
Author: le... Leslaw Frydel
Date: Fri, 16 Feb 1996 00:00
Date: Fri, 16 Feb 1996 00:00
226 lines
9849 bytes
9849 bytes
las...@ctrvax.vanderbilt.edu (Jurek) wrote:
>Tak, istotnie chce "uspic" HDD. Problem nie w programie - jest
>banalnie prosty - ale w tym, ze jest kilka rozkazow, ktore powoduja
>zadany efekt. Niestety nie wiem, czym sie roznia pomiedzy soba.
>Machnalbym na to reka, ale czasem gdy Windoze nagle wpadnie na pomysl
>"obudzenia" HDD calosc zawiesza sie dokumentnie. Co ciekawe, szanse na
>poprawny start sa dobrze ponad 50%, ale klopoty zdarzaja sie na tyle
>czesto, ze trudno to zaakceptowac.
>BTW - chetnie zobacze zrodlo, moze cos pomoze :-).
Ponizej znajduje sie kawalek pliku PORTS.LST (cytowanyu bez zgody autora)
moze Ci sie przyda, ja napisalem dzieki temu procedurki ktore wylaczaja HDD
znajduja sie na samym koncu!
Pozdrawiam LESZEK!
W razie pytan - PYTAJ :)
******************************************************************************
PORT LIST Release 48 Last Change:
10/29/95
This compilation is Copyright (c) 1989,1990,1991,1992,1993,1994,1995 Ralf
Brown
[This file originally by Wim Osterholt (2:512/56 or
w...@djo.wtm.tudelft.nl).]
XT, AT and PS/2 I/O port addresses
Do NOT consider this information to be complete and accurate. If you want
to do hardware programming ALWAYS check the appropriate data sheets (but
even they are sometimes in error!). Be aware that erroneous port
programming
can put your data or even your hardware at risk.
[ciach]
PORT 01F0-01F7 - HDC 1 (1st Fixed Disk Controller) (ISA, EISA)
Range: 01F0-01F7 for primary controller, 0170-0177 for secondary
controller
SeeAlso: PORT 0170h-0177h
01F0 RW data register
01F1 R error register (see #P075)
01F1 W WPC/4 (Write Precompensation Cylinder divided by 4)
01F2 RW sector count
01F3 RW sector number (CHS mode)
logical block address, bits 0-7 (LBA mode)
01F4 RW cylinder low (CHS mode)
logical block address, bits 15-8 (LBA mode)
01F5 RW cylinder high (CHS mode)
logical block address, bits 23-16 (LBA mode)
01F6 RW drive/head (see #P076)
01F7 R status register (see #P077)
01F7 W command register (see #P078)
Bitfields for Hard Disk Controller error register:
Bit(s) Description (Table P075)
---diagnostic mode errors---
7 which drive failed (0 = master, 1 = slave)
6-3 reserved
2-0 error code
001 no error detected
010 formatter device error
011 sector buffer error
100 ECC circuitry error
101 controlling microprocessor error
---operation mode---
7 bad block detected
6 uncorrectable ECC error
5 reserved
4 ID found
3 reserved
2 command aborted prematurely
1 track 000 not found
0 DAM not found (always 0 for CP-3022)
SeeAlso: #P076,#P077
Bitfields for hard disk controller drive/head specifier:
Bit(s) Description (Table P076)
7 =1
6 LBA mode enabled, rather than default CHS mode
5 =1
4 drive select (0 = drive 0, 1 = drive 1)
Text View: C:\WINDOWS\TEMP\PORTS.LST Col 0 227 832 Bytes
3-0 head select bits (CHS mode)
logical block address, bits 27-24 (LBA mode)
SeeAlso: #P075,#P077
Bitfields for hard disk controller status register:
Bit(s) Description (Table P077)
7 controller is executing a command
6 drive is ready
5 write fault
4 seek complete
3 sector buffer requires servicing
2 disk data read successfully corrected
1 index - set to 1 each disk revolution
0 previous command ended in an error
SeeAlso: #P075,#P078
(Table P078)
Values for hard disk controller command codes:
Command Spec Type Proto Description class:
00h opt nondata NOP
1xh opt nondata recalibrate 1
20h req PIOin read sectors with retry 1
21h req PIOin read sectors without retry 1
22h req PIOin read long with retry 1
23h req PIOin read long without retry 1
30h req PIOout write sectors with retry 2
31h req PIOout write sectors without retry 2
32h req PIOout write long with retry 2
33h req PIOout write long without retry 2
3Ch IDE opt PIOout write verify 3
40h req nondata read verify sectors with retry 1
41h req nondata read verify sectors without retry 1
50h req vend format track 2
7xh req nondata seek 1
8xh IDE vendor vend vendor unique 3
90h req nondata execute drive diagnostics 1
91h req nondata initialize drive parameters 1
92h opt PIOout download microcode
94h E0h IDE opt nondata standby immediate 1
95h E1h IDE opt nondata idle immediate 1
96h E2h IDE opt nondata standby 1
97h E3h IDE opt nondata idle 1
98h E5h IDE opt nondata check power mode 1
99h E6h IDE opt nondata set sleep mode 1
9Ah IDE vendor vend vendor unique 1
C0h-C3h IDE vendor vend vendor unique 2
C4h IDE opt PIOin read multiple 1
C5h IDE opt PIOout write multiple 3
C6h IDE opt nondata set multiple mode 1
C8h IDE opt DMA read DMA with retry 1
C9h IDE opt DMA read DMA without retry 1
CAh IDE opt DMA write DMA with retry 3
CBh IDE opt DMA write DMA w/out retry 3
DBh ATA-2 opt vend acknowledge media chng [Removable]
DCh ATA-2 opt vend Boot / Post-Boot [Removable]
DDh ATA-2 opt vend Boot / Pre-Boot (ATA-2) [Removable]
DEh ATA-2 opt vend door lock [Removable]
DFh ATA-2 opt vend door unlock [Removable]
E0h-E3h (see 94h-96h)
E4h IDE opt PIOin read buffer 1
E5h-E6h (see 98h-99h)
E8h IDE opt PIOout write buffer 2
E9h IDE opt PIOout write same 3
EAh ATA-3 opt Secure Disable [Security
Mode]
EAh ATA-3 opt Secure Lock [Security
Mode]
EAh ATA-3 opt Secure State [Security
Mode]
EAh ATA-3 opt Secure Enable WriteProt [Security
Mode]
EBh ATA-3 opt Secure Enable [Security
Mode]
EBh ATA-3 opt Secure Unlock [Security
Mode]
ECh IDE req PIOin identify drive 1 (see
#P079)
EDh ATA-2 opt nondata media eject [Removable]
EEh ATA-3 opt identify device DMA (see
#P079)
EFh IDE opt nondata set features 1
F0h-F4h IDE vend EATA standard
F5h-FFh IDE vendor vend vendor unique 4
SeeAlso: #P075,#P077
[ciach]
Orginalny plik dostepny na SIMTELU w katalogu /msdos/info/inter???.zip
A teraz moje procedurki :
type
dysk=(C,D,E,F);
procedure standby(i:dysk);
begin
if i=C then begin port[$01f6]:=$a0; port[$01f7]:=$e0; writeln('standby
immediate C:') end;
if i=D then begin port[$01f6]:=$b0; port[$01f7]:=$e0; writeln('standby
immediate D:') end;
if i=E then begin port[$0176]:=$a0; port[$0177]:=$e0; writeln('standby
immediate E:') end;
if i=F then begin port[$0176]:=$b0; port[$0177]:=$e0; writeln('standby
immediate F:') end;
end;
procedure sleep(i:dysk);
begin
if i=C then begin port[$01f6]:=$a0; port[$01f7]:=$e6; writeln('set sleep
mode C:') end;
if i=D then begin port[$01f6]:=$b0; port[$01f7]:=$e6; writeln('set sleep
mode
D:') end;
if i=E then begin port[$0176]:=$a0; port[$0177]:=$e6; writeln('set sleep
mode
E:') end;
if i=F then begin port[$0176]:=$b0; port[$0177]:=$e6; writeln('set sleep
mode
F:') end;
end;
TEgo by bylo na tyle ! Jak ktos chce gotowy exe i cale zrodlo to mu podesle
!
--
_/ _/_/_/ _/_/_/ _/ _/ _/ +-----------------------------+
_/ _/ _/ _/ _/ | Leslaw Frydel |
_/ _/_/ _/_/_/ _/ _/ _/ | E-mail: |
_/ _/ _/ _/ _/ _/ | le...@zeus.polsl.gliwice.pl |
_/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/ | WWW: |
| www.polsl.gliwice.pl/~lesiu |
Enjoy Your Life... Play More Games! +-----------------------------+
-------------------------------------------------------------------------
Re: Numer seryjny HDD
Author: las... Jurek
Date: Sat, 17 Feb 1996 00:00
Date: Sat, 17 Feb 1996 00:00
13 lines
852 bytes
852 bytes
Dzieki! Jedno pytanie: >procedure standby(i:dysk); >procedure sleep(i:dysk); Czym sie roznia standby od sleep? Przypomne, moj zasadniczy problem polega na tym, ze windoze mi sie czasem wiesza jak probuje "obudzic" dysk "uspiony" gotowcem, ktory kiedys od kogos dostalem. Jurek
Re: Numer seryjny HDD
Author: le... Leslaw Frydel
Date: Wed, 21 Feb 1996 00:00
Date: Wed, 21 Feb 1996 00:00
28 lines
1967 bytes
1967 bytes
las...@ctrvax.vanderbilt.edu (Jurek) wrote:
>Czym sie roznia standby od sleep? Przypomne, moj zasadniczy problem
>polega na tym, ze windoze mi sie czasem wiesza jak probuje "obudzic"
>dysk "uspiony" gotowcem, ktory kiedys od kogos dostalem.
standby - wylacza dysk , ale jest on wlaczany zaraz po probie odwolania sie
do niego
sleep - j/w ale dysk sie wlacza po kilku(nastu) sekundach
Nie wiem czemu Ci sie win wiesza , moze ten gotowiec jest do D...
Moge podeslac taki programik pod win z SIMTELA:
/win3/diskutil/gide11.zip czy jakos tak!
U mnie ten program dziala (ale skasowalem bo mam plyte APM)
natomiast podeslane procedurki dzialaja TYLKO pod DOS'em!
Nie moglem ich zmusic do dzialania pod win. Jak bys cos wymyslil to daj
znac!
--
_/ _/_/_/ _/_/_/ _/ _/ _/ +-----------------------------+
_/ _/ _/ _/ _/ | Leslaw Frydel |
_/ _/_/ _/_/_/ _/ _/ _/ | E-mail: |
_/ _/ _/ _/ _/ _/ | le...@zeus.polsl.gliwice.pl |
_/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/ | WWW: |
| www.polsl.gliwice.pl/~lesiu |
Enjoy Your Life... Play More Games! +-----------------------------+
-------------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads