News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

lplpBlaBlaBla?

Started by DC, January 07, 2006, 01:15:17 AM

Previous topic - Next topic

DC

invoke  VerQueryValue, addr pBlock, addr szVer, addr lpTranslate, addr bLen
puts a pointer in lpTranslate which is suposed to be a of TYPE:
_LANGANDCODEPAGE    struct
    wLanguage   WORD    ?
    wCodePage   WORD    ?
_LANGANDCODEPAGE    ends
LANGANDCODEPAGE typedef _LANGANDCODEPAGE
ptrLANGANDCODEPAGE typedef ptr LANGANDCODEPAGE

I get the pointer but am unable to access the data, what am I missing?
I've tried ..... lpTranslate.wLanguage, ptr lpTranslate.wLanguage, ...
thanx for any help,
DC
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

DC

I'm gettin' closer with this...
        assume  edi:ptr LANGANDCODEPAGE
        mov     edi, lpTranslate
        invoke  wsprintf, addr SubBlock, addr szFrmt, [edi].wLanguage, [edi].wCodePage

I might even get it shortly...
wish me luck,
DC
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

DC

still stump't...
this is an attempt to translate the example for "VerQueryValue":
// Structure used to store enumerated languages and code pages.

HRESULT hr;

struct LANGANDCODEPAGE {
  WORD wLanguage;
  WORD wCodePage;
} *lpTranslate;

// Read the list of languages and code pages.

VerQueryValue(pBlock,
              TEXT("\\VarFileInfo\\Translation"),
              (LPVOID*)&lpTranslate,
              &cbTranslate);

// Read the file description for each language and code page.

for( i=0; i < (cbTranslate/sizeof(struct LANGANDCODEPAGE)); i++ )
{
  hr = StringCchPrintf(SubBlock, 50,
            TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"),
            lpTranslate[i].wLanguage,
            lpTranslate[i].wCodePage);
if (FAILED(hr))
{
// TODO: write error handler.
}

  // Retrieve file description for language and code page "i".
  VerQueryValue(pBlock,
                SubBlock,
                &lpBuffer,
                &dwBytes);
}

here's what I have so far...

[attachment deleted by admin]
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

zooba

Quote from: DC on January 07, 2006, 01:41:41 AM
I'm gettin' closer with this...
        assume  edi:ptr LANGANDCODEPAGE
        mov     edi, lpTranslate
        invoke  wsprintf, addr SubBlock, addr szFrmt, [edi].wLanguage, [edi].wCodePage

I might even get it shortly...
wish me luck,
DC

AFAICT, this should work.

My personal preference is not using ASSUME, and referring to [edi].LANGANDCODEPAD.wLanguage where edi is a pointer to the structure.

You may want to check to see if wsprintf is the culprit here. If it's expecting words and ML is extending them to DWORDs (or vice-versa) you won't get any correct output.
Try extending them yourself to DWORDs and telling wsprintf to expect DWORDs.

Cheers,

Zooba

DC

that was it!!!!!
Thanx zooba. that seems like an odd solution to this delema.
I would've thought MS would be more carefull with all there type'ing and what not...
thanx again,
DC
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

DC

sorry MS....
I guess I should've looked closer...
my bad,
DC
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

DC

cleaned up
thanx zooba for the tips, I like that style of reference better too

[attachment deleted by admin]
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net