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

Fixed wrong calling convention for SetLastError calls in OSLibiGetModuleHandleA

File:
1 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);
Note: See TracChangeset for help on using the changeset viewer.