UT2003 -> backup works using twin sectors

Optical Storage Technical Discussions Discuss, UT2003 -> backup works using twin sectors at Computer Hardware forum; PHP Code:

Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
PHP Code:
/*    twinpeak.cpp   */


#include <windows.h>
#include <stdio.h>



HANDLE    hImgFile INVALID_HANDLE_VALUEhSubFile INVALID_HANDLE_VALUE;

DWORD    dwImgFileSizedwSubFileSize;
DWORD    dwSectorCount;

DWORD*    dwSectorTable NULL;



void Exit()
{
    
// clean up stuff
    
if(hImgFile != INVALID_HANDLE_VALUECloseHandle(hImgFile);
    if(
hSubFile != INVALID_HANDLE_VALUECloseHandle(hSubFile);
    if (
dwSectorTable != NULLdelete dwSectorTable;
    
ExitProcess(0);
}

bool OpenImageFile(char szFileName)
{
    
char szName[256];

    
// construct file name
    
lstrcpy(szNameszFileName);
    
lstrcat(szName,".img");
    
    
// open the file
    
hImgFileCreateFile(szNameGENERIC_READ0NULLOPEN_EXISTING0NULL);
    
    if(
hImgFile==INVALID_HANDLE_VALUE) {
        
printf("cannot open input file: \n");
        return 
false;
    }
    
    
// get the filesize;
    
dwImgFileSize GetFileSize(hImgFile,0);

    return 
true;
}

bool OpenSubFile(char szFileName)
{
    
char szName[256];

    
// construct file name
    
lstrcpy(szNameszFileName);
    
lstrcat(szName,".sub");
    
    
// open the file
    
hSubFileCreateFile(szNameGENERIC_READ0NULLOPEN_EXISTING0NULL);
    
    if(
hSubFile==INVALID_HANDLE_VALUE) {
        
printf("cannot open subchannel file: \n");
        return 
false;
    }
    
    
// get the filesize;
    
dwSubFileSize GetFileSize(hSubFile,0);

    return 
true;
}

void CreateTwinSectorList()
{
    
dwSectorTable = new DWORD[dwSectorCount];
    if(
dwSectorTable == NULL) Exit();

    for(
DWORD dwCount=0dwCount dwSectorCountdwCount++) {
        
dwSectorTable[dwCount]=1;
    }
}

void InsertTwinSectors(int nRangeStartint nRangeEndint nTwinCountint nStep)
{
    
int nRangeLength nRangeEnd nRangeStart;

    for(
int nCount=nRangeStartnCount nRangeStart+nRangeLengthnCount+= nStep) {
        
dwSectorTable[nCount] += nTwinCount;
    }
}

void ShowInfo()
{
    
DWORD dwNewSectors 0;

    
// get new sector count
    
for(DWORD dwCount=0dwCount dwSectorCountdwCount++) {
        
dwNewSectors += dwSectorTable[dwCount];
    }

    
printf("Original sector count: %d",dwSectorCount);
    
printf("  (%d) mb\n",dwSectorCount/512);
    
    
printf("New sector count: %d",dwNewSectors);
    
printf("  (%d) mb\n",dwNewSectors/512);
}

void WriteNewImgFile()
{
    
HANDLE hFile;
    
DWORD  dwSize 2352;
    
BYTE   aData[3000];

    
DWORD  dwStarCounter 0;

    
printf("\nNow writing image file:");

    
// try to open the file
    
hFileCreateFile("patched.img",GENERIC_READ GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
    if(
hFile==INVALID_HANDLE_VALUE) {
        
printf("\nerror: cannot write new image file");
        Exit();
    }

    
// write the new file with twin sectors
    
for(DWORD dwCount 0;dwCount<dwSectorCount;dwCount++) {
        if( 
ReadFile(hImgFileaDatadwSize, &dwSize0) == ) {
            
printf("\nerror: cannot read image file");
            Exit();
        }

        for(
DWORD dwRepeat 0dwRepeat dwSectorTable[dwCount] ;dwRepeat++) {
            if( 
WriteFile(hFileaDatadwSize, &dwSize0) == 0) {
                
printf("\nerror: cannot write image file");
                Exit();
            }
        }

        
// update funky stars
        
dwStarCounter++;
        if(
dwStarCounter == dwSectorCount/10) {
            
printf("*");
            
dwStarCounter=0;
        }
    }


    
CloseHandle(hFile);
}

void WriteNewSubFile()
{
    
HANDLE hFile;
    
DWORD  dwSize 96;
    
BYTE   aData[3000];

    
DWORD dwStarCounter 0;

    
printf("\nNow writing subchannel file: ");

    
// try to open the file
    
hFileCreateFile("patched.sub",GENERIC_READ GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
    if(
hFile==INVALID_HANDLE_VALUE) {
        
printf("\nerror: cannot write new subchannel file");
        Exit();
    }
    
    
// write the new file with twin sectors
    
for(DWORD dwCount 0;dwCount<dwSectorCount;dwCount++) {
        if( 
ReadFile(hSubFileaDatadwSize, &dwSize0) == ) {
            
printf("\nerror: cannot read subchannel file");
            Exit();
        }
        for(
DWORD dwRepeat 0dwRepeat dwSectorTable[dwCount] ;dwRepeat++) {
            if( 
WriteFile(hFileaDatadwSize, &dwSize0)== ) {
                
printf("\nerror: cannot write subchannel file");
                Exit();
            }
        }

        
// update funky stars
        
dwStarCounter++;
        if(
dwStarCounter == dwSectorCount/10) {
            
printf("*");
            
dwStarCounter=0;
        }
    }


    
CloseHandle(hFile);
}


void main(int nArgschar *szArgs[])
{
    
printf("TwinPeak v0.1\n\n");
    
    
// check command line
    
if(nArgs 2)  {
        
printf("\nusage: twinpeak <ccd image name without ext.>\n");
        Exit();
    }

    
// open image file
    
if(!OpenImageFile(szArgs[1])) {
        Exit();
    }

    
// open subchannel file
    
if(!OpenSubFile(szArgs[1]))   {
        Exit();
    }

    
// check sector count
    
dwSectorCount dwImgFileSize 2352;
    if(
dwSectorCount*2352 != dwImgFileSize) {
        
printf("\nerror: image file size is no multiple of 2352\n");
        Exit();
    }

    
// check subchannel size
    
if(dwSectorCount*96 != dwSubFileSize) {
        
printf("\nerror: subchannel file does not match image file\n");
        Exit();
    }

    
// initialize list
    
CreateTwinSectorList();

    
/* check out the mds file 
       of UT2003 german to see
       where to put twin sectors */

    
InsertTwinSectors1700230016);
    
InsertTwinSectors3600490016);
    
InsertTwinSectors5500660016);
    
InsertTwinSectors6900740016);
    
InsertTwinSectors8300880016);
    
InsertTwinSectors9100960016);
    
