Ignore:
Timestamp:
Oct 6, 1999, 1:26:02 AM (26 years ago)
Author:
phaller
Message:

Fix: problems while initializing SHELL32/NEW

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimgres.cpp

    r1131 r1146  
    1 /* $Id: winimgres.cpp,v 1.19 1999-10-04 20:52:34 sandervl Exp $ */
     1/* $Id: winimgres.cpp,v 1.20 1999-10-05 23:24:31 phaller Exp $ */
    22
    33/*
     
    1010 *
    1111 * TODO: Check created resource objects before loading the resource!
    12  * TODO: Once the resource handling in PE2LX/win32k is changed,
     12 * TODO: Is the name id of the version resource always 1?
     13 * TODO: Once the resource handling in PE2LX/win32k is changed,
    1314 *       getVersionStruct/Size can be moved into the Win32ImageBase class
    1415 *
     
    3536//PE spec says names & ids are sorted; keep on searching just to be sure
    3637//******************************************************************************
    37 PIMAGE_RESOURCE_DATA_ENTRY 
     38PIMAGE_RESOURCE_DATA_ENTRY
    3839 Win32ImageBase::getPEResourceEntry(ULONG id, ULONG type, ULONG lang)
    3940{
     
    4445 ULONG  nodeData[3], i, j, nameOffset;
    4546 BOOL  fFound = FALSE, fNumType;
     47
     48  //PH: our system LX DLLs might not have a resource segment
     49  if (pResDir == NULL)
     50    return NULL;
    4651
    4752  /* set pointer to first resource type entry */
     
    7277    prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResDir + (int)prde->u2.OffsetToData);
    7378
    74     if(i < pResDir->NumberOfNamedEntries) 
     79    if(i < pResDir->NumberOfNamedEntries)
    7580    {//name or id entry?
    7681        //SvL: 30-10-'97, high bit is set, so clear to get real offset
     
    8186        lstrcpynWtoA(typename, pstring->NameString, pstring->Length+1);
    8287        typename[pstring->Length] = 0;
    83        
     88
    8489        if(!fNumType) {
    8590            if(stricmp(typename, (char *)type) == 0) {
     
    142147  prde    = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((DWORD)prdType + sizeof(IMAGE_RESOURCE_DIRECTORY));
    143148
    144   //level 2 (id)   -> get first id?
    145   //level 3 (lang) -> get first language?
    146   if(*nodeData == IDLANG_GETFIRST) {
     149  if(level == 3 && *nodeData == LANG_GETFIRST) {
    147150        nrres  = prdType->NumberOfNamedEntries + prdType->NumberOfIdEntries;
    148151        fNumId = (prdType->NumberOfNamedEntries == 0);
     
    151154        fNumId = HIWORD(*nodeData) == 0;
    152155
    153         if(fNumId) {//numeric or string id?
     156        if(fNumId) {//numeric or string id?
    154157                nrres = prdType->NumberOfIdEntries;
    155158                prde += prdType->NumberOfNamedEntries;  //skip name entries
     
    162165        prdType2 = (PIMAGE_RESOURCE_DIRECTORY)((ULONG)pResDir + (ULONG)prde->u2.OffsetToData);
    163166
    164         if(*nodeData == IDLANG_GETFIRST) {
    165                 fFound = TRUE; //always take the first one
    166         }
    167         else
    168167        if(!fNumId) {//name or id entry?
    169168                nameOffset = prde->u1.Name;
     
    185184                        fFound = TRUE;
    186185        }
     186        if(*nodeData == LANG_GETFIRST)
     187                fFound = TRUE;
    187188
    188189        if(fFound) {
     
    393394    if(HIWORD(lpszType) != 0) {
    394395                astring2 = UnicodeToAsciiString(lpszType);
    395     } 
     396    }
    396397    else        astring2 = (char *)lpszType;
    397398
     
    431432    if(HIWORD(lpszType) != 0) {
    432433                astring2 = UnicodeToAsciiString(lpszType);
    433     } 
     434    }
    434435    else        astring2 = (char *)lpszType;
    435436
     
    477478        return FALSE;
    478479  }
    479   pData = getPEResourceEntry(ID_GETFIRST, NTRT_VERSION);
     480  pData = getPEResourceEntry(1, NTRT_VERSION);
    480481  if(pData == NULL) {
    481482        dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!"));
Note: See TracChangeset for help on using the changeset viewer.