From: greg.vigneault@bville.gts.org (Greg Vigneault) 
Newsgroups: comp.os.msdos.programmer
Subject: VOLUME LABEL'S
Date: 17 Aug 92 11:25:00 GMT
Distribution: world
Organization: Baudeville BBS - Toronto, Canada 416-283-0114/6059* *v32bis/HST
Reply-To: greg.vigneault@bville.gts.org (Greg Vigneault) 

 In message<hvisage.713546489@rkw-risc>
 Per: Volume label's
 hvisage@rkw-risc.cs.up.ac.za (Hendrik Visage) wrote...

HV> I need to change, create and delete volume labels in
  > TP6.0, TC++ or TASM. under MS-DOS 5.00. If possible please
  > send EMail.

 This TP Unit reads/writes disk volume labels & serial numbers...
(*-------------------------------------------------------------------*)
UNIT Volume;    { Version 0.3ap, for Turbo Pascal 4, 5.x, and 6 }
INTERFACE       { Tested under MS-DOS version 3.3 and 4.01 }
TYPE VolLabel = String[11]; { volume lable is 11 characters maximum }
FUNCTION GetLabel( Drive :CHAR ) :VolLabel;
    { Returns 11-char volume label, or nul string if none.
      Drive is 'A'..'Z', or '.' for current volume }
FUNCTION SetLabel( Drive :CHAR; VolStr :VolLabel ) :BYTE;
    { sets volume label (pads to 11-chars if needed), returning a
      BYTE result code (0..6) ...
      0 = okay
      1 = IF NOT Drive IN ['.', 'A'..'Z']  | 4 = label creation error
      2 = label read error                 | 5 = label deletion error
      3 = VolStr error (eg. too long)      | 6 = label renaming error }
FUNCTION GetVolume :CHAR;
    { returns current logged-in volume, letter 'A'..'Z' }
FUNCTION SetVolume( Drive :CHAR ) :BYTE;
    { logs into the root of volume 'A'..'Z'
      returns BYTE of 0 if okay, else returns MS-DOS error code}
FUNCTION GetSerial( Drive :CHAR ) :LONGINT; { ** MS-DOS 4.0 & above }
FUNCTION SetSerial( Drive :CHAR; SerialNum :LONGINT ) :WORD;
    { returns WORD of 0 if okay, else error number (DOS 4 & above) }
FUNCTION VolSerHexStr( SerialNum :LONGINT ) :String;   { String[9] }
    { converts binary SerialNum to hex string in form of '0000-0000' }
IMPLEMENTATION
USES Dos;           { updates TP's DosError global }
{$L VOLUME03.OBJ}   { implemented in Assembly (FAR calls) }
FUNCTION GetLabel( Drive :CHAR ) :VolLabel;                 EXTERNAL;
FUNCTION SetLabel( Drive :CHAR; VolStr :VolLabel ) :BYTE;   EXTERNAL;
FUNCTION GetSerial( Drive :CHAR ) :LONGINT;                 EXTERNAL;
FUNCTION SetSerial( Drive :CHAR; SerialNum :LONGINT ) :WORD;EXTERNAL;
FUNCTION GetVolume :CHAR;                                   EXTERNAL;
FUNCTION SetVolume( Drive :CHAR ) :BYTE;                    EXTERNAL;
FUNCTION GetVolVer:WORD; {util ver,AH=major,AL=minor}       EXTERNAL;
FUNCTION VolSerHexStr( SerialNum : LONGINT ) :String;       EXTERNAL;
END. { Unit Volume. Copyright 1991, 1992 Gregory S. Vigneault }
(*------------------------------------------------------EnHex-A1.3p--*)
 To obtain VOLUME03.OBJ from this message, follow these 4 steps ...
 1) put the next 34 encoded lines into a text file named VOLUME03.HEX