InsertTwinSectors101001060016);
    
InsertTwinSectors108001140016);
    
InsertTwinSectors126001310016);
    
InsertTwinSectors134001450016);
    
InsertTwinSectors155001610016);
    
InsertTwinSectors162001680016);
    
InsertTwinSectors175001860016);
    
InsertTwinSectors190001960016);
    
InsertTwinSectors199002040016);
    
InsertTwinSectors206002100016);
    
InsertTwinSectors216002210016);
    
InsertTwinSectors234002390016);
    
InsertTwinSectors244002540016);
    
InsertTwinSectors260002680016);
    
InsertTwinSectors271002760016);
    
InsertTwinSectors282002940016);
    
InsertTwinSectors296003000016);
    
InsertTwinSectors306003120016);
    
InsertTwinSectors318003360016);
    
InsertTwinSectors338003440016);

    
// show some details
    
ShowInfo();

    
// write new files
    
WriteNewImgFile();
    
WriteNewSubFile();
    
    
printf("\ndone.");
    Exit();


Last edited by blackcheck; 01-11-2002 at 02:03.
default_avatar
Today (MyCE Staff)
Posts: 15,596
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
just copied ut2003. tested on 4 drives, all work
Last edited by blackcheck; 01-11-2002 at 02:29.
Old Posted: 01-11-2002
default_avatar
alexnoe (CDFreaks Resident)
Posts: 4,695
  • Find More Posts by alexnoe
This would mean that Venom was too pessimistic. Does the image work on several types of cd-r?

topic fixed!
__________________
Asus P4C800E-Deluxe, Win XP, P4/2800 HT, 2048 MB RAM, 600 GB HDD, Plextor PX712/716/755/Premium, LG 4120B, Pioneer A08, Pioneer A09, NEC ND-3540A/4550A
------------------------------------------------
If at first you don't succeed, redefine success!
How a troll wants to force users of Linux to buy Windows just to make use of Plextor DVD writer unique functions
------------------------------------------------
PxScan/PxView (compatible to Premium, PX-712, PX-714, PX-716), now with built-in picture file output
Bitsetting via Autostart
My Blog about DADVSI (new french copyright)
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
i tried cdr and rw
Old Posted: 01-11-2002
default_avatar
alexnoe (CDFreaks Resident)
Posts: 4,695
  • Find More Posts by alexnoe
