Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

cdrom serial number

Posted on 1999-07-25
10
Medium Priority
?
407 Views
Last Modified: 2013-12-03
Is there a way to set a serial number in a CD-R?
Any burner that can do it?
I know the GetVolumeInformation API can get the serial number of cds, would be another to set it?

TIA,
Celso
0
Comment
Question by:celsonardi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1403652
Can be you can make it with help of 21 Interruption,
minor code= 46h
Mext is part of description(full description see
Ralf Brawn interruption list, interrup.g
   
INT 21 - DOS 3.2+ - IOCTL - GENERIC BLOCK DEVICE REQUEST
      AX = 440Dh
      BL = drive number (00h=default,01h=A:,etc)
      CH = category code (see #01558)
      CL = minor code (function) (see #01559)
      DS:DX -> (DOS) parameter block (see #01560,#01562,#01563,#01564,#01565)
      SI:DI -> (OS/2 comp box) parameter block (see #01566,#01568,#01569,#01572)
Return: CF set on error
          AX = error code (01h,02h,etc.) (see #01680 at AH=59h/BX=0000h)
      CF clear if successful
          DS:DX -> data block if CL=60h or CL=61h
(Table 01558)
Values for block device IOCTL category code:
 08h      disk drive
 48h      FAT32 disk drive
 00h-7Fh reserved for Microsoft
 80h-FFh reserved for OEM/user-defined

(Table 01559)
Values for generic block IOCTL minor code:
...
 46h      (DOS 4.0+) set volume serial number
.....
Format of parameter block for functions 46h, 66h:
Offset      Size      Description      (Table 01565)
 00h      WORD      (call) info level (should be 0000h)
 02h      DWORD      disk serial number (binary)
 06h 11 BYTEs      volume label or "NO NAME    "
 11h  8 BYTEs      filesystem type "FAT12       " or "FAT16   "
              (generally CL=66h only, but MS-DOS 5.0 will write the
              given filesystem type to the disk)
Note:      under MS-DOS 7.0 or a Windows95 DOS box, the volume label field can return as all blanks even when a volume label has been set (the Win95 installation seems to blank the volume label field in the partition boot sector; once LABEL has been run, the volume label is reported correctly)

But i can't test it: i hav't CD-R
BTW: 10 PTS????
0
 

Author Comment

by:celsonardi
ID: 1403653
sorry, I´m a newbie, and out of points...
currently i´m only 70 points, but if you could provide me with a implementation of that stuff (a delphi function would be fine) I promise all the 70 points will be yours...
thanks...
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1403654
It will be C++, tomorrow.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 20 total points
ID: 1403655
Ok, this is you code, but i don't test it!
#define VWIN32_DIOC_DOS_IOCTL 1
 
typedef struct _DEVIOCTL_REGISTERS
{
    DWORD reg_EBX;
    DWORD reg_EDX;
    DWORD reg_ECX;
    DWORD reg_EAX;
    DWORD reg_EDI;
    DWORD reg_ESI;
    DWORD reg_Flags;
} DEVIOCTL_REGISTERS, *PDEVIOCTL_REGISTERS;
//get old data
typedef struct _MID
{
    WORD  midInfoLevel;
    DWORD midSerialNum;
    BYTE  midVolLabel[11];
    BYTE  midFileSysType[8];
} MID, *PMID;
 
BOOL GetMediaID(UINT nDrive)
{
    DEVIOCTL_REGISTERS reg;
    PMID pmid;
    reg.reg_EAX = 0x440D;       // IOCTL for block devices
    reg.reg_EBX = nDrive;       // zero-based drive ID
    reg.reg_ECX = 0x0866;       // Get Media ID command
    reg.reg_EDX = (DWORD) pmid; // receives media ID info
 
    if (!DoIOCTL(&reg))
        return FALSE;
 
    if (reg.reg_Flags & 0x8000) // error if carry flag set
        return FALSE;
 
    char   szInfo[26],*szFat = pmid.midFileSysType;
    memset(szInfo, 0, sizeof(szInfo));
    DWORD lNewId = pmid.midSerialNum + 1l;
                              //form block
    memcpy(szInfo+2, &lNewId,4);
    strcnpy(szInfo+6,pmid.midVolLabel,11);//or old Name or .
    strcnpy(szInfo+17,szFat,8);//fat type
      // Set up INT 21h parameters
    memset(&reg, 0, sizeof(reg));

    reg.reg_EAX = 0x440D;       // IOCTL for block devices
    reg.reg_EBX = nDrive;          // zero-based drive ID
    if (strncmp(szFat,"Fat32   ",8))
        reg.reg_ECX = 0x0846;       //usual fat
    else
        reg.reg_ECX = 0x4846;       // Fat32!

    reg.reg_EDX = (DWORD) szInfo; // receives media ID info

    if (!DoIOCTL(&reg))
        return FALSE;

    if (reg.reg_Flags & 0x8000) // error if carry flag set
        return FALSE;
    return TRUE;
}
//make 21 interruption
bool DoIOCTL(PDEVIOCTL_REGISTERS preg)
{
    HANDLE hDevice;

    BOOL fResult;
    DWORD cb;

    preg->reg_Flags = 0x8000; // assume error (carry flag set)

    hDevice = CreateFile("\\\\.\\vwin32",
        GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
        (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING,
        FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
 
    if (hDevice == (HANDLE) INVALID_HANDLE_VALUE)
        return false;
    else
    {
        fResult = DeviceIoControl(hDevice, VWIN32_DIOC_DOS_IOCTL,
            preg, sizeof(*preg), preg, sizeof(*preg), &cb, 0);

        if (!fResult)
            return false;
    }

    CloseHandle(hDevice);

    return true;
}

0
 

Expert Comment

by:irishka
ID: 1403656
The record of a CD - R of the disc is a process continuous.
It is impossible to record only serial number(Volume Info) of the disc.
To record the disc bodily is possible only.
(leadin track + data track(s) +leadout track)
Also it is impossible to change the information recorded on a CD - R.
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1403657
>>Also it is impossible to change the information recorded >>on a CD - R.
  I don't know this, but if irishka is right, all this Q
  hav't any sence.

0
 
LVL 3

Expert Comment

by:ESI
ID: 1403658
The trick would be to guess how the ID calculation is performed and (anticipate)/pre-calculate its value in order to put it in your tests, as I guess you need to know what number it WILL be after you burn the CD, to put the right code in your rules ....
0
 

Author Comment

by:celsonardi
ID: 1403659
I was thinking... if I make an ISO image of a cd/cd-r, then open it in a hex editor, then locate and change the serial number and burn the iso image again, it will work... but anyone knows how to locate the serial number in an iso image? tried to search it but no success...


0
 

Expert Comment

by:RobertM041397
ID: 1403660
Good idea celsonardi. That's the only way you're gonna do it unless you find a cd-r writing program that supports otherwise. I wanted to do the same thing for copy protection reasons. However, I doubt my intention to use it for this purpose would be much protection since some cd duplicators probably duplicate the s/n as well.
0
 

Author Comment

by:celsonardi
ID: 1403661
To RobertM: my plan is to use the Illegal TOC method to burn the CD, so it will make that impossible to read as image, and the serial number would be protected...
but I really don't know where that ****ing serial number lays on the cd!!!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question