Get some information from *.inf files

Here for general support for D series TVs, request and problem solve area.
Post Reply

swiny
Posts: 6
Joined: Fri Dec 09, 2011 9:03 pm

Get some information from *.inf files

Post 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).
Last edited by juusso on Mon Dec 12, 2011 1:33 am, edited 1 time in total.
Reason: url added.
UE32D6500VSXZG (T-GASDEUC-1014.0)
User avatar
juusso
SamyGO Moderator
Posts: 10128
Joined: Sun Mar 07, 2010 6:20 pm

Re: Get some information from *.inf files

Post by juusso »

Great! I think this could be merged to Decrypting tool, right? :)
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE
swiny
Posts: 6
Joined: Fri Dec 09, 2011 9:03 pm

Re: Get some information from *.inf files

Post 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.
UE32D6500VSXZG (T-GASDEUC-1014.0)
swiny
Posts: 6
Joined: Fri Dec 09, 2011 9:03 pm

Re: Get some information from *.inf files

Post by swiny »

@juuso: If Denny would like to do so, he could ? And thank you for adding the link.
UE32D6500VSXZG (T-GASDEUC-1014.0)
Ramses
Posts: 36
Joined: Thu Dec 15, 2011 2:07 am

Re: Get some information from *.inf files

Post by Ramses »

Take a look at "Samy PVR Manager" in this forum.
gooseye
Official SamyGO Developer
Posts: 132
Joined: Sat Dec 11, 2010 11:32 am

Re: Get some information from *.inf files

Post by gooseye »

@ swiny - nice job. I followed the instructions here to get a working cross-compiling linux i32 toolchain for ARM TV.

Post Reply

Return to “[D] Support”