Ignore:
Timestamp:
Sep 23, 1999, 4:12:14 PM (26 years ago)
Author:
phaller
Message:

Fix: additional fix in findResourceW, getResourceSizeW

File:
1 edited

Legend:

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

    r1015 r1016  
    1 /* $Id: winimgres.cpp,v 1.16 1999-09-23 13:53:38 phaller Exp $ */
     1/* $Id: winimgres.cpp,v 1.17 1999-09-23 14:12:14 phaller Exp $ */
    22
    33/*
     
    380380HRSRC Win32ImageBase::findResourceW(LPWSTR lpszName, LPWSTR lpszType, ULONG lang)
    381381{
    382  HRSRC hres;
    383  char *astring1 = NULL,
    384       *astring2 = NULL;
    385 
    386     if(HIWORD(lpszType) != 0) astring1 = UnicodeToAsciiString(lpszType);
    387     else                      astring1 = (char *)lpszType;
    388     if(HIWORD(lpszName) != 0) astring2 = UnicodeToAsciiString(lpszName);
    389     else                      astring2 = (char *)lpszName;
    390 
    391     hres = (HRSRC) findResourceA(astring1, astring2);
    392 
    393     /* do NOT free untranslated numerical Resource IDs */
    394     if(HIWORD(astring1)) FreeAsciiString(astring1);
    395     if(HIWORD(astring2)) FreeAsciiString(astring2);
    396 
    397     return(hres);
     382  HRSRC hres;
     383  char *astring1 = NULL,
     384       *astring2 = NULL;
     385  BOOL fAllocated1 = FALSE;
     386  BOOL fAllocated2 = FALSE;
     387
     388  if(HIWORD(lpszName) != 0)
     389  {
     390    astring1 = UnicodeToAsciiString((LPWSTR)lpszName);
     391    fAllocated1 = TRUE;
     392  }
     393  else
     394    astring1 = (char *)lpszName;
     395
     396  if(HIWORD(lpszType) != 0)
     397  {
     398    astring2 = UnicodeToAsciiString(lpszType);
     399    fAllocated2 = TRUE;
     400  }
     401  else
     402    astring2 = (char *)lpszType;
     403  hres = (HRSRC) findResourceA(astring1, astring2);
     404
     405   /* do NOT free untranslated numerical Resource IDs */
     406  if(fAllocated1) FreeAsciiString(astring1);
     407  if(fAllocated2) FreeAsciiString(astring2);
     408
     409  return(hres);
    398410}
    399411//******************************************************************************
     
    415427ULONG Win32ImageBase::getResourceSizeW(LPCWSTR lpszName, LPWSTR lpszType, ULONG lang)
    416428{
    417  char *astring1 = NULL, *astring2 = NULL;
    418  ULONG ressize;
    419 
    420     if(HIWORD(lpszType) != 0) {
    421                 char *resname = UnicodeToAsciiString(lpszType);
    422     }
    423     else        astring1 = (char *)lpszType;
    424 
    425     if(HIWORD(lpszName) != 0) {
    426                 astring2 = UnicodeToAsciiString((LPWSTR)lpszName);
    427     }
    428     else        astring2 = (char *)lpszName;
    429 
    430     ressize =  getResourceSizeA(astring1, astring2, lang);
    431     if(astring1) FreeAsciiString(astring1);
    432     if(astring2) FreeAsciiString(astring2);
    433 
    434     return(ressize);
     429  char *astring1 = NULL,
     430       *astring2 = NULL;
     431  ULONG ressize;
     432  BOOL fAllocated1 = FALSE;
     433  BOOL fAllocated2 = FALSE;
     434
     435  if(HIWORD(lpszName) != 0)
     436  {
     437    astring1 = UnicodeToAsciiString((LPWSTR)lpszName);
     438    fAllocated1 = TRUE;
     439  }
     440  else
     441    astring1 = (char *)lpszName;
     442
     443  if(HIWORD(lpszType) != 0)
     444  {
     445    astring2 = UnicodeToAsciiString(lpszType);
     446    fAllocated2 = TRUE;
     447  }
     448  else
     449    astring2 = (char *)lpszType;
     450
     451  ressize =  getResourceSizeA(astring1, astring2, lang);
     452
     453  /* do NOT free untranslated numerical Resource IDs */
     454  if(fAllocated1) FreeAsciiString(astring1);
     455  if(fAllocated2) FreeAsciiString(astring2);
     456
     457  return(ressize);
    435458}
    436459//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.