:1E0000001A08564F4C554D4530332E4F424A00B60300009818EC8E1A8FB00400000C30
:1E001E00801C006060E70D9B3A6DCAC098E122C894265C2C31000080009120548210BB
:1E003C0018F284489110980E00004351408000FD420200A247C08093A0182D00808053
:1E005A00C8932945A448792205403C4800D8946460E509139C529014C132858A942BEB
:1E00780014111C2942854910214598AC8A8AB3EAD5ACE62826984A056992204C280258
:1E00960048D0D52C5A1562C9166552A549113E71A9CEB592F38ED8AE73EB165144F15F
:1E00B4000B22021445058806AA49000114AB2C62E781113247D8141931808EA21C09D5
:1E00D200A1282EB24071C6B60F893C50ECA20CF2226C3380CD90B6EE9D64CA96316B4B
:1E00F00056D019809C0A8BAC1848441A407004C429F6962320F68751AB95190070DBB6
:1E010E0043313F0A8C1518BBC80882DEDA5B1CE9CE99E207D6885D8406B02C3674001D
:1E012C00B432340B4120880C72CBAAE7CEBC5914455D14D1B2C37CCC39F71E6B90E960
:1E014A0077197FE5F9F6416F7568E00B45C4F881402E339980480347F0330F290646C7
:1E01680007598508C8008C8605F803CC3AEC28A89B11BC7986426F7430D01B2C00D449
:1E018600C1416FEB5C4063013C3600207C17CCA700307408008B01F73D17DD74280C5F
:1E01A40091420C39E420030847C851C61956A471861B658451071B740C00C00F3A7076
:1E01C2000100240780C0492E0010329100022012003111004067117756A0A70047DC04
:1E01E000C98101271162C39F7612F3C39F7C1263C49F811292C49F9DDC1905A10110B8
:1E01FE0062C69F580840081C9C0A404C1E7FF670E71F981263C99F3FDC9909AB779633
:1E021C00822921B7FCA91821BCFC09CC9DC1FC49C69DD4CC2A8FAD99DEA36BA6FCFCA7
:1E023A00198300859849E7638520A02CB30DFC298200C548F0271701142302A61B88C4
:1E025800229000490430530000A04B5100205823AE9E5404202DBAEAA60B8233A01480
:1E027600A027B7FFF4F3AE005D04A02FBD6AA18B0E28D3092086BC01B0F3EFAFE7A692
:1E0294005BF00F9CFCFB86C012D78BAEBBE3D2616EC60583B0CABF7F049000C8EB0269
:1E02B200200C28F6E869E7720F40719F22991133242D69CC87C53050D012C03AEEF0D0
:1E02D000E0021D0E90F00D0F41C801010F5ADCC1000B40AC238089FE0170E430B004FC
:1E02EE0090CF301302802100B0FC709811E2EC7373044602038B00759840CB0BF30D37
:1E030C00320C028BECF375D73783609A098A0480080087C8830808810F218E3C267215
:1E032A004DD12F147D6D1A61761A9ECFCD16A45D4700581330CCCD13588E392C050C24
:1E03480053A1017C37A04032746000483E0BDC31C1115D3FFE0EDF7E0360383E89C36F
:1E03660032C0D58B40A30831BDF51E0B015048834E6F5890F0000F0A3047C00104C06A
:1E038400804801E309330C059C8C1127BA742A464CB5740E71E70B7F8E71670EBEDEEF
:1E03A200F9289DDC12F345FAC488F1A7C7C4E831FF9D7DC0CFC8B6776EC2BFCDF72364
:1503C0004435FE14064F7DE34F6A10400214011900D0011A00C4
:00000001FF

 2) put the following 7 lines into a text file named VOLUME03.DO
        Nvolume03.HEX
        Lcs:100
        Rcx
        03D5
        Nvolume03.ARC
        Wcs:100
        Q
 3) type "DEBUG < VOLUME03.DO" to create VOLUME03.ARC from VOLUME03.HEX
 4) extract VOLUME03.OBJ from VOLUME03.ARC using PAK or PKUNPAK
(*-------------------------------------------------------------------*)

 Greg_
 greg.vigneault@bville.gts.org
 Aug.17.1992.Toronto.Canada
              
Newsgroups: comp.os.msdos.programmer