Ignore:
Timestamp:
May 28, 2000, 6:45:14 PM (25 years ago)
Author:
sandervl
Message:

resource handling changes

File:
1 edited

Legend:

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

    r3588 r3625  
    1 /* $Id: winimgres.cpp,v 1.37 2000-05-22 19:08:00 sandervl Exp $ */
     1/* $Id: winimgres.cpp,v 1.38 2000-05-28 16:45:13 sandervl Exp $ */
    22
    33/*
     
    2323#include <misc.h>
    2424#include <winimagebase.h>
    25 #include <winres.h>
    2625#include <unicode.h>
    2726#include <heapstring.h>
     
    3130#define DBG_LOCALLOG    DBG_winimgres
    3231#include "dbglocal.h"
     32
     33#define MAX_RES 17
     34char *ResTypes[MAX_RES] =
     35      {"niks", "CURSOR", "BITMAP", "ICON", "MENU", "DIALOG", "STRING",
     36       "FONTDIR", "FONT", "ACCELERATOR", "RCDATA",  "MESSAGETABLE",
     37       "GROUP_CURSOR", "niks", "GROUP_ICON", "niks", "VERSION"};
    3338
    3439//SvL: VPBuddy bugfix, seems to load bitmaps with type name 'DIB'
     
    262267}
    263268//******************************************************************************
     269//Returns pointer to data of resource handle
     270//******************************************************************************
     271char *Win32ImageBase::getResourceAddr(HRSRC hResource)
     272{
     273 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
     274
     275  if(pData == NULL) {
     276        DebugInt3();
     277        return NULL;
     278  }
     279  //ulRVAResourceSection contains the relative virtual address (relative to the start of the image)
     280  //for the resource section (images loaded by the pe.exe and pe2lx/win32k)
     281  //For LX images, this is 0 as OffsetToData contains a relative offset
     282  return (char *)((char *)pResDir + (pData->OffsetToData - ulRVAResourceSection));
     283}
     284//******************************************************************************
     285//******************************************************************************
     286ULONG Win32ImageBase::getResourceSize(HRSRC hResource)
     287{
     288 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
     289
     290  if(pData == NULL) {
     291        DebugInt3();
     292        return NULL;
     293  }
     294  return pData->Size;
     295}
     296//******************************************************************************
     297//findResource returns the pointer of the resource's IMAGE_RESOURCE_DATA_ENTRY structure
    264298//******************************************************************************
    265299HRSRC Win32ImageBase::findResourceA(LPCSTR lpszName, LPSTR lpszType, ULONG langid)
    266300{
    267301 PIMAGE_RESOURCE_DATA_ENTRY      pData = NULL;
    268  Win32Resource                  *res;
    269302 BOOL   fNumType;
    270303 char  *winres = NULL;
     
    334367    }
    335368    else    dprintf(("FindResource %s: resource %d (type %d, lang %x)", szModule, id, type, lang));
    336     //ulRVAResourceSection contains the relative virtual address (relative to the start of the image)
    337     //for the resource section (images loaded by the pe.exe and pe2lx/win32k)
    338     //For LX images, this is 0 as OffsetToData contains a relative offset
    339     char *resdata = (char *)((char *)pResDir + (pData->OffsetToData - ulRVAResourceSection));
    340     res = new Win32Resource(this, id, type, pData->Size, resdata);
    341 
    342     return (HRSRC) res;
     369
     370    return (HRSRC) pData;
    343371}
    344372//******************************************************************************
     
    359387    else    astring2 = (char *)lpszType;
    360388
    361     hres = (HRSRC) findResourceA(astring1, astring2, lang);
     389    hres = findResourceA(astring1, astring2, lang);
    362390
    363391    if(HIWORD(astring1)) FreeAsciiString(astring1);
Note: See TracChangeset for help on using the changeset viewer.