joe goode gamefowl | amorin portugal | avia highlands ranch | george hamlin iv canandaigua | avian doctor fort mill sc | mustek mdc 3000 driver | ernie ball musicman bass guitars | avian canary shock | avian emporium | avian altruism | avia ignition components | charismatic catholic congregations | george harrison crackerbox palace | george harris olympian actor | bluetick hound pictures | george hardy tuskegee | mustek pd77 | amoretti fashion | cnn nancy grace rene rockwell | mustek dv9500 | amore's pizza petersburg virginia | sven beres | mustek mdc 5500z review | charisma tchatche | sven birner | charisse bryant high jump | avian adventures mediana bird cage | mustek dv4000 pc cam driver | george harris refugio pete villareal | joe gormly | mustek gsmart lcd2 instructions | sven atzenhofer | ernie ball jr vp dimensions | avia s o s belgium | cnn pomegranate juice | amorgos accomodation | ernie americas funniest home videos | charismatic leadership is value neutral | muster fahrzeugschein | george harrisson | muster e dikson service | amorim cork composites | cnn marlena nancy grace | joe gibsons suzuki spartanburg sc | ernie ball not even slinky | mustelidae how many species | cnn linda stouffer | cnn intrnational | george harrison impersonator | mustek key fob driver | cnn keung lau | amorena | erni connector cross | cnn mccaffery | cnn nye sex tape | amores prohibidos elefante | george handtmann | joe gilbert frankfort kentucky | erni wilhelm | george harrison hoven | george hall gmac | mustek mp72 review | ernie and rubber ducky | sven beckedahl | sven borkenhagen | ernie banks 50th home run | aviaci n adas | bluetick beagle rabbit dogs | amores control machete perros | ernie bartocci | sven borghoff | sven board rapidshare | mustek photo albam | george harriston | sven becke | cnn market news stock 0a | charisma patricia jesse oklahoma | sven arnecke | bluetooth adapterfor midland frs | bluetongue in deer | aviaiton pilot | bluetooh info | sven b rig | cnn headquarters in atlanta georgia | amoretto drawing | avian congenital heart disease rds | mustek r100a firmware | cnn hattori | avian capo | george harrison ridgefield ct 06877 | bluetooth advertisin | bluetick hound diet | erni bal | avian adventures chiquita playtop | charismatic church eugene oregon | sven althoff | sven b shau | ernie banks parents | sven birkets into the electronic | george hartsuff | mustek dv 5500 battery charger | charisma v2.10 | joe gatto kentucky | ernie barnes said | cnn harrison saves hiker | sven audehm | joe geary newburgh | ernie and the automatics | sven barsch | aviad ben yehuda | george hamrah | george hanvey | george harrison songs wikipedia | charisma salon wichita | charisse ingram | aviacsa monterrey mexico | mustek pvra1 reviews | george hall grangemouth | mustek scanner hints | charisma video productions calgary | george harbo | george hammond eutaw springs | ernie ball petrucci | ernie barnes linoleum print | george harrington born 1853 missouri | sven berson | charisse mae dubai | avia life ins co | charissa bertels | ernie ball bass sub | sven bohnsack | sven averesch | amoreena lyrics | george harrison plagarism suit | george halajian | avia skeleton watch | ernie banks 1955 home runs | joe gatton memorial | charissa vaughn | avian botulism lake erie | mustek ups powermust office 650va | sven bodmann | ernie barnes lithograph | george harasimowicz | mustek ocr english language | cnn hillary mishawaka | muster fields vt | sven billhardt | avia mid cut shoes | avia workout | bluetoorh vga receiver | sven and friends tino | amored paintball gloves | charismatic church in lexington sc | george hagerty franklin pierce | joe glazier guitar repair | cnn michael ware pace wolf | ernie ball regular slinkys | bluetooth 5.8 ghz recording phone | george hauss | charissa williar | joe gottman | avia school columbus ohio | george hampton sites prize corina | ernie and bert water dripping | ernie banks may 11 1955 | ernie and tara sands texas | cnn hovering parents | amoretti spenser | mustek scanner 600 iii | avia rice | charisse graf | bluetooth acer aspire 5610z | joe grage | mustek dv8200 | cnn hawk gets dachshund | sven br uer | amorebieta echano | joe gomillion | sven beierle | george harlen contractor | sven blaesing | amorepacific | george harrison apple scruffs | avian canary regurgitate blood | amores by barbars boyd | joe gonnelli | bluetongue vaccines us | avian bumble foot diseases | george hatcher band mp3 | charisma spas repair jets | george halldin | george haw nanaimo music | george harrison mystical one tabs | mustek cardsmart | george hamawy | amories | amores for sewing | avia theater torrent | amorgos bank | cnn princess diana documentary | bluetones jesus | bluetick coonhound advertising | bluetooh technology | avian compulsive behavior | george hall farms simsbury ct | charismatic catholic scranton pa | george harrison burwell carter hall | sven beuschel | amorial | joe gibbs truck conversion | mustek mp72 dvd player | joe gibbs truck for sale | sven br sh | avia merlot | sven australian suite lp | cnn lizzie palmer | cnn it looses weatherman | mustek v520 | mustek dv4000 digital video camera | erni relay | erni u bert | sven bobrowski | charisma tours in egypt | erni press | avian clinic in arlington tx | mustek wcam 3x driver | amored amphibious rotating wheel | cnn olympic torch virus | charisse photographer | charisma supima cotton sheets | ernie ball guitar dealers | george hatton bullhead city az | amori cosmetics | cnn nsps | joe gibbs show cars | bluetick coonhound missouri | amore tomato paste double concentrated | cnn news ology | avian bone cancer holistic | amorgos aegiali | cnn headline sports livingston | mustek scanners ocr scans | bluetick breeder | avia video test | charissa ball in kansas | bluetie email | george handel full body view | george harrison dreamaway | mustela wipes | amore's resturant fayetteville ny | sven balogh | bluetick coonhound food | george halvorsen 5 chronic conditions | amore tomato paste | charismatic churches asu tempe az | cnn jennifer rogers | mustek travel digital photo frame | george hambleton pan american | amores de laura pausini youtube | mustek h230 support | joe goodman investment manager | amoret mo cemetery records | bluetick gazette | mustek mdc 6500z | joe gottron | mustek mdc3000 reviews | charissa mason | charisse gee | joe gorbach | bluetooth adapter for non-bluetooth phones | charissa hall pa | mustela double action stretch marks | george handel's death | ernie banks photograph | ernie barnes to know defeat | cnn news devlin arrest | charisma pvr pci | cnn news bigfoot | amore ti vieta | ernie ball volume pedal 6180 | mustela baby review | charisma samsonite | avian aspergillous vaccine | cnn pentagon barbara starr | bluetick coonhound and new hampshire | avia telecommunications | bluetooth advantages disadvantages | ernie balls electric guitar | cnn news cheesesteak debate | amoretti cupid | avia tankstellen in berlin | bluetick heeler breeders | sven agostini | bluetick redbone cross | amoretto | bluetooth adapter edr and logitech | cnn news bellarmine university | george halas it's not work | charisma salon wichita kansas | george hartselle | sven beissel | bluetick dog hunting sale | sven board asap | sven baumert | ernie ball mechanics shirt | sven ahner | cnn marine fighter | amorgos tourist information cyclades greece | george hanei | bluetick coon dogs for sale | george hatfield lawyer | amori home spas | charisme mp3 | charissa tate | cnn nueces river train | mustek keychain photo frame | charismatic productions jeff hardy theme | mustek gsmart d 50 5mp | aviagen vet | charismatic churches in woodstock georgia | charisma partnervermittlung | bluetie lounge | amoria party quest | amores telemundo | amoretti spensers | bluetooth adaptor for cingular | george hammel cook biography | ernhrung | charisma tvr | charisma restaurant stuttgart | aviall canada | bluetongue report greece 1998 | mustek fe1000 usb | sven alius | charismatic llamas | charismatic leaders and personal risk | joe geary pittsburgh football | sven board bbs place | amores by barbara boyd | cnn kenya airways crash | sven apod | bluetits birds | joe grabiec | amores by barbars boyd summarry | charismatic christian teaching free | bluetongue vaccines | sven boy imgboard | bluetick pups for sale | bluetongue in animals | joe giancaspro | cnn honeys | avia running tops | amorim tourism | mustek dv5000 | ernie anderson miracle methods | joe goheen | ernie adams new york | cnn pipeline alerter | joe gonzales muai tai | avialable domain names | bluetooth accesable porn links | ernie accorsi | bluetooth 2004 lexus sc 430 | bluetooth adapter for saab 9-3 | bluetit birdbox | mustek harde schijf accessoires | bluetooh x5 | george hatch appraisal | avia shoes plantar | sven angerer | bluetick rabbit dogs | aviall services chemicals | amorgos nightlife | ernie ball piezo | avia salon santa barbara | cnn hartman photograph teen | bluetick coonhound wallpapers | george hawranko | charismatic churches in smyrna georgia | sven braemer | cnn news story auburn shooting | bluetick kennels | amoretta | bluetick coonhound place an ad | george harsh sagan | bluetone bruce | amores pronounced | bluetick coonhound training | charismatic catholic church ghana | charisma sheets 310 thread count | sven br ger | george hamberger | mustek dv 3500 driver | charismatic bible colleges online | george harrison marwa blues mp3 | bluetooth adapters compatible with activesync | charismatic cole hauser | mustek pvr-a1 | bluetooth adpter | mustelus californicus | george haithcock | mustek p3600 a3 pro scanner | amoretta recipe cookie | joe gibbs edition silverado | george hancock softball | joe giglio transportation | aviagen | bluetoooth motorola | joe grabowski intelligent solutions | avia investments | joe goss karate school | mustek signs | amori lyric strani | bluetones woman | sven bierbaum | avia sportswear | charissa escort | sven boelke | amored fury crack | charismatic prophet church listing tulsa | cnn inhd | erni c santiago | avian bird id | amores pizza new york | sven and oly | bluetooht hacking | joe girardi orioles | charisse mae scandal | sven birkner | bluetooth 2.0 edr usb adaptor | ernie barong | joe gilmer st monica | charismatic uplifted hands | avian central combat flu slaughterhouse | cnn lakota | mustek wcam 300a | cnn omnicenter hotel | george hales isolation | joe genovese starbucks coffee | sven bbs ranchi bbs | cnn mney | george hampton ohio comics | bluetones guitar tab | george hauserman | amorie de orient hotel venice | ernie ball memorabilia | sven andreae | amoretti dedicated to laura | ernie and bert pirates | bluetongue impact uk | mustek pvr-a1 manual | amorie desk type | cnn presenter gay | mustek mdc630z 6mp | bluetick coon hound standard | sven bbs stories | george hayes dearing georgia | bluetooth accessible headsets | amorfix | mustela nigripes | avia warranty card | charissa hall | cnn human implanted microchips | cnn olney | bluetones bluetonic | mustek dv5300se users manuel | sven bbs elwebbs | george harrison dahni | george halstead vietnam | erni zd connector | george harrison concert dvd | avian artis | cnn headline news prometheus | bluetick beagle wisconsin | ernie ball slinky | charissa thatcher | joe girard cd | bluetongue transmission sheep | joe goettl | sven behrend | joe gierer | ernie ball slinky strings | cnn ipod chemicals | charisma spa filters | mustela frenata | cnn headline cupacabra | avia nevados hiking shoes | mustek powermust 1000 | bluetooth akono headset hbh-300 | avia vera isla mujeres | ernie ball music man evh | george harrison burwell virginia | joe girardi florida marlins coaches | ernie ball phosphor bronze | ernie banks chicago cubs player | george harrison msl | charisma pink scroll label | joe geeslin | charisma playboy buffy | george hartwell bournemouth | joe graedon's the peoples pharmacy | sven breske | bluetongue virus virion | cnn hooters shanghai | joe gibbs must go | ernie ball slinky guitar strings | avia home theater download | ernie ball ass dating | ernie and bert costume | sven aufderheide | charissa carroll | avialable loads | avian epidemic in prisons | george harrisons friar park estate | joe gib chevy truck | mustek photo frame troubleshooting | ernie ackley | george harrison arpa | cnn lindsay's dual language program | george harrison cracker jack palace | bluetick hound forum | ernie ball silhouette custom color | bluetie hosting | joe golian | mustek dv5200 | avia hdtv calibration disc | sven bohnen | ernia al disco | mustek pvr-h160 | george harter genealogy | avia shoe 775 | sven board pthc pics videos | bluetooth adapter for sansa | ernie barends | aviaid oil pumps | cnn headline news music filler | mustek region free progressive scan | bluetooth 802.11g mp3 video cooler | george hatzell | amoretto sour drink | bluetick coonhound dogs | sven birkerts into the electronic | erni ladd | joe glauber financial freedom | amoreiras plaza | ernie albertson | joe gibbs motocross practice track | charismatic chaos by john macarthur | ernie ball silhouette special | ernie ball albert lee | sven benthack | george haffenden | amore wig connie | joe gawith | sven bodenschatz | ernie ball beefy slinky review | joe gauthier connecticut | joe gnadt | avian acres indiana | ernie bauch cars | george hardie hipgnosis | joe gouger | cnn nancy grace renee rockwell | mustek dv3 camcorder | amores imposibles | sven ballhause | amorina | sven bolz | george harrison python cameo | amored games | charismalife | avian countertop | cnn newsroom for esl | joe godfrey comping pro tools | bluetick coon hounds for sale | amored | sven avemaria | charisma ridge horse catalog | bluetongue vaccine sale | charisma verlag dusseldorf | aviall canada ltd | joe goss karate | bluetones tab | mustek r100a dvd recorder manual | cnn presents after jesus | george hakes | mustek pl510 10 manual | avia pasta | sven bbs gateway futaba | joe goldberg labour students | george hateley | ernie accorsi children | cnn portucel | aviall brake wheel | avian austin powers birds impress | bluetick coonhound pictures | charismatic theonomy | sven bbs gate | amores de mercado elenco
.NET Manifest Resources