Is there a possibility to automatize this?
__________________
Asus P4C800E-Deluxe, Win XP, P4/2800 HT, 2048 MB RAM, 600 GB HDD, Plextor PX712/716/755/Premium, LG 4120B, Pioneer A08, Pioneer A09, NEC ND-3540A/4550A
------------------------------------------------
If at first you don't succeed, redefine success!
How a troll wants to force users of Linux to buy Windows just to make use of Plextor DVD writer unique functions
------------------------------------------------
PxScan/PxView (compatible to Premium, PX-712, PX-714, PX-716), now with built-in picture file output
Bitsetting via Autostart
My Blog about DADVSI (new french copyright)
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
sure
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
blindwrite has a tool called bwt creator or something like that.
that's where the numbers are from.
Old Posted: 01-11-2002
default_avatar
Dazog (New on Forum)
Posts: 18
  • Find More Posts by Dazog
now if someone could make a program to do this but load mds files so you don't have to change the code for every game..

A small patching program..

Nice work Blackcheck.
Old Posted: 01-11-2002
default_avatar
Khaine (CD Freaks Rookie)
Posts: 31
  • Find More Posts by Khaine
good one blackcheck

/me humbly bows down

Old Posted: 01-11-2002
default_avatar
roadworker (CDFreaks Resident)
Posts: 749
  • Find More Posts by roadworker
Congratulations,blackcheck!!!
Old Posted: 01-11-2002
default_avatar
Fr4nz (CD Freaks Senior Member)
Posts: 272
  • Find More Posts by Fr4nz
I've one question: would be these twin sectors copyable, for example, by CloneCD or Alcohol (in better words make a copy of a copy)?
Old Posted: 01-11-2002
VeNoM386's Avatar
VeNoM386 (DAEMON Tools Author)
Posts: 41
  • Find More Posts by VeNoM386
LOL, Blackcheck, you seem to be rather stubborn.
Have you tried to look at physical parameters of such CD-R in BWABuilder?
Also I am wondering on what drives did it work for you - the way you insert twin sectors you will not be even able to read them on many drives. You will simply get a lot of bad sectors.
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
Quote:
Originally posted by VeNoM386
LOL, Blackcheck, you seem to be rather stubborn.
Have you tried to look at physical parameters of such CD-R in BWABuilder?
Also I am wondering on what drives did it work for you - the way you insert twin sectors you will not be even able to read them on many drives. You will simply get a lot of bad sectors.
1. i sure am...

2. yes, it looks like the securom diagram, but with bigger peaks.

3. i tried on aopen cdrw24 liteon 24x and two noname 40x drives.

i have tried various patterns , and 1,6 worked best.
i'm not saying that this is the ultimative bulletproof way to
copy securom. this is just an example how it worked for me.

the point is that the new securom CAN be copied. now others can find ways to do it reliably.
Last edited by blackcheck; 01-11-2002 at 17:18.
Old Posted: 01-11-2002
default_avatar
AtomicX (CD Freaks Member)
Posts: 223
  • Find More Posts by AtomicX
Venom's other point was that (if I recall correctly) a simple check would enable the SecuROM loader to detect twin sectors. This maybe like AWS, some burners / readers work, others don't. The point is, if you only want to make a copy for personal backup, as long as your CDROM drive can read the twin sectors then it doesn't matter what other drives can.

Venom is technically correct, you can't physically copy the protections. However there may be tricks that will fool the loader.
__________________
AtomicXperiance
Old Posted: 01-11-2002
VeNoM386's Avatar
VeNoM386 (DAEMON Tools Author)
Posts: 41
  • Find More Posts by VeNoM386
Unfortunately, in the way you try it CANNOT be copied. What you did is just only a far approximation.

1)The density of CD you made does not match original even in the near approach and can be easily detected - I bet SONY already enhances their code;-)I wonder how it works at all - their bug.

2)The peaks that your CD produces will strongly depend on the reading step: 9, 13, 27 etc will produce different peaks.This is also because inital sector offset is random.

3)What is most important - your CD is not readable on most CDROMs, as I already told (eg. Plextor, Toshiba)
Old Posted: 01-11-2002
default_avatar
alexnoe (CDFreaks Resident)
Posts: 4,695
  • Find More Posts by alexnoe
