- Timestamp:
- Feb 23, 2000, 1:57:40 AM (26 years ago)
- 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:45sandervl Exp $ */2 1 /* $Id: oslibmisc.cpp,v 1.7 2000-02-23 00:57:39 sandervl Exp $ */ 2 //#define DEBUG 3 3 /* 4 4 * Misc OS/2 util. procedures … … 27 27 #include "dbglocal.h" 28 28 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 }58 29 //****************************************************************************** 59 30 //TODO: not reentrant! … … 85 56 HMODULE hModule; /* module handle */ 86 57 APIRET rc; /* API returncode */ 87 static HMODULE hModuleExe ;/* "cached" hModuleExe */58 static HMODULE hModuleExe = 0; /* "cached" hModuleExe */ 88 59 PTIB pTIB; /* parameters for DosGetInfoBlocks */ 89 60 PPIB pPIB; 90 61 91 dprintf(("KERNEL32:GetModuleHandle(%s)\n", 62 _interrupt(3); 63 dprintf(("KERNEL32:GetModuleHandle(%x)\n", 92 64 pszModule)); 93 65 … … 114 86 if (rc != NO_ERROR) /* check for errors */ 115 87 { 116 SetLastError(rc); /* set error code */117 88 return (NULLHANDLE); /* signal failure */ 118 89 } … … 128 99 if (rc != NO_ERROR) /* check for errors */ 129 100 { 130 SetLastError(rc); /* set error code */131 101 return (NULLHANDLE); /* signal failure */ 132 102 } … … 150 120 } 151 121 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) 122 void OSLibWait(ULONG msec) 191 123 { 192 124 DosSleep(msec); -
trunk/src/kernel32/oslibmisc.h
r2311 r2865 1 /* $Id: oslibmisc.h,v 1. 2 2000-01-03 21:36:11sandervl Exp $ */1 /* $Id: oslibmisc.h,v 1.3 2000-02-23 00:57:40 sandervl Exp $ */ 2 2 /* 3 3 * Misc util. procedures … … 11 11 #define __OSLIBMISC_H__ 12 12 13 void OSLibSetExitList(unsigned long handler);14 void OSLibClearExitList();15 void OSLibRemoveExitList(unsigned long handler);16 17 13 char *OSLibGetDllName(ULONG hModule); 18 14 … … 21 17 ULONG OSLibiGetModuleHandleA(char *pszModule); 22 18 ULONG OSLibQueryModuleHandle(char *modname); 23 24 ULONG OSLibGetResourceSize(HMODULE hinstance, int id);25 ULONG OSLibGetResource(HMODULE hinstance, int id, char *destbuf, int bufLength);26 19 27 20 void OSLibWait(ULONG msec); -
trunk/src/kernel32/winimgres.cpp
r2802 r2865 1 /* $Id: winimgres.cpp,v 1.3 1 2000-02-16 14:22:12sandervl Exp $ */1 /* $Id: winimgres.cpp,v 1.32 2000-02-23 00:57:40 sandervl Exp $ */ 2 2 3 3 /* … … 336 336 return(ressize); 337 337 } 338 //******************************************************************************339 //******************************************************************************340 #if 0341 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 #endif361 338 //****************************************************************************** 362 339 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.