This article was released on www.codeproject.com.

Download demo project - 30 Kb

output

Introduction

This article is about the internal format of .NET Manifest Resources (or better the ".resources" files contained in it). I don't know if the code can be useful to you or not (probably not), but I like to write about undocumented stuff. In fact, this article is nothing sensational, I just wrote it 'cause I haven't found any documentation about this subject on the net, not even in the .NET MetaData specifics: Partition II MetaData.doc.

Some time ago I wrote a PE Editor called CFF Explorer ('cause I needed to) with the support for .NET MetaData, since there wasn't such a tool. The only tool I could find was Asmex (which you can find on codeproject), but the problem with that tool is that you cannot modify the MetaData fields and, moreover, it relies still on the .NET Framework. And I don't say this to criticize Asmex, which is surely useful, but because I needed something different. Anyway I wrote a resource viewer for the PE Editor and wanted to show the MetaData resources as well. So, in order to do that, avoiding to use an external .NET Assembly, I had to analyze the Manifest Resource format.

Let's take a look at the Manifest Resources contained in a .NET assembly:

 CFF Explorer

As you can see, there can be various types of files. Reading a bitmap, for example, is very simple: every Manifest Resource begins with a dword that tells us the size of the actual embedded resource... And that's it... After that, we have our bitmap. Ok, but what about those ".resources" files? The article is all about them. In this shot there's a ".resources" file for every dialog in that .NET Assembly, this means every resource of a dialog is contained in the dialog's own ".resources" file.

Handling these compiled resources files is, using the .NET Framework, very easy. You can convert them into XML files (".resx" files) through a utility called Resgen.exe (downloadable on the MSDN) or simply use the members of the System.Resources namespace (who can also handle ".resx" files) to do whatever you want. You can create one, for example (the code is taken from the MSDN):

using System;
using System.Resources;


public class WriteResources {
   public static void Main(string[] args) {
     
      // Creates a resource writer.
      IResourceWriter writer = new ResourceWriter("myResources.resources");
   
      // Adds resources to the resource writer.
      writer.AddResource("String 1", "First String");

      writer.AddResource("String 2", "Second String");

      writer.AddResource("String 3", "Third String");

      // Writes the resources to the file or stream, and closes it.
      writer.Close();
   }
}

Through the use of ResourceWriter it's a very easy task to create resources files. What about reading them?

using System;
using System.Resources;
using System.Collections;
 
public class ReadResources {

   public static void Main(string[] args) {

      // Opens a resource reader and gets an enumerator from it.
      IResourceReader reader = new ResourceReader("myResources.resources");
      IDictionaryEnumerator en = reader.GetEnumerator();
     
      // Goes through the enumerator, printing out the key and value pairs.
      while (en.MoveNext()) {
         Console.WriteLine();
         Console.WriteLine("Name: {0}", en.Key);
         Console.WriteLine("Value: {0}", en.Value);
      }
      reader.Close();
   }
}

Very easy indeed. Through the IResourceReader interface we can ask for an enumerator which gives us every resource name and value. It's also possible to load directly a specific resource from a file etc etc. So, as you can see, the Framework provides everything we need to play around with resources files. Anyway, for those of you who are still interested in knowing the internal format, go on reading.

Resources Files Format

A very brief description. The first dword is a signature which has to be 0xBEEFCACE, otherwise the resources file has to be considered as invalid. Second dword contains the number of readers for this resources file, don't worry, it's something we don't have to talk about... Framework stuff. Third dword is the size of reader types This number is only good for us to skip the string (or strings) that follows, which is something like: "System.Resources.ResourceReader, mscorlibsSystem.Resources.RuntimeResourceSet, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". It tells the framework the reader to use for this resources file.

Ok, now we got to the interesting part. The next dword tells us the version of the resources file (existing versions are 1 and 2). After the version, another dword gives the number of actual resources in the file. Another dword follows and gives the number of resource types.

To gather the additional information we need, we have to skip the resource types. For each type there's a 7bit encoded integer who gives the size of the string that follows. To decode these kind of integers you have to read every byte until you find one which hasn't the highest bit set and make some additional operations to obtain the final value... For the moment let's just stick to the format. After having skipped the types we have to align our position to an 8 byte base. Then we have a dword * NumberOfResources and each dword contains the hash of a resource. Then we have the same amount of dwords, this time with the offsets of the resource names. Another important dword follows: the Data Section Offset. We need this offset to retrieve resources offsets. After this dword we have the resources names. Well, actually it's not just the names (I just call it this way), every name  (7bit encoded integer + unicode string) is followed by a dword, an offset which you can add to the DataSection offset to retrieve the resource offset. The first thing we find, given a resource offset, is a 7bit encoded integer, which is the type index for the current resource.

The Source Code

I put all the code in a simple class:

class CResourcesFile
{

public:

   CResourcesFile();
   ~CResourcesFile();

   BYTE *pBaseAddress;
   UINT Size;

   DWORD Version;
   DWORD NumberOfResources;
   DWORD NumberOfTypes;

   BYTE *pTypes;
   BYTE *pNamesOffsets;
   BYTE *pDataSection;
   BYTE *pNames;

   BOOL ProcessResourcesFile(BYTE *pAddress, UINT uSize);
   BOOL ReadName(UINT nResource, WCHAR *Str, UINT Len);
   BOOL GetResourceInfo(UINT nResource, WCHAR *Str, UINT Len,
      DWORD *Offset, INT *TypeIndex);

private:

   BOOL DecodeInt(BYTE *pAddress, INT *Value, UINT *uSize);
};

The use of this class is very simple, you just copy/paste the class and all its members to your project and use it someway like this:

void main()
{
   TCHAR FileName[MAX_PATH];

   _tprintf(_T("Resources File to open:\n"));
   _tscanf(_T("%s"), FileName);

   //
   // Open and read file
   //

   // ...

   CResourcesFile ResFile;

   if (ResFile.ProcessResourcesFile(BaseAddress, FileSize) == FALSE)
   {
      VirtualFree(BaseAddress, 0, MEM_RELEASE);
      return;
   }

   _tprintf(_T("\n\nFile: %s\n"), FileName);
   _tprintf(_T("Version: %d\n"), ResFile.Version);
   _tprintf(_T("Number of resources: %d\n"), ResFile.NumberOfResources);
   _tprintf(_T("Number of types: %d\n"), ResFile.NumberOfTypes);

   _tprintf(_T("\nList resources:\n\n"));

   WCHAR ResName[1024];

   for (UINT x = 0; x < ResFile.NumberOfResources; x++)
   {
      DWORD Offset;
      INT TypeIndex = 0;

      if (ResFile.GetResourceInfo(x, ResName, 1024, &Offset, &TypeIndex))
      {
         _tprintf(_T("Name: %S - Offset: %08X - TypeIndex: %d\n"), ResName,
            Offset, TypeIndex);
      }
   }

   VirtualFree(BaseAddress, 0, MEM_RELEASE);

   getch();
}

The first thing which has to be done is to process a resources file with the ProcessResourcesFile function:

BOOL CResourcesFile::ProcessResourcesFile(BYTE *pAddress, UINT uSize)
{
   BYTE *ptr = pAddress;

   //
   // Collect basic information: pointer and size of the file
   //

   pBaseAddress = ptr;
   Size = uSize;

   //
   // Read the magic number, its value has to be: 0xBEEFCACE
   //

   DWORD MagicNumber;

   MagicNumber = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   if (MagicNumber != RESOURCES_MAGIC_NUMBER)
      return FALSE;

   DWORD NumberOfReaderTypes;

   NumberOfReaderTypes = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   DWORD SizeOfReaderTypes;

   SizeOfReaderTypes = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   //
   // Skip ReaderTypes
   //

   ptr += SizeOfReaderTypes;

   //

   Version = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   //
   // Read number of resources
   //

   NumberOfResources = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   //
   // Read number of types
   //

   NumberOfTypes = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   //
   // Skip Types: (CHAR *Type;) * NumOfTypes
   // (Save position)
   //

   pTypes = ptr;

   for (UINT x = 0; x < NumberOfTypes; x++)
   {
      INT StringSize = 0;
      UINT ValueSize = 0;

      if (!DecodeInt(ptr, &StringSize, &ValueSize))
         return FALSE;
      ptr += ValueSize;

      ptr += StringSize;
   }

   //
   // Alignes position
   //

   DWORD Position = (DWORD) (((ULONG_PTR) ptr) - ((ULONG_PTR) pBaseAddress));

   DWORD Aligned = Position & 7;

   if (Aligned != 0)
   {
      ptr += (8 - Aligned);
   }

   //
   // Skip name hashes
   //

   ptr += (sizeof (DWORD) * NumberOfResources);

   //
   // Skip name positions (first save location)
   //

   pNamesOffsets = ptr;

   ptr += (sizeof (DWORD) * NumberOfResources);

   //
   // Read Data Section Offset
   //

   DWORD DataSectionOffset;

   DataSectionOffset = *(DWORD *) ptr;
   ptr += sizeof (DWORD);

   pDataSection = (BYTE *) (DataSectionOffset + ((ULONG_PTR) pBaseAddress));

   //
   // Save names position
   //

   pNames = ptr;

   return TRUE;
}

The ReadName is just a shorter version of the GetResourceInfo, so let's just see the GetResourceInfo and skip the rest:

//
// Collect Resource Info
//

BOOL CResourcesFile::GetResourceInfo(UINT nResource, WCHAR *Str, UINT Len,
                                     DWORD *Offset, INT *TypeIndex)
{
   //
   // Read name
   //

   DWORD NameOffset = *(DWORD *) ((nResource * sizeof (DWORD)) +
      ((ULONG_PTR) pNamesOffsets));

   if (NameOffset > (DWORD) (((ULONG_PTR) pNames) - ((ULONG_PTR) pDataSection)))
      return FALSE;

   ZeroMemory(Str, Len * sizeof (WCHAR));

   BYTE *ptr = (BYTE *) (NameOffset + ((ULONG_PTR) pNames));

   INT NameSize = 0;
   UINT ValueSize = 0;

   if (!DecodeInt(ptr, &NameSize, &ValueSize))
      return FALSE;
   ptr += ValueSize;

   memcpy(Str, ptr, NameSize);

   ptr += NameSize;

   //
   // After reading the name
   //

   DWORD DataOffset = *(DWORD *) ptr;

   BYTE *pData = (BYTE *) (DataOffset + ((ULONG_PTR) pDataSection));

   //
   // Collect info
   //

   if (Offset) *Offset = (DWORD) (((ULONG_PTR) pData) -
      ((ULONG_PTR) pBaseAddress));

   if (TypeIndex)
   {
      *TypeIndex = 0;
      ValueSize = 0;

      if (!DecodeInt(pData, TypeIndex, &ValueSize))
         return FALSE;
   }
   
   return TRUE;
}

That's all, I hope it's useful.

Post Scriptum

Of course that's not everything, if you want to handle resources, you have to threat them according to their type. This means you have to get their type from the TypeIndex. To retrieve the type string is very simple, instead of skipping all the types, you just skip the ones who come before the TypeIndex one and read the string which follows. In my CFF Explorer I support some types of resources (and display only those one) for example Bitmaps, Icons and PNGs.

 CFF Explorer

Have fun!

Daniel Pistelli