hi
i have an source code to compile a GHIII FSB Decryptor to extract songs from FSB files of guitar hero 3
but i dont know compile this
please, someone help me with this, im release the code to someone compile this or help me to compie:
Code:
#include "windows.h"
#include "stdio.h"
#include "sys\stat.h"
#define KEY_LEN 11
char SwapByteBits(unsigned char cInput)
{
unsigned char nResult=0;
for(int i=0; i<8; i++)
{
nResult = nResult << 1;
nResult |= (cInput & 1);
cInput = cInput >> 1;
}
return (nResult);
}
int main(int argc, char* argv[])
{
int nError = 0;
struct _stat32 fileStat;
unsigned int nBufferSize = 0;
FILE* inFile = NULL;
FILE* outFile = NULL;
unsigned char* pBuffer;
unsigned char* pInput;
unsigned int nLoopIdx = 0;
unsigned char cpKey[KEY_LEN] = "5atu6w4zaw";
printf ("GHIII FSB Decryptor v1.0 by Invo\n");
printf ("--------------------------------\n");
printf ("\n");
// Check params
if (argc != 3)
{
printf ("Usage: %s <Input> <Output>\n", argv[0]);
return (1);
}
// Get the file size
nError = _stat32(argv[1], &fileStat);
if (nError != 0)
{
printf ("Failed to get the input file size!\n");
return (1);
}
nBufferSize = fileStat.st_size;
// Allocate buffer
pBuffer = (unsigned char*)malloc(nBufferSize);
if (pBuffer == NULL)
{
printf ("Failed to allocate input buffer!\n");
return (1);
}
// Open and read the input
inFile = fopen(argv[1], "rb");
if (inFile == NULL)
{
printf ("Failed to open the input file!\n");
return (1);
}
printf ("Reading file (%d Bytes)... ", nBufferSize);
fread(pBuffer, 1, nBufferSize, inFile);
fclose(inFile);
printf ("Done!\n");
// Decrypt
printf ("Decrypting... ");
pInput = pBuffer;
for (int nLoopIdx=0; nLoopIdx<nBufferSize; nLoopIdx++)
{
*pInput = SwapByteBits(*pInput ^ cpKey[nLoopIdx % (KEY_LEN-1)]);
pInput++;
}
printf ("Done!\n");
// Open and write the output
outFile = fopen(argv[2], "wb");
if (outFile == NULL)
{
printf ("Failed to open the output file!\n");
return (1);
}
printf ("Writing file... ");
fwrite(pBuffer, 1, nBufferSize, outFile);
fclose (outFile);
printf ("Done!\n");
// The end...
return (0);
}