I have a Toshiba 1502, my brother has Unreal Tounament => blackcheck only needs to send the compiled tool and I'll see whether it works on Toshiba drives or not.
__________________
Asus P4C800E-Deluxe, Win XP, P4/2800 HT, 2048 MB RAM, 600 GB HDD, Plextor PX712/716/755/Premium, LG 4120B, Pioneer A08, Pioneer A09, NEC ND-3540A/4550A
------------------------------------------------
If at first you don't succeed, redefine success!
How a troll wants to force users of Linux to buy Windows just to make use of Plextor DVD writer unique functions
------------------------------------------------
PxScan/PxView (compatible to Premium, PX-712, PX-714, PX-716), now with built-in picture file output
Bitsetting via Autostart
My Blog about DADVSI (new french copyright)
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
<1)The density of CD you made does not match original even in
<the near approach and can be easily detected - I bet SONY
<already enhances their code;-)I wonder how it works at all -
<their bug.

sure, clonecd's bad sectors, aws etc can be detected easily,too..


<2)The peaks that your CD produces will strongly depend on the
<reading step: 9, 13, 27 etc will produce different peaks.This is
<also because inital sector offset is random.

i haven't debugged the loader with my copy yet. but as i recall
the stepping does not change that often. so maybe my copy
won't work with different steps.


<3)What is most important - your CD is not readable on most
<CDROMs, as I already told (eg. Plextor, Toshiba)

uhm if that's true it's bad.. but not my problem

btw i just copied hotel giant this way...

Old Posted: 01-11-2002
default_avatar
Lightbringer (New on Forum)
Posts: 22
  • Find More Posts by Lightbringer
Venom seems to be right. Images modified with Blackcheck's funky star generator are not readable without errors on my Toshiba XM-6202B CD-ROM drive (firmware 1119). It reports about 25 bad sectors per 2000 sectors. No read errors, however, on a Lite-On LTD-165H DVD-ROM drive (firmware CH0Q).
Old Posted: 01-11-2002
default_avatar
AtomicX (CD Freaks Member)
Posts: 223
  • Find More Posts by AtomicX
oh and talking about DT, when will we get to be able to change the driver name or is that a technical impossibility. It seems that every time a new game / patch is released the new driver is blacklisted (sorry this is O/T but Venom visits this forum )
__________________
AtomicXperiance
Old Posted: 01-11-2002
VeNoM386's Avatar
VeNoM386 (DAEMON Tools Author)
Posts: 41
  • Find More Posts by VeNoM386
The file from Blackcheck can be easily compiled in Visual Studio., just create new Win32 console application and paste the code there..
@AtomicX: currently I am changing driver name with every new version, I hope they get bored some day...;-)
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
lol, phenoprotect
Old Posted: 01-11-2002
DoMiN8ToR's Avatar
DoMiN8ToR (Former Management)
Posts: 9,067
  • Find More Posts by DoMiN8ToR
Hmmm according to google, that's a protection I wonder what spath will do with him, as he doesn't like to talk to protectionists
__________________
cdfreaks.com [ World's largest CD/DVD community ]

Need some help ? Please use our search function first
Old Posted: 01-11-2002
default_avatar
blackcheck (CD Freaks Expert)
Posts: 143
  • Find More Posts by blackcheck
<Hmmm according to google, that's a protection

not really
Old Posted: 01-11-2002
spath's Avatar
spath (Moderator)
Posts: 993
  • Find More Posts by spath
Alright guys, this is a technical forum, so if you
cannot read/compile a few lines of C you're
probably at the wrong place. All "how do i compile
it" and "send me the tool too at blah@doh.net" posts will be deleted.

As for changing the DT driver name, it's easy to
change it to a random string either in memory
at every loading or in the file during installation
(an old trick actually, we were already doing this
4 years ago to avoid SoftICE detection...)
Old Posted: 01-11-2002
default_avatar
Tormentor (New on Forum)
Posts: 2
  • Find More Posts by Tormentor
you had to replace the last array with the sectors read out of md5
There's more to MyCE.com

Listen up, we've got more. Product information on 107,830 products. Our experts have written 540 articles. We've gathered 16,487 news items for you to always keep updated.

Hello guest,
default
To benefit from all extra features you need to log in or sign up.

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

People who found this also searched for

  • twin sectors tools
  • linux twin sector backup
  • ut2003 create md5
All times are GMT +2. The time now is 21:12.
Top