REKLAMA

eicfg_removal_utility.zip

Windows 7 Home Premium 64-bit - klucz nie działa, możliwa niezgodność wersji

Zgraj płyte do iso/jeli masz iso to użyj załączonego narzędzia, podczas instalacji będziesz miał możliwość wyboru instalowanej wersji systemu


Pobierz plik - link do postu
  • eicfg_removal_utility.zip
    • eicfg_remover.sha1
    • readme.txt
    • eicfg_remover.c
    • eicfg_remover.exe


eicfg_removal_utility.zip > readme.txt

ei.cfg Removal Utility
Version 1.1
& lt; http://code.kliu.org/misc/win7utils/ & gt;

When used on an original Windows 7 ISO image, this utility will disable the
ei.cfg file, thus converting a disc image into a " universal " disc image.

When used on a Windows 7 ISO image that has already been patched by this
utility, this utility will undo the ei.cfg removal and restore the disc image
to its original state.


Version Compatibilty Note
=========================

ei.cfg Removal Utility version 1.1 uses a slightly different patching method
than version 1.0, and as a result, the version 1.0 utility cannot reverse the
patches done by version 1.1, and the version 1.1 utility cannot reverse the
patches done by version 1.0. If you would like to reverse the patch, you need
to do so with the version of the utility that created the patch.

Since version 1.0 existed for only 8 hours before being replaced by version 1.1,
this should not be a problem for most users.


Technical Details
=================

This works by toggling the deletion bit in the UDF file table, which instructs
the operating system to ignore the file and to treat it as if it does not exist.
By not physically removing the file, this eliminates the need to rebuild the
ISO, and makes this sort of fast, unintrustive patching possible. This also
makes it possible to reverse the patch and to restore the image to its original
state, if so desired.


eicfg_removal_utility.zip > eicfg_remover.c

/**
* ei.cfg Removal/Restore Utility
* Copyright (C) Kai Liu. Licensed under a standard BSD-style license.
* CRC16 code was adapted from 7-Zip, which is licensed under the GPL.
**/

#include & lt; windows.h & gt;

#pragma intrinsic(memset, memcmp, memcpy)

#define CB_WORK_RANGE (0x1000000)
#define CCH_WORK_RANGE (CB_WORK_RANGE/sizeof(WCHAR))
#define CCH_PATH_BUFFER (MAX_PATH & lt; & lt; 1)


typedef struct {
UINT16 ident;
UINT16 version;
UINT8 checksum;
UINT8 reserved;
UINT16 serial;
UINT16 crc;
UINT16 crclen;
UINT32 location;
} UDFTAG, *PUDFTAG;

typedef struct {
UINT32 cbExtent;
BYTE location[6];
BYTE iu[6];
} LONGALLOC, *PLONGALLOC;

typedef struct {
UDFTAG tag;
UINT16 version;
UINT8 characteristics;
UINT8 cbIdentifier;
LONGALLOC ICB;
UINT16 cbIU;
BYTE misc[2];
} UDFFILEDESC, *PUDFFILEDESC;


// CRC16 adapted from 7-Zip
void Crc16GenerateTable();
UINT16 Crc16Calc(const void *data, size_t size);
// CRC16 adapted from 7-Zip


