Ignore:
Timestamp:
Jul 19, 1999, 1:51:03 PM (26 years ago)
Author:
sandervl
Message:

Added method for retrieving OS/2 converted resources (winres.cpp)

File:
1 edited

Legend:

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

    r120 r337  
    1 /* $Id: winres.cpp,v 1.3 1999-06-19 10:54:44 sandervl Exp $ */
     1/* $Id: winres.cpp,v 1.4 1999-07-19 11:50:35 sandervl Exp $ */
    22
    33/*
     
    2424#include <string.h>
    2525#define INCL_WINRES
    26 #include "win32type.h"
    27 #include "winres.h"
    28 #include "misc.h"
    29 #include "nameid.h"
    30 #include "winexe.h"
     26#include <win32type.h>
     27#include <winres.h>
     28#include <misc.h>
     29#include <nameid.h>
     30#include <winexe.h>
    3131
    3232static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy)
     
    9595  this->hres     = hRes;
    9696
     97  switch(type) {
     98    case NTRT_NEWBITMAP:
     99    case NTRT_BITMAP:
     100        orgos2type = RT_BITMAP;
     101        break;
     102    case NTRT_CURSOR:
     103    case NTRT_GROUP_CURSOR:
     104    case NTRT_GROUP_ICON:
     105    case NTRT_ICON:
     106        orgos2type = RT_POINTER;
     107        break;
     108    case NTRT_ACCELERATORS:
     109        orgos2type = RT_ACCELTABLE;
     110        break;
     111    case NTRT_NEWMENU:
     112    case NTRT_MENU:
     113        orgos2type = RT_MENU;
     114        break;
     115    case NTRT_NEWDIALOG:
     116    case NTRT_DIALOG:
     117        orgos2type = RT_DIALOG;
     118        break;
     119    case NTRT_FONTDIR:
     120    case NTRT_FONT:
     121    case NTRT_MESSAGETABLE:
     122    case NTRT_STRING:
     123    case NTRT_RCDATA:
     124    case NTRT_VERSION:
     125    default:
     126        orgos2type = RT_RCDATA;
     127        break;
     128  }
     129
    97130  rc = DosQueryResourceSize(module->hinstance, type, id, &ressize);
    98131  if(rc) {
    99     dprintf(("Win32Resource ctor: DosQueryResourceSize returned %X\n", rc));
     132    dprintf(("Win32Resource ctor: DosQueryResourceSize %x %d %d returned %X\n", module->hinstance, type, id, rc));
    100133    ressize = 0;
    101134  }
     
    113146  this->id       = id;
    114147  this->type     = type;
     148  orgos2type     = -1;
    115149  this->ressize  = size;
    116150  winresdata     = (char *)malloc(size);
     
    127161 Win32Resource *res = module->winres;
    128162
     163#if 0
     164  //returned by DosGetResource, so we don't (and mustn't) free it
    129165  if(os2resdata)    free(os2resdata);
     166#endif
    130167  if(winresdata)    free(winresdata);
    131168
     
    225262    DosFreeResource(resdata);
    226263  return winresdata;
     264}
     265//******************************************************************************
     266//******************************************************************************
     267PVOID Win32Resource::lockOS2Resource()
     268{
     269 APIRET rc;
     270 PVOID  resdata;
     271
     272   dprintf(("Win32Resource::lockOS2Resource %d\n", id));
     273   if(os2resdata == NULL) {
     274        rc = DosGetResource((HMODULE)module->hinstance, orgos2type, id, (PPVOID)&resdata);
     275        if(rc)  return(NULL);
     276        os2resdata = resdata;
     277   }
     278   return os2resdata;
    227279}
    228280//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.