- Timestamp:
- Feb 19, 2004, 2:03:07 PM (22 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/conbuffer.cpp
r10010 r10471 1 /* $Id: conbuffer.cpp,v 1. 19 2003-04-11 12:08:35 sandervl Exp $ */1 /* $Id: conbuffer.cpp,v 1.20 2004-02-19 13:03:05 sandervl Exp $ */ 2 2 3 3 /* … … 2498 2498 } 2499 2499 2500 2501 2500 /***************************************************************************** 2502 2501 * Name : DWORD HMDeviceConsoleBufferClass::WriteConsoleW … … 2524 2523 DWORD rc; 2525 2524 LPSTR pszAscii; 2525 int alen; 2526 2526 2527 2527 #ifdef DEBUG_LOCAL2 … … 2534 2534 #endif 2535 2535 2536 alen = WideCharToMultiByte( GetConsoleCP(), 0, (LPCWSTR)lpvBuffer, cchToWrite, 0, 0, 0, 0 ); 2536 2537 /* Ascii -> unicode translation */ 2537 pszAscii = (LPSTR)HEAP_malloc( cchToWrite+1);2538 pszAscii = (LPSTR)HEAP_malloc(( alen + 1 ) * sizeof( WCHAR )); 2538 2539 if (pszAscii == NULL) 2539 2540 return ERROR_NOT_ENOUGH_MEMORY; 2540 2541 2541 lstrcpynWtoA(pszAscii, (LPWSTR)lpvBuffer, cchToWrite+1); 2542 WideCharToMultiByte( GetConsoleCP(), 0, (LPWSTR)lpvBuffer, cchToWrite, pszAscii, alen, 0, 0 ); 2543 pszAscii[ alen ] = 0; 2542 2544 2543 2545 /* simply forward the request to that routine */ 2544 2546 rc = HMDeviceConsoleBufferClass::WriteFile(pHMHandleData, 2545 2547 pszAscii, 2546 cchToWrite,2548 alen, 2547 2549 lpcchWritten, 2548 2550 NULL, NULL); 2549 2551 2552 *lpcchWritten = MultiByteToWideChar( GetConsoleCP(), 0, pszAscii, *lpcchWritten, 0, 0 ); 2550 2553 // free memory again 2551 2554 HEAP_free(pszAscii); -
trunk/src/kernel32/conin.cpp
r7550 r10471 1 /* $Id: conin.cpp,v 1.1 7 2001-12-05 18:05:59sandervl Exp $ */1 /* $Id: conin.cpp,v 1.18 2004-02-19 13:03:05 sandervl Exp $ */ 2 2 3 3 /* … … 755 755 756 756 // create ascii buffer 757 lpstrAscii = (LPSTR)HEAP_malloc(cchToRead );757 lpstrAscii = (LPSTR)HEAP_malloc(cchToRead * sizeof( WCHAR )); 758 758 if (lpstrAscii == NULL) 759 759 return ERROR_NOT_ENOUGH_MEMORY; 760 760 761 761 /* simply forward the request to that routine */ 762 // FIXME : if results of ReadFile() have MBCS string, some data might be lost on next call. 762 763 dwResult = HMDeviceConsoleInClass::ReadFile(pHMHandleData, 763 764 lpstrAscii, 764 cchToRead ,765 cchToRead * sizeof( WCHAR ), 765 766 lpcchRead, 766 767 NULL, NULL); … … 768 769 /* Ascii -> unicode translation */ 769 770 if (dwResult == TRUE) 770 lstrcpynAtoW((LPWSTR)lpvBuffer, lpstrAscii, min(cchToRead, *lpcchRead+1));771 *lpcchRead = MultiByteToWideChar( GetConsoleCP(), 0, lpstrAscii, *lpcchRead, ( LPWSTR )lpvBuffer, cchToRead ); 771 772 772 773 HEAP_free(lpstrAscii); -
trunk/src/kernel32/console.cpp
r9544 r10471 1 /* $Id: console.cpp,v 1.3 2 2002-12-27 13:42:08sandervl Exp $ */1 /* $Id: console.cpp,v 1.33 2004-02-19 13:03:06 sandervl Exp $ */ 2 2 3 3 /* … … 61 61 #define INCL_DOSSEMAPHORES 62 62 #define INCL_DOSERRORS 63 #define INCL_DOSEXCEPTIONS 63 64 #define INCL_DOSPROCESS 64 65 #define INCL_DOSMODULEMGR 66 #define INCL_DOSDEVICES 65 67 #define INCL_VIO 66 68 #define INCL_KBD … … 177 179 if (ConsoleGlobals.hevConsole != NULLHANDLE) /* we're already initialized ?*/ 178 180 return (NO_ERROR); /* then abort immediately */ 181 182 rc = DosSetSignalExceptionFocus(SIG_SETFOCUS, &ulPostCount); 183 if(rc) { 184 dprintf(("DosSetSignalExceptionFocus failed with %d", rc)); 185 } 179 186 180 187 if(flVioConsole == TRUE) … … 2695 2702 *****************************************************************************/ 2696 2703 2704 2697 2705 DWORD WIN32API GetConsoleTitleW(LPWSTR lpConsoleTitle, 2698 2706 DWORD nSize) 2699 2707 { 2700 ULONG ulLength; /* length of text */2701 2702 2708 if (ConsoleGlobals.pszWindowTitle == NULL) /* is there a window title ? */ 2703 2709 return 0; /* abort immediately */ 2704 2710 2705 ulLength = strlen(ConsoleGlobals.pszWindowTitle); /* length of text */ 2706 2707 lstrcpynAtoW(lpConsoleTitle, 2708 ConsoleGlobals.pszWindowTitle, 2709 nSize); 2710 2711 return (nSize < ulLength) ? nSize : ulLength; 2711 MultiByteToWideChar( GetConsoleCP(), 0, ConsoleGlobals.pszWindowTitle, -1, 2712 lpConsoleTitle, nSize ); 2713 lpConsoleTitle[ nSize - 1 ] = 0; 2714 2715 return lstrlenW( lpConsoleTitle ); 2712 2716 } 2713 2717 … … 3443 3447 BOOL WIN32API SetConsoleTitleW(LPWSTR lpszTitle) 3444 3448 { 3449 int alen; 3450 3445 3451 if (lpszTitle == NULL) /* check parameters */ 3446 3452 return FALSE; … … 3449 3455 free (ConsoleGlobals.pszWindowTitle); /* then free it */ 3450 3456 3457 alen = WideCharToMultiByte( GetConsoleCP(), 0, lpszTitle, -1, 0, 0, 0, 0 ); 3451 3458 /* create an ascii copy of the lpszTitle */ 3452 int iLength = lstrlenW(lpszTitle); 3453 3454 ConsoleGlobals.pszWindowTitle = (PSZ)malloc(iLength+1); 3455 ConsoleGlobals.pszWindowTitle[iLength] = 0; 3456 lstrcpynWtoA(ConsoleGlobals.pszWindowTitle, 3457 lpszTitle, 3458 iLength+1); //must add one (lstrcpynWtoA terminates string) 3459 ConsoleGlobals.pszWindowTitle = (PSZ)malloc( alen ); 3460 WideCharToMultiByte( GetConsoleCP(), 0, lpszTitle, -1, 3461 ConsoleGlobals.pszWindowTitle, alen, 0, 0 ); 3459 3462 3460 3463 WinSetWindowText(ConsoleGlobals.hwndFrame, /* set new title text */ -
trunk/src/kernel32/winimgres.cpp
r6442 r10471 1 /* $Id: winimgres.cpp,v 1.5 3 2001-08-03 17:45:27 sandervl Exp $ */1 /* $Id: winimgres.cpp,v 1.54 2004-02-19 13:03:07 sandervl Exp $ */ 2 2 3 3 /* … … 11 11 * Copyright 1995 Thomas Sandford 12 12 * Copyright 1996 Martin von Loewis 13 * 13 * 14 14 * 15 15 * Project Odin Software License can be found in LICENSE.TXT … … 32 32 #include "oslibmisc.h" 33 33 34 #define DBG_LOCALLOG 34 #define DBG_LOCALLOG DBG_winimgres 35 35 #include "dbglocal.h" 36 36 … … 42 42 43 43 STD_RESTYPE ResType[MAX_RES] = 44 { {NULL, 0}, 45 {"CURSOR", 6}, 44 { {NULL, 0}, 45 {"CURSOR", 6}, 46 46 {"BITMAP", 6}, 47 47 {"ICON", 4}, … … 69 69 { 70 70 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; 71 71 72 72 pData = (PIMAGE_RESOURCE_DATA_ENTRY)findResourceA(lpszName, lpszType, lang); 73 73 if(pData == NULL) { … … 82 82 { 83 83 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; 84 84 85 85 pData = (PIMAGE_RESOURCE_DATA_ENTRY)findResourceW(lpszName, lpszType, lang); 86 86 if(pData == NULL) { … … 98 98 99 99 if(pData == NULL) { 100 101 100 DebugInt3(); 101 return NULL; 102 102 } 103 103 //ulRVAResourceSection contains the relative virtual address (relative to the start of the image) … … 113 113 114 114 if(pData == NULL) { 115 116 115 DebugInt3(); 116 return NULL; 117 117 } 118 118 return pData->Size; … … 127 127 HRSRC hRes; 128 128 129 if(HIWORD(lpszType) != 0) 130 { 131 129 if(HIWORD(lpszType) != 0) 130 { 131 typelen = strlen(lpszType); 132 132 133 133 for(int i=0;i<MAX_RES;i++) { 134 if(ResType[i].namelen && 134 if(ResType[i].namelen && 135 135 ResType[i].namelen == typelen && 136 136 stricmp(lpszType, ResType[i].typename) == 0) … … 144 144 if(!pResDirRet) { 145 145 dprintf2(("FindResourceA %s: resource %x (type %x, lang %x) TYPE NOT FOUND", szModule, lpszName, lpszType, lang)); 146 147 146 SetLastError(ERROR_RESOURCE_TYPE_NOT_FOUND); 147 return NULL; 148 148 } 149 149 pResDirRet = getResSubDirA(pResDirRet, lpszName); 150 150 if(!pResDirRet) { 151 151 dprintf2(("FindResourceA %s: resource %x (type %x, lang %x) NAME NOT FOUND", szModule, lpszName, lpszType, lang)); 152 153 152 SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND); 153 return NULL; 154 154 } 155 155 … … 160 160 lang == MAKELANGID(LANG_NEUTRAL, 3)) /* FIXME: real name? */ 161 161 { 162 162 hRes = getResourceLang(pResDirRet); 163 163 } 164 164 else hRes = getResourceLangEx(pResDirRet, lang); … … 181 181 HRSRC hRes; 182 182 183 if(HIWORD(lpszType) != 0 && lpszType[0] != (WCHAR)'#') 183 if(HIWORD(lpszType) != 0 && lpszType[0] != (WCHAR)'#') 184 184 { 185 185 astring1 = UnicodeToAsciiString(lpszType); 186 186 typelen = strlen(astring1); 187 187 188 188 for(int i=0;i<MAX_RES;i++) { 189 if(ResType[i].namelen && 189 if(ResType[i].namelen && 190 190 ResType[i].namelen == typelen && 191 191 stricmp(astring1, ResType[i].typename) == 0) … … 195 195 lpszType = (LPWSTR)i; 196 196 } 197 197 FreeAsciiString(astring1); 198 198 } 199 199 pResDirRet = getResSubDirW(pResRootDir, lpszType); 200 200 if(!pResDirRet) { 201 201 dprintf2(("FindResourceW %s: resource %x (type %x, lang %x) TYPE NOT FOUND", szModule, lpszName, lpszType, lang)); 202 203 202 SetLastError(ERROR_RESOURCE_TYPE_NOT_FOUND); 203 return NULL; 204 204 } 205 205 pResDirRet = getResSubDirW(pResDirRet, lpszName); 206 206 if(!pResDirRet) { 207 207 dprintf2(("FindResourceW %s: resource %x (type %x, lang %x) NAME NOT FOUND", szModule, lpszName, lpszType, lang)); 208 209 208 SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND); 209 return NULL; 210 210 } 211 211 … … 216 216 lang == MAKELANGID(LANG_NEUTRAL, 3)) /* FIXME: real name? */ 217 217 { 218 218 hRes = getResourceLang(pResDirRet); 219 219 } 220 220 else hRes = getResourceLangEx(pResDirRet, lang); … … 248 248 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 249 249 if(!hRes) { 250 251 250 /* 2. Neutral language with default sublanguage */ 251 lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); 252 252 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 253 253 } 254 254 if(!hRes) { 255 256 255 /* 3. Current locale lang id */ 256 lang = LANGIDFROMLCID(GetUserDefaultLCID()); 257 257 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 258 258 } 259 259 if(!hRes) { 260 261 260 /* 4. Current locale lang id with neutral sublanguage */ 261 lang = MAKELANGID(PRIMARYLANGID(lang), SUBLANG_NEUTRAL); 262 262 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 263 263 } 264 264 if(!hRes) { 265 266 265 /* 5. (!) LANG_ENGLISH, SUBLANG_DEFAULT */ 266 lang = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT); 267 267 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 268 268 } 269 269 if(!hRes) { 270 270 /* 6. Return first in the list */ 271 271 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang, TRUE); 272 272 } … … 290 290 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 291 291 if(!hRes) { 292 292 /* 2. Language with neutral sublanguage */ 293 293 lang = MAKELANGID(PRIMARYLANGID(lang), SUBLANG_NEUTRAL); 294 294 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 295 295 } 296 296 if(!hRes) { 297 297 /* 3. Neutral language with neutral sublanguage */ 298 298 lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); 299 299 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 300 300 } 301 301 if(!hRes) { 302 303 302 /* 4. Current locale lang id with neutral sublanguage */ 303 lang = MAKELANGID(PRIMARYLANGID(lang), SUBLANG_NEUTRAL); 304 304 hRes = (HRSRC)getResDataLang(pResDirToSearch, lang); 305 305 } … … 324 324 hRes = findResourceW((LPWSTR)ID_GETFIRST, (LPWSTR)NTRT_VERSION, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)); 325 325 if(hRes == NULL) { 326 326 //last error already set by findResourceW 327 327 dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!")); 328 328 return 0; … … 397 397 * @author knut st. osmundsen 398 398 */ 399 PIMAGE_RESOURCE_DIRECTORY Win32ImageBase::getResSubDirW(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 399 PIMAGE_RESOURCE_DIRECTORY Win32ImageBase::getResSubDirW(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 400 400 LPCWSTR lpszName) 401 401 { … … 405 405 406 406 if(pResDirToSearch == NULL) { 407 407 return NULL; 408 408 } 409 409 410 410 if((ULONG)lpszName == -1) {//check for nonsense values 411 411 return NULL; 412 412 } 413 413 … … 460 460 (PIMAGE_RESOURCE_DIR_STRING_U)(paResDirEntries[i].u1.s.NameOffset + (ULONG)pResRootDir /*?*/); 461 461 462 462 //SvL: Must do case insensitive string compare here 463 463 if (pResDirStr->Length == cusName 464 464 && lstrncmpiW(pResDirStr->NameString, lpszName, cusName) == 0) … … 485 485 * @author knut st. osmundsen 486 486 */ 487 PIMAGE_RESOURCE_DIRECTORY Win32ImageBase::getResSubDirA(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 487 PIMAGE_RESOURCE_DIRECTORY Win32ImageBase::getResSubDirA(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 488 488 LPCTSTR lpszName) 489 489 { … … 492 492 493 493 if(pResDirToSearch == NULL) { 494 494 return NULL; 495 495 } 496 496 497 497 if((ULONG)lpszName == -1) {//check for nonsense values 498 498 return NULL; 499 499 } 500 500 … … 528 528 */ 529 529 //****************************************************************************** 530 PIMAGE_RESOURCE_DATA_ENTRY 530 PIMAGE_RESOURCE_DATA_ENTRY 531 531 Win32ImageBase::getResDataLang(PIMAGE_RESOURCE_DIRECTORY pResDirToSearch, 532 532 ULONG language, BOOL fGetDefault) … … 536 536 537 537 if(pResDirToSearch == NULL) { 538 538 return NULL; 539 539 } 540 540 … … 542 542 543 543 if(pResDirToSearch->NumberOfNamedEntries) { 544 544 DebugInt3(); 545 545 } 546 546 paResDirEntries += pResDirToSearch->NumberOfNamedEntries; 547 547 548 548 for (i = 0; i < pResDirToSearch->NumberOfIdEntries; i++) { 549 if (paResDirEntries[i].u1.Id == language)549 if (paResDirEntries[i].u1.Id == language) 550 550 { 551 552 551 return (PIMAGE_RESOURCE_DATA_ENTRY) (paResDirEntries[i].u2.s.OffsetToDirectory + (ULONG)pResRootDir); 552 } 553 553 } 554 554 … … 556 556 if(fGetDefault) 557 557 { 558 559 } 560 return NULL; 561 } 562 //****************************************************************************** 563 //****************************************************************************** 564 BOOL Win32ImageBase::enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 558 return (PIMAGE_RESOURCE_DATA_ENTRY) (paResDirEntries[0].u2.s.OffsetToDirectory + (ULONG)pResRootDir); 559 } 560 return NULL; 561 } 562 //****************************************************************************** 563 //****************************************************************************** 564 BOOL Win32ImageBase::enumResourceTypesA(HMODULE hmod, ENUMRESTYPEPROCA lpEnumFunc, 565 565 LONG lParam) 566 566 { … … 591 591 prde = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResRootDir + sizeof(IMAGE_RESOURCE_DIRECTORY)); 592 592 593 for (i=0; i<pResRootDir->NumberOfNamedEntries+pResRootDir->NumberOfIdEntries && fRet; i++) 594 { 595 596 593 for (i=0; i<pResRootDir->NumberOfNamedEntries+pResRootDir->NumberOfIdEntries && fRet; i++) 594 { 595 /* locate directory or each resource type */ 596 prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResRootDir + (int)prde->u2.OffsetToData); 597 597 598 598 if (prde->u1.s.NameIsString) 599 {//name or id entry? 600 //SvL: 30-10-'97, high bit is set, so clear to get real offset 601 nameOffset = prde->u1.Name & ~0x80000000; 602 603 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResRootDir + nameOffset); 604 char *typename = (char *)malloc(pstring->Length+1); 605 lstrcpynWtoA(typename, pstring->NameString, pstring->Length+1); 606 typename[pstring->Length] = 0; 607 608 fRet = lpEnumFunc(hmod, typename, lParam); 609 free(typename); 610 } 611 else { 612 fRet = lpEnumFunc(hmod, (LPSTR)prde->u1.Id, lParam); 613 } 599 {//name or id entry? 600 //SvL: 30-10-'97, high bit is set, so clear to get real offset 601 nameOffset = prde->u1.Name & ~0x80000000; 602 603 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResRootDir + nameOffset); 604 int len = lstrlenWtoA( pstring->NameString, pstring->Length ); 605 char *typename = (char *)malloc( len + 1 ); 606 lstrcpynWtoA(typename, pstring->NameString, len + 1 ); 607 typename[len] = 0; 608 609 fRet = lpEnumFunc(hmod, typename, lParam); 610 free(typename); 611 } 612 else { 613 fRet = lpEnumFunc(hmod, (LPSTR)prde->u1.Id, lParam); 614 } 614 615 615 616 /* increment to next entry */ … … 620 621 //****************************************************************************** 621 622 //****************************************************************************** 622 BOOL Win32ImageBase::enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 623 BOOL Win32ImageBase::enumResourceTypesW(HMODULE hmod, ENUMRESTYPEPROCW lpEnumFunc, 623 624 LONG lParam) 624 625 { … … 650 651 prde = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResRootDir + sizeof(IMAGE_RESOURCE_DIRECTORY)); 651 652 652 for (i=0; i<pResRootDir->NumberOfNamedEntries+pResRootDir->NumberOfIdEntries && fRet; i++) 653 { 654 655 653 for (i=0; i<pResRootDir->NumberOfNamedEntries+pResRootDir->NumberOfIdEntries && fRet; i++) 654 { 655 /* locate directory or each resource type */ 656 prdType = (PIMAGE_RESOURCE_DIRECTORY)((int)pResRootDir + (int)prde->u2.OffsetToData); 656 657 657 658 if (prde->u1.s.NameIsString) 658 659 660 661 662 663 664 659 {//name or id entry? 660 //SvL: 30-10-'97, high bit is set, so clear to get real offset 661 nameOffset = prde->u1.Name & ~0x80000000; 662 663 pstring = (PIMAGE_RESOURCE_DIR_STRING_U)((ULONG)pResRootDir + nameOffset); 664 665 lpszType = (LPWSTR)malloc((pstring->Length+1) * sizeof(WCHAR)); 665 666 memcpy(lpszType, pstring->NameString, pstring->Length * sizeof(WCHAR)); 666 667 lpszType[pstring->Length] = 0; 667 668 668 669 670 671 672 elsefRet = lpEnumFunc(hmod, (LPWSTR)prde->u1.Id, lParam);669 fRet = lpEnumFunc(hmod, pstring->NameString, lParam); 670 671 free(lpszType); 672 } 673 else fRet = lpEnumFunc(hmod, (LPWSTR)prde->u1.Id, lParam); 673 674 674 675 /* increment to next entry */ … … 776 777 pszASCII = (char*)pszTmp; 777 778 } 778 lstrcpynWtoA(pszASCII, pResDirString->NameString, pResDirString->Length+1); 779 pszASCII[pResDirString->Length] = 0; 779 780 int len = lstrlenWtoA( pResDirString->NameString, pResDirString->Length ); 781 lstrcpynWtoA(pszASCII, pResDirString->NameString, len + 1); 782 pszASCII[len] = 0; 780 783 lpszName = pszASCII; 781 784 } … … 879 882 LPWSTR lpszName, lpszResName; 880 883 881 if(paResDirEntries[i].u1.s.NameIsString) 884 if(paResDirEntries[i].u1.s.NameIsString) 882 885 { 883 886 lpszName = (LPWSTR)(paResDirEntries[i].u1.s.NameOffset + (ULONG)pResRootDir + 2); 884 887 length = (int)*(LPWSTR)(paResDirEntries[i].u1.s.NameOffset + (ULONG)pResRootDir); 885 888 886 889 lpszResName = (LPWSTR)malloc((length+1) * sizeof(WCHAR)); 887 890 memcpy(lpszResName, lpszName, length * sizeof(WCHAR)); 888 891 lpszResName[length] = 0; 889 892 890 893 fRet = lpEnumFunc(hmod, lpszType, lpszResName, lParam); 891 894 free(lpszResName); 892 895 } 893 896 else { … … 907 910 //****************************************************************************** 908 911 //****************************************************************************** 909 BOOL Win32ImageBase::enumResourceLanguagesA(HMODULE hmod, LPCSTR lpszType, 910 LPCSTR lpszName, 911 ENUMRESLANGPROCA lpEnumFunc, 912 BOOL Win32ImageBase::enumResourceLanguagesA(HMODULE hmod, LPCSTR lpszType, 913 LPCSTR lpszName, 914 ENUMRESLANGPROCA lpEnumFunc, 912 915 LONG lParam) 913 916 { … … 930 933 pResDirRet = getResSubDirA(pResRootDir, lpszType); 931 934 if(!pResDirRet) { 932 933 935 SetLastError(ERROR_RESOURCE_TYPE_NOT_FOUND); 936 return FALSE; 934 937 } 935 938 pResDirRet = getResSubDirA(pResDirRet, lpszName); 936 939 if(!pResDirRet) { 937 938 940 SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND); 941 return FALSE; 939 942 } 940 943 941 944 paResDirEntries = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResDirRet + sizeof(*pResDirRet)); 942 945 if(pResDirRet->NumberOfNamedEntries) { 943 946 DebugInt3(); 944 947 } 945 948 paResDirEntries += pResDirRet->NumberOfNamedEntries; 946 949 947 for(int i = 0;i < pResDirRet->NumberOfIdEntries;i++) 948 { 949 950 951 950 for(int i = 0;i < pResDirRet->NumberOfIdEntries;i++) 951 { 952 fRet = lpEnumFunc(hmod, lpszType, lpszName, paResDirEntries[i].u1.Id, lParam); 953 if(!fRet) 954 break; 952 955 } 953 956 return fRet; … … 955 958 //****************************************************************************** 956 959 //****************************************************************************** 957 BOOL Win32ImageBase::enumResourceLanguagesW(HMODULE hmod, LPCWSTR lpszType, 958 LPCWSTR lpszName, 959 ENUMRESLANGPROCW lpEnumFunc, 960 BOOL Win32ImageBase::enumResourceLanguagesW(HMODULE hmod, LPCWSTR lpszType, 961 LPCWSTR lpszName, 962 ENUMRESLANGPROCW lpEnumFunc, 960 963 LONG lParam) 961 964 { … … 978 981 pResDirRet = getResSubDirW(pResRootDir, lpszType); 979 982 if(!pResDirRet) { 980 981 983 SetLastError(ERROR_RESOURCE_TYPE_NOT_FOUND); 984 return FALSE; 982 985 } 983 986 pResDirRet = getResSubDirW(pResDirRet, lpszName); 984 987 if(!pResDirRet) { 985 986 988 SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND); 989 return FALSE; 987 990 } 988 991 989 992 paResDirEntries = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((ULONG)pResDirRet + sizeof(*pResDirRet)); 990 993 if(pResDirRet->NumberOfNamedEntries) { 991 994 DebugInt3(); 992 995 } 993 996 paResDirEntries += pResDirRet->NumberOfNamedEntries; 994 997 995 for(int i = 0;i < pResDirRet->NumberOfIdEntries;i++) 996 { 997 998 999 998 for(int i = 0;i < pResDirRet->NumberOfIdEntries;i++) 999 { 1000 fRet = lpEnumFunc(hmod, lpszType, lpszName, paResDirEntries[i].u1.Id, lParam); 1001 if(!fRet) 1002 break; 1000 1003 } 1001 1004 return fRet;
Note:
See TracChangeset
for help on using the changeset viewer.