#pragma comment(linker, " /version:1.1 " )
#pragma comment(linker, " /entry:eicfg_remover " )
void eicfg_remover( )
{
PVOID pvBuffer = LocalAlloc(LMEM_FIXED, CB_WORK_RANGE);

// Set up the OPENFILENAME structure

TCHAR szFileName[CCH_PATH_BUFFER];

OPENFILENAME ofn;
ZeroMemory( & ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFilter = TEXT( " ISO Image (*.iso)\0*.iso\0 " );
ofn.lpstrFile = szFileName;
ofn.lpstrFile[0] = 0;
ofn.nMaxFile = CCH_PATH_BUFFER;
ofn.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

if (pvBuffer & & GetOpenFileName( & ofn))
{
HANDLE hFile = CreateFile(
ofn.lpstrFile,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL
);

UINT64 cbFile;
DWORD cbOperation;

if ( hFile != INVALID_HANDLE_VALUE & &
GetFileSizeEx(hFile, (PLARGE_INTEGER) & cbFile) & &
cbFile & gt; CB_WORK_RANGE & &
ReadFile(hFile, pvBuffer, CB_WORK_RANGE, & cbOperation, NULL) & &
cbOperation == CB_WORK_RANGE )
{
PWSTR pszBuffer = pvBuffer;
UINT32 posStart;
PUDFFILEDESC pDesc = NULL;
int i;

// Locate the file name entry

for (i = 0x100; i & lt; CCH_WORK_RANGE - 0x100; ++i)
{
static const WCHAR szNeedle[] = L " ei.cfg " ;

if (memcmp(pszBuffer + i, szNeedle, sizeof(szNeedle) - sizeof(WCHAR)) == 0)
{
posStart = i * sizeof(WCHAR) - sizeof(UDFFILEDESC);
pDesc = (PUDFFILEDESC)((PBYTE)pvBuffer + posStart);

if ( pDesc- & gt; tag.ident == 257 & &
pDesc- & gt; tag.version == 2 & &
pDesc- & gt; tag.reserved == 0 & &
pDesc- & gt; tag.crclen == sizeof(UDFFILEDESC) - sizeof(UDFTAG) + (sizeof(szNeedle) - sizeof(WCHAR)) & &
pDesc- & gt; cbIdentifier == sizeof(szNeedle) - 1 & &
pDesc- & gt; cbIU == 0 & &
(pDesc- & gt; characteristics == 0 || pDesc- & gt; characteristics == 5) )
{
// Passed sanity check
break;
}
else
{
pDesc = NULL;
}
}
}

if (pDesc)
{
PBYTE pbRaw = (PBYTE)pDesc;

// Toggle whether the file is deleted

pDesc- & gt; characteristics = (pDesc- & gt; characteristics) ? 0 : 5;

// Recalculate the descriptor CRC16

Crc16GenerateTable();
pDesc- & gt; tag.crc = Crc16Calc( & pDesc- & gt; version, pDesc- & gt; tag.crclen);

// Recalculate the tag checksum

pDesc- & gt; tag.checksum = 0;

for (i = 0; i & lt; 4; ++i)
pDesc- & gt; tag.checksum += pbRaw[i];
for (i = 5; i & lt; 16; ++i)
pDesc- & gt; tag.checksum += pbRaw[i];

// Update the ISO file

SetFilePointer(hFile, posStart, NULL, FILE_BEGIN);
WriteFile(hFile, pDesc, sizeof(UDFFILEDESC), & cbOperation, NULL);

MessageBox(
NULL,
(pDesc- & gt; characteristics) ? TEXT( " ei.cfg removed " ) : TEXT( " ei.cfg restored " ),
NULL,
MB_ICONINFORMATION
);
}
else
{
MessageBox(NULL, TEXT( " ei.cfg not found. " ), NULL, MB_ICONERROR);
}

}
else
{
MessageBox(NULL, TEXT( " Input error. " ), NULL, MB_ICONERROR);
}

if (hFile != INVALID_HANDLE_VALUE)
CloseHandle(hFile);
}

LocalFree(pvBuffer);
ExitProcess(0);
}


// CRC16 adapted from 7-Zip
#define CRC16_INIT_VAL 0
#define CRC16_GET_DIGEST(crc) (crc)
#define CRC16_UPDATE_BYTE(crc, b) (g_Crc16Table[(((crc) & gt; & gt; 8) ^ (b)) & 0xFF] ^ ((crc) & lt; & lt; 8))

#define kCrc16Poly 0x1021
UINT16 g_Crc16Table[256];

void Crc16GenerateTable()
{
UINT32 i;
int j;
for (i = 0; i & lt; 256; i++)
{
UINT32 r = (i & lt; & lt; 8);
for (j = 8; j & gt; 0; j--)
r = ((r & 0x8000) ? ((r & lt; & lt; 1) ^ kCrc16Poly) : (r & lt; & lt; 1)) & 0xFFFF;
g_Crc16Table[i] = (UINT16)r;
}
}

UINT16 Crc16_Update(UINT16 v, const void *data, size_t size)
{
const BYTE *p = (const BYTE *)data;
for (; size & gt; 0 ; size--, p++)
v = CRC16_UPDATE_BYTE(v, *p);
return v;
}

UINT16 Crc16Calc(const void *data, size_t size)
{
return Crc16_Update(CRC16_INIT_VAL, data, size);
}
// CRC16 adapted from 7-Zip