Changeset 2865 for trunk/src


Ignore:
Timestamp:
Feb 23, 2000, 1:57:40 AM (26 years ago)
Author:
sandervl
Message:

Fixed wrong calling convention for SetLastError calls in OSLibiGetModuleHandleA

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

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

    r2803 r2865  
    1 /* $Id: oslibmisc.cpp,v 1.6 2000-02-16 14:25:45 sandervl Exp $ */
    2 
     1/* $Id: oslibmisc.cpp,v 1.7 2000-02-23 00:57:39 sandervl Exp $ */
     2//#define DEBUG
    33/*
    44 * Misc OS/2 util. procedures
     
    2727#include "dbglocal.h"
    2828
    29 /***********************************
    30  * PH: fixups for missing os2win.h *
    31  ***********************************/
    32 
    33 void _System SetLastError(ULONG ulError);
    34 
    35 //******************************************************************************
    36 //******************************************************************************
    37 void OSLibSetExitList(unsigned long handler)
    38 {
    39  APIRET rc;
    40 
    41   rc = DosExitList(EXLST_ADD | 0x00002A00, (PFNEXITLIST)handler);
    42   if(rc) {
    43     dprintf(("DosExitList returned %d\n", rc));
    44   }
    45 }
    46 //******************************************************************************
    47 //******************************************************************************
    48 void OSLibClearExitList()
    49 {
    50   DosExitList(EXLST_EXIT, NULL);
    51 }
    52 //******************************************************************************
    53 //******************************************************************************
    54 void OSLibRemoveExitList(unsigned long handler)
    55 {
    56   DosExitList(EXLST_REMOVE, (PFNEXITLIST)handler);
    57 }
    5829//******************************************************************************
    5930//TODO: not reentrant!
     
    8556  HMODULE hModule;                                          /* module handle */
    8657  APIRET  rc;                                              /* API returncode */
    87   static HMODULE hModuleExe                        /* "cached" hModuleExe */
     58  static HMODULE hModuleExe = 0;                        /* "cached" hModuleExe */
    8859  PTIB pTIB;                              /* parameters for DosGetInfoBlocks */
    8960  PPIB pPIB;
    9061
    91   dprintf(("KERNEL32:GetModuleHandle(%s)\n",
     62  _interrupt(3);
     63  dprintf(("KERNEL32:GetModuleHandle(%x)\n",
    9264           pszModule));
    9365
     
    11486    if (rc != NO_ERROR)                                  /* check for errors */
    11587    {
    116       SetLastError(rc);                                    /* set error code */
    11788      return (NULLHANDLE);                                 /* signal failure */
    11889    }
     
    12899    if (rc != NO_ERROR)                                  /* check for errors */
    129100    {
    130       SetLastError(rc);                                    /* set error code */
    131101      return (NULLHANDLE);                                 /* signal failure */
    132102    }
     
    150120}
    151121
    152 //SvL: only for RT_RCDATA!
    153 ULONG OSLibGetResourceSize(HMODULE hinstance, int id)
    154 {
    155  APIRET rc;
    156  ULONG  size;
    157 
    158   rc = DosQueryResourceSize(hinstance, RT_RCDATA, id, &size);
    159   if(rc) {
    160     dprintf(("DosQueryResourceSize returned %d, %X id = %d\n", rc, hinstance, id));
    161     return(0);
    162   }
    163   return(size);
    164 }
    165 
    166 ULONG OSLibGetResource(HMODULE hinstance, int id, char *destbuf, int bufLength)
    167 {
    168  APIRET rc;
    169  char  *resdata;
    170  ULONG  size;
    171 
    172    rc = DosQueryResourceSize(hinstance, RT_RCDATA, id, &size);
    173    if(rc) {
    174     dprintf(("OSLibGetResource: Can't get resource size of %d!!!\n", id));
    175     return(FALSE);
    176    }
    177    rc = DosGetResource(hinstance, RT_RCDATA, id, (PPVOID)&resdata);
    178    if(rc) {
    179     dprintf(("OSLibGetResource: Can't find resource %d!!!\n", id));
    180     return(FALSE);
    181    }
    182    dprintf(("OSLibGetResoure: bufLength %d, size %d, id %d", bufLength, size, id));
    183    size = min(size, bufLength);
    184    memcpy(destbuf, resdata, size);
    185    DosFreeResource(resdata);
    186 
    187    return(TRUE);
    188 }
    189 
    190 void  OSLibWait(ULONG msec)
     122void OSLibWait(ULONG msec)
    191123{
    192124   DosSleep(msec);
  • trunk/src/kernel32/oslibmisc.h

    r2311 r2865  
    1 /* $Id: oslibmisc.h,v 1.2 2000-01-03 21:36:11 sandervl Exp $ */
     1/* $Id: oslibmisc.h,v 1.3 2000-02-23 00:57:40 sandervl Exp $ */
    22/*
    33 * Misc util. procedures
     
    1111#define __OSLIBMISC_H__
    1212
    13 void OSLibSetExitList(unsigned long handler);
    14 void OSLibClearExitList();
    15 void OSLibRemoveExitList(unsigned long handler);
    16 
    1713char *OSLibGetDllName(ULONG hModule);
    1814
     
    2117ULONG OSLibiGetModuleHandleA(char *pszModule);
    2218ULONG OSLibQueryModuleHandle(char *modname);
    23 
    24 ULONG OSLibGetResourceSize(HMODULE hinstance, int id);
    25 ULONG OSLibGetResource(HMODULE hinstance, int id, char *destbuf, int bufLength);
    2619
    2720void  OSLibWait(ULONG msec);
  • trunk/src/kernel32/winimgres.cpp

    r2802 r2865  
    1 /* $Id: winimgres.cpp,v 1.31 2000-02-16 14:22:12 sandervl Exp $ */
     1/* $Id: winimgres.cpp,v 1.32 2000-02-23 00:57:40 sandervl Exp $ */
    22
    33/*
     
    336336    return(ressize);
    337337}
    338 //******************************************************************************
    339 //******************************************************************************
    340 #if 0
    341 ULONG Win32Pe2LxImage::getVersionSize()
    342 {
    343     if(getVersionId() == -1) {
    344         dprintf(("GetVersionSize: %s has no version resource!\n", szModule));
    345         return(0);
    346     }
    347     return OSLibGetResourceSize(hinstance, getVersionId());
    348 }
    349 //******************************************************************************
    350 //******************************************************************************
    351 BOOL Win32Pe2LxImage::getVersionStruct(char *verstruct, ULONG bufLength)
    352 {
    353     if(getVersionId() == -1) {
    354         dprintf(("GetVersionStruct: %s has no version resource!\n", szModule));
    355         SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
    356         return(FALSE);
    357     }
    358     return OSLibGetResource(hinstance, getVersionId(), verstruct, bufLength);
    359 }
    360 #endif
    361338//******************************************************************************
    362339//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.