Page 1 of 1

Get some information from *.inf files

Posted: Sun Dec 11, 2011 8:57 pm
by swiny
I've written a very tiny C program to get some information from the *.inf files of PVR records. This may be usefull, e.g., to find the *.srf file you want to decrypt ("Samsung PVR Content Decrypting tool - final "). Here's the source:

Code: Select all

/******************************************************************************
 * This is infread.c
 * written by swiny
 *****************************************************************************/

#include <stdio.h>
#include <errno.h>
#include <wchar.h>
#include <stdlib.h>
#include <locale.h>

#define MAX_BUFFER 7464

int readucs2wchars(FILE *f,wchar_t *buffer, size_t buffsize) {
  wchar_t value = 1;
  size_t pos = 0;
  buffsize--;
  while ( (value != 0x0000) && (!feof( f )) && (pos < buffsize) ) {
    value = ((unsigned int)fgetc(f) << 8) | fgetc(f);
    buffer[pos++] = value;
  }
  buffer[buffsize]=0;
}

int main( int argc, const char **argv ) {
  FILE *src;
  int n, retval;
  wchar_t buffer[MAX_BUFFER+1];

  setlocale(LC_ALL,"");
  if ( argc == 1 ) {
    printf( "Usage: %s <inf-file> ...\n", argv[0] );
    return 0;
  } else {
    for ( retval = 0, n = 1; n < argc; n++ ) {
      src = fopen( argv[n], "rb" );
      if ( src ) {
        wprintf( L"%s:\n", argv[n] );
        readucs2wchars( src, buffer, 0x100 );
        wprintf(L"  %ls: ",buffer);
        if ( fseek( src, 0x100, SEEK_SET ) ) {
          perror( argv[n] );
          retval++;
        } else {
          readucs2wchars( src, buffer, 0x100 );
          wprintf(L"%ls\n", buffer );
          if ( fseek( src, 0x6f6, SEEK_SET ) ) {
            perror( argv[n] );
            retval++;
          } else {
            readucs2wchars( src, buffer, 0x1000 );
            wprintf(L"  %ls\n\n", buffer );
          }
        }
      } else {
        perror( argv[n] );
        retval++;
      }
      fclose( src );
    }
  }
  return retval;
}
You may compile it using

Code: Select all

gcc infread.c -o infread
I've tried it out with gcc 4.5.0 at Linux x86_64. Maybe cross compilation for arm7 would be possible (don't know how to do this).

Re: Get some information from *.inf files

Posted: Mon Dec 12, 2011 1:35 am
by juusso
Great! I think this could be merged to Decrypting tool, right? :)

Re: Get some information from *.inf files

Posted: Mon Dec 12, 2011 8:57 pm
by swiny
saman wrote:I changed this for unicode name:

Code: Select all

 
  if ( fseek( src, 0x317, SEEK_SET ) ) {
          perror( argv[n] );
          retval++;
        } else {
          readucs2wchars( src, buffer, 0x100 );
          wprintf(L"%ls\n", buffer );
I cannot see any difference between the ucs-2 name at 0x0100 and the ucs-2 name at 0x317. Is there any specification about the differences?

BTW: The language may be found at 0x0534, e.g. 0x72 0x65 0x67 0x00 = "reg" is "ger" (german). And at my test files I've found L"Multi" at 0x1910. Don't know what means. Nevertheless: I don't need any more information to find the correct file to decrypt.

Re: Get some information from *.inf files

Posted: Mon Dec 12, 2011 9:14 pm
by swiny
@juuso: If Denny would like to do so, he could ? And thank you for adding the link.

Re: Get some information from *.inf files

Posted: Thu Dec 15, 2011 4:27 am
by Ramses
Take a look at "Samy PVR Manager" in this forum.

Re: Get some information from *.inf files

Posted: Tue Dec 20, 2011 10:36 pm
by gooseye
@ swiny - nice job. I followed the instructions here to get a working cross-compiling linux i32 toolchain for ARM TV.