How do I load a message table from a dll and extract all the message numbers?

I did a FindResource then LoadResource then LockResource but don't know what to do after that.... The SDK mentions MESSAGE_RESOURCE_BLOCK, MESSAGE_RESOURCE_DATA, and MESSAGE_RESOURCE_ENTRY structures, and I have a feeling I have to use 1 or all of them after LockResource somehow...
Posted on 2003-09-02 00:03:09 by Gunner
Gunner
...

MESSAGE_RESOURCE_DATA *mrd;
MESSAGE_RESOURCE_BLOCK *mrb;
MESSAGE_RESOURCE_ENTRY *mre;

ULONG i, j;

...

mrd = (MESSAGE_RESOURCE_DATA *)LockResource(...);
printf("NumberOfBlocks %u\n", mrd->NumberOfBlocks);

// enum block
for (i = 0; i < mrd->NumberOfBlocks; i++)
{
mrb = (MESSAGE_RESOURCE_BLOCK *) ((LPBYTE)&(mrd->Blocks) +
i*sizeof(MESSAGE_RESOURCE_BLOCK));

printf("MESSAGE RESOURCE BLOCK #%u \n", i);
printf(" LowId %u\n", mrb->LowId);
printf(" HighId %u\n", mrb->HighId);
printf(" OffsetToEntries 0x%08X\n", mrb->OffsetToEntries);

mre = (MESSAGE_RESOURCE_ENTRY *)((LPBYTE)mrd + mrb->OffsetToEntries);

// enum message
for (j = mrb->LowId; j <= mrb->HighId; j++)
{
printf(" MESSAGE_RESOURCE_ENTRY #%u \n", j);
printf(" Length #%u\n", (DWORD)mre->Length);
printf(" Flags #%u (%s)\n", (DWORD)mre->Flags,
(0 != mre->Flags) ? "UNICODE" : "ANSI");

... // do with mre->Text

mre = (MESSAGE_RESOURCE_ENTRY *) ((LPBYTE)mre + (DWORD)mre->Length);
}

printf("\n");
}
...
Posted on 2003-09-03 00:54:10 by P2M
Thanks P2M, I will try to convert to assembly, even though I don't know any c it looks pretty straight foward.

I did happen to come across ResEdit from Ewayne and took some of his code, but there was a lot more code to do what looks the same...
Posted on 2003-09-03 16:48:24 by Gunner