Changeset 597
- Timestamp:
- Aug 20, 1999, 1:52:44 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/kernel32/kernel32exp.def ¶
r581 r597 1 ; $Id: kernel32exp.def,v 1.1 1 1999-08-19 14:19:14 sandervl Exp $1 ; $Id: kernel32exp.def,v 1.12 1999-08-20 11:52:44 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 800 800 _lstrlenA@4 @779 801 801 _lstrlenW@4 @780 802 _lstrcpynAtoW@12 @781 803 _lstrcpynWtoA@12 @782 804 _lstrcpyAtoW@8 @783 805 _lstrcpyWtoA@8 @784 806 _lstrncmpA@12 @785 807 _lstrncmpW@12 @786 802 808 803 809 OS2memmove @906 -
TabularUnified trunk/src/kernel32/winimgres.cpp ¶
r589 r597 1 /* $Id: winimgres.cpp,v 1.1 0 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: winimgres.cpp,v 1.11 1999-08-20 11:52:44 sandervl Exp $ */ 2 2 3 3 /* … … 9 9 * Project Odin Software License can be found in LICENSE.TXT 10 10 * 11 * TODO: Check created resource objects before loading the resource! 12 * 11 13 */ 12 14 #include <os2win.h> … … 15 17 #include <string.h> 16 18 17 #include "misc.h" 18 #include "nameid.h" 19 #include "winimage.h" 20 #include "windll.h" 21 #include "winexe.h" 22 #include "winres.h" 19 #include <misc.h> 20 #include <nameid.h> 21 #include <winimage.h> 22 #include <windll.h> 23 #include <winexe.h> 24 #include <winres.h> 25 #include <unicode.h> 26 #include <heapstring.h> 23 27 #include "pefile.h" 24 #include "unicode.h"25 28 26 29 char *ResTypes[MAX_RES] = … … 39 42 PIMAGE_RESOURCE_DIRECTORY prdType; 40 43 PIMAGE_RESOURCE_DIRECTORY_ENTRY prde; 44 PIMAGE_RESOURCE_DIR_STRING_U pstring; 41 45 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; 42 ULONG nodeData[3], i, j ;46 ULONG nodeData[3], i, j, nameOffset; 43 47 BOOL fFound = FALSE, fNumType; 44 48 … … 73 77 {//name or id entry? 74 78 //SvL: 30-10-'97, high bit is set, so clear to get real offset 75 prde->u1.Name &= ~0x80000000; 76 char *typename = UnicodeToAsciiStringN((WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name + sizeof(WCHAR)), *(WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name)); // first word = string length 77 79 nameOffset = prde->u1.Name & ~0x80000000; 80 81 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + nameOffset); 82 char *typename = (char *)malloc(pstring->Length+1); 83 lstrcpynWtoA(typename, pstring->NameString, pstring->Length); 84 typename[pstring->Length] = 0; 85 78 86 if(!fNumType) { 79 87 if(stricmp(typename, (char *)type) == 0) { … … 90 98 } 91 99 } 92 FreeAsciiString(typename);100 free(typename); 93 101 } 94 102 else { … … 125 133 PIMAGE_RESOURCE_DATA_ENTRY pData; 126 134 BOOL fFound = FALSE, fNumId; 127 ULONG nrres ;135 ULONG nrres, nameOffset; 128 136 char *resname; 129 137 int i; … … 155 163 156 164 if(!fNumId) {//name or id entry? 165 nameOffset = prde->u1.Name; 157 166 if(prde->u1.s.NameIsString) //unicode directory string /*PLF Sat 97-06-21 22:30:35*/ 158 prde->u1.Name &= ~0x80000000; 159 160 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + (ULONG)prde->u1.Name); 161 resname = UnicodeToAsciiStringN(pstring->NameString, pstring->Length); 167 nameOffset &= ~0x80000000; 168 169 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + nameOffset); 170 171 resname = (char *)malloc(pstring->Length+1); 172 lstrcpynWtoA(resname, pstring->NameString, pstring->Length); 173 resname[pstring->Length] = 0; 162 174 if(stricmp(resname, (char *)*nodeData) == 0) { 163 175 fFound = TRUE; 164 176 } 165 FreeAsciiString(resname);177 free(resname); 166 178 } 167 179 else { … … 229 241 if(type == NTRT_STRING) { 230 242 stringid = id & 0xF; 231 id = (id >> 4) ;243 id = (id >> 4)+1; 232 244 } 233 245 } … … 235 247 if(stricmp((char *)type, ResTypes[NTRT_STRING]) == 0) { 236 248 stringid = id & 0xF; 237 id = (id >> 4) ;249 id = (id >> 4)+1; 238 250 } 239 251 } … … 250 262 251 263 for(i=0;i<stringid;i++) { 252 unicodestr += *unicodestr ;264 unicodestr += *unicodestr+1; 253 265 } 254 res = new Win32Resource(this, id, NTRT_STRING, (ULONG)*unicodestr, (char *)unicodestr); 266 res = new Win32Resource(this, id, NTRT_STRING, (*unicodestr+1)*sizeof(WCHAR), 267 (char *)(unicodestr+1)); 255 268 if(res == NULL) { 256 269 dprintf(("new Win32Resource failed!\n")); -
TabularUnified trunk/src/kernel32/winres.cpp ¶
r589 r597 1 /* $Id: winres.cpp,v 1. 9 1999-08-19 19:50:41sandervl Exp $ */1 /* $Id: winres.cpp,v 1.10 1999-08-20 11:52:44 sandervl Exp $ */ 2 2 3 3 /* … … 8 8 * 9 9 * Project Odin Software License can be found in LICENSE.TXT 10 * 10 11 * 11 12 */ … … 31 32 #include "cvtresource.h" 32 33 34 //****************************************************************************** 35 //****************************************************************************** 33 36 static ULONG CalcBitmapSize(ULONG cBits, LONG cx, LONG cy) 34 37 { … … 155 158 return; 156 159 } 157 memcpy(winresdata, resdata, size); 160 OS2ResHandle = 0; 161 162 if(type == NTRT_STRING) { 163 memcpy(winresdata, resdata, size-sizeof(WCHAR)); 164 ((USHORT *)winresdata)[size/sizeof(WCHAR)-1] = 0; 165 } 166 else memcpy(winresdata, resdata, size); 158 167 } 159 168 //****************************************************************************** … … 253 262 254 263 if(winresdata == NULL) { 255 rc = DosGetResource((HMODULE)module->hinstance, os2type, id, (PPVOID)&resdata);256 if(rc) {257 dprintf(("Can't find original string!!!\n"));258 return(NULL);259 }260 winresdata = (char *)malloc(ressize);261 memcpy(winresdata, resdata, ressize);264 rc = DosGetResource((HMODULE)module->hinstance, os2type, id, (PPVOID)&resdata); 265 if(rc) { 266 dprintf(("Can't find original resource!!!\n")); 267 return(NULL); 268 } 269 winresdata = (char *)malloc(ressize); 270 memcpy(winresdata, resdata, ressize); 262 271 } 263 272 if(resdata) 264 DosFreeResource(resdata); 273 DosFreeResource(resdata); 274 265 275 return winresdata; 266 276 } … … 321 331 case NTRT_FONT: 322 332 case NTRT_MESSAGETABLE: 323 case NTRT_STRING:324 333 case NTRT_RCDATA: 325 334 case NTRT_VERSION: 335 case NTRT_STRING: 336 break; 337 326 338 default: 327 339 break;
Note:
See TracChangeset
for help on using the changeset viewer.