- Timestamp:
- Jun 23, 1999, 9:36:24 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/unicode.cpp
r100 r163 1 /* $Id: unicode.cpp,v 1. 7 1999-06-10 20:47:54 phaller Exp $ */1 /* $Id: unicode.cpp,v 1.8 1999-06-23 19:36:24 phaller Exp $ */ 2 2 3 3 /* … … 230 230 AsciiToUnicodeN(ascii, unicode, strlen(ascii)); 231 231 } 232 //****************************************************************************** 233 //TODO: use OS/2 unicode stuff 234 //****************************************************************************** 235 char *UnicodeToAscii(int length, WCHAR *NameString) 236 { 237 static char asciistring[256]; 238 int i; 239 240 if(length >= 255) length = 255; 241 for(i=0;i<length;i++) { 242 asciistring[i] = NameString[i] & 0xFF; 243 } 244 asciistring[length] = 0; 245 return(asciistring); 246 } 247 //****************************************************************************** 248 //****************************************************************************** 232 -
trunk/src/kernel32/winimgres.cpp
r99 r163 1 /* $Id: winimgres.cpp,v 1. 3 1999-06-10 19:09:04 phaller Exp $ */1 /* $Id: winimgres.cpp,v 1.4 1999-06-23 19:36:24 phaller Exp $ */ 2 2 3 3 /* … … 30 30 "GROUP_CURSOR", "niks", "GROUP_ICON", "niks", "VERSION"}; 31 31 32 33 //****************************************************************************** 34 //TODO: use OS/2 unicode stuff 35 //****************************************************************************** 36 char *extremelyuglyUnicodeToAscii(int length, WCHAR *NameString) 37 { 38 static char asciistring[256]; 39 int i; 40 41 if(length >= 255) length = 255; 42 for(i=0;i<length;i++) { 43 asciistring[i] = NameString[i] & 0xFF; 44 } 45 asciistring[length] = 0; 46 return(asciistring); 47 } 48 //****************************************************************************** 49 //****************************************************************************** 50 32 51 //****************************************************************************** 33 52 //Assuming names are case insensitive … … 94 113 //SvL: 30-10-'97, high bit is set, so clear to get real offset 95 114 prde->u1.Name &= ~0x80000000; 96 char *resname = UnicodeToAscii(*(WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name), (WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name + sizeof(WCHAR))); // first word = string length115 char *resname = extremelyuglyUnicodeToAscii(*(WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name), (WCHAR *)((ULONG)pResDir + (ULONG)prde->u1.Name + sizeof(WCHAR))); // first word = string length 97 116 if(!fNumId) { 98 117 if(stricmp(resname, (char *)type) == 0) { … … 186 205 if(!fNumId) {//name or id entry? 187 206 if(prde->u1.s.NameIsString) //unicode directory string /*PLF Sat 97-06-21 22:30:35*/ 188 189 190 resname =UnicodeToAscii(pstring->Length, pstring->NameString);191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 207 prde->u1.Name &= ~0x80000000; 208 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResDir + (ULONG)prde->u1.Name); 209 resname = extremelyuglyUnicodeToAscii(pstring->Length, pstring->NameString); 210 if(stricmp(resname, (char *)*nodeData) == 0) { 211 fFound = TRUE; 212 } 213 } 214 else { 215 if(*nodeData == prde->u1.Id) 216 fFound = TRUE; 217 } 218 if(*nodeData == LANG_GETFIRST) 219 fFound = TRUE; 220 221 if(fFound) { 222 if((ULONG)prdType2 & 0x80000000) {//subdirectory? 223 ProcessResSubDir(prdType2, nodeData+1); 224 } 225 else { 226 pData = (PIMAGE_RESOURCE_DATA_ENTRY)prdType2; 227 if(pData->Size) {//winamp17 winzip archive has resource with size 0 228 return(pData); 229 } 230 else return(NULL); 231 } 232 } 233 prde++; 215 234 } 216 235 return(NULL); … … 237 256 if(i == MAX_RES) {//custom resource type, stored as rcdata 238 257 dprintf(("FindResourceA custom type %s\n", lpszType)); 239 258 lpszType = (LPSTR)NTRT_RCDATA; 240 259 } 241 260 else lpszType = (LPSTR)i; … … 271 290 if((int)lpszName >> 16 != 0) {//convert string name identifier to numeric id 272 291 dprintf(("FindResource %s\n", lpszName)); 273 274 275 276 elselpszName = (LPCSTR)ConvertNameId(hinstance, (char *)lpszName);292 if(lpszName[0] == '#') {// #344 293 lpszName = (LPCSTR)atoi(&lpszName[1]); 294 } 295 else lpszName = (LPCSTR)ConvertNameId(hinstance, (char *)lpszName); 277 296 } 278 297 else dprintf(("FindResource %d\n", (int)lpszName)); … … 280 299 hres = O32_FindResource(hinstance, lpszName, szType); 281 300 if(hres) { 282 301 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 283 302 } 284 303 285 304 if(hres == NULL && (int)lpszName >> 16 == 0 && (int)szType == NTRT_STRING) { 286 287 288 289 290 305 hres = O32_FindResource(hinstance, (LPCSTR)(((int)lpszName - 1)*16), (LPCSTR)NTRT_RCDATA); 306 if(hres) { 307 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 308 } 309 else dprintf(("FindResourceA can't find string %d\n", (int)lpszName)); 291 310 } 292 311 dprintf(("FindResourceA returned %X (%X)\n", hres, GetLastError())); … … 364 383 365 384 if((int)lpszName >> 16 != 0) {//convert string name identifier to numeric id 366 385 astring1 = UnicodeToAsciiString(lpszName); 367 386 dprintf(("FindResourceW %X %s\n", hinstance, astring1)); 368 369 370 371 elselpszName = (LPWSTR)ConvertNameId(hinstance, (char *)astring1);387 if(astring1[0] == '#') {// #344 388 lpszName = (LPWSTR)atoi(&astring1[1]); 389 } 390 else lpszName = (LPWSTR)ConvertNameId(hinstance, (char *)astring1); 372 391 } 373 392 else dprintf(("FindResourceW %X %d\n", hinstance, (int)lpszName)); … … 375 394 hres = O32_FindResource(hinstance, (LPCSTR)lpszName, (LPCSTR)szType); 376 395 if(hres) { 377 396 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 378 397 } 379 398 380 399 if(hres == NULL && (int)lpszName >> 16 == 0 && (int)szType == NTRT_STRING) { 381 382 383 384 385 400 hres = O32_FindResource(hinstance, (LPCSTR)(((ULONG)lpszName - 1)*16), (LPCSTR)NTRT_RCDATA); 401 if(hres) { 402 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 403 } 404 else dprintf(("FindResourceW can't find string %d\n", (int)lpszName)); 386 405 } 387 406 if(astring1) FreeAsciiString(astring1);
Note:
See TracChangeset
for help on using the changeset viewer.