- Timestamp:
- Oct 27, 1999, 12:35:42 PM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/cvtcursor.cpp
r1427 r1475 1 /* $Id: cvtcursor.cpp,v 1. 7 1999-10-24 09:43:02sandervl Exp $ */1 /* $Id: cvtcursor.cpp,v 1.8 1999-10-27 10:35:41 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 ULONG QueryConvertedCursorSize(CursorComponent *curHdr, int size) 33 33 { 34 WINBITMAPINFOHEADER *bhdr = (WINBITMAPINFOHEADER *)(curHdr+1); 35 int bmpsize, cursorsize; 36 37 bmpsize = size - sizeof(CursorComponent) - (1<<bhdr->biBitCount)*sizeof(RGBQUAD); 38 cursorsize = sizeof(BITMAPFILEHEADER2) + bmpsize + (1<<bhdr->biBitCount)*sizeof(RGB2); 34 WINBITMAPINFOHEADER *bmpHdr = (WINBITMAPINFOHEADER *)(curHdr+1); 35 int bwsize, colorsize, rgbsize, cursorsize; 36 37 bwsize = (bmpHdr->biWidth*(bmpHdr->biHeight/2))/8; 38 colorsize = bmpHdr->biWidth*(bmpHdr->biHeight/2); 39 40 if(bmpHdr->biBitCount <= 8) 41 rgbsize = (1<<bmpHdr->biBitCount)*sizeof(RGB2); 42 else rgbsize = 0; 43 44 switch(bmpHdr->biBitCount) { 45 case 1: 46 colorsize /= 8; 47 break; 48 case 4: 49 colorsize /= 2; 50 break; 51 case 8: 52 break; 53 case 16: 54 colorsize *= 2; 55 break; 56 case 24: 57 colorsize *= 3; 58 break; 59 case 32: 60 colorsize *= 4; 61 break; 62 } 63 if(bmpHdr->biSizeImage == 0 && bmpHdr->biCompression == 0) { 64 bmpHdr->biSizeImage = bwsize + colorsize; 65 } 66 67 //SvL: 28-09-'98: cllngenu.dll has an incorrect size in the header 68 if(bmpHdr->biSizeImage < colorsize) { 69 bmpHdr->biSizeImage = colorsize; 70 } 71 if(bmpHdr->biBitCount > 1) { 72 //And mask, xor mask (0) + color image 73 cursorsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 74 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 75 } 76 else { 77 //And + xor mask 78 cursorsize = sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 2*bwsize; 79 } 39 80 40 81 return cursorsize; … … 48 89 RGBQUAD *rgb; 49 90 RGB2 *os2rgb; 50 WINBITMAPINFOHEADER *b hdr = (WINBITMAPINFOHEADER *)(curHdr+1);51 BITMAPFILEHEADER2 *cursorhdr ;52 int i, bwsize, bmpsize, cursorsize ;91 WINBITMAPINFOHEADER *bmpHdr = (WINBITMAPINFOHEADER *)(curHdr+1); 92 BITMAPFILEHEADER2 *cursorhdr, *cursorhdr2; 93 int i, bwsize, bmpsize, cursorsize, rgbsize, colorsize; 53 94 54 95 dprintf(("ConvertCursor: Cursor size %d", size)); 55 bmpsize = size - sizeof(CursorComponent) - (1<<bhdr->biBitCount)*sizeof(RGBQUAD); 56 cursorsize = sizeof(BITMAPFILEHEADER2) + bmpsize + (1<<bhdr->biBitCount)*sizeof(RGB2); 96 bwsize = (bmpHdr->biWidth*(bmpHdr->biHeight/2))/8; 97 colorsize = bmpHdr->biWidth*(bmpHdr->biHeight/2); 98 99 if(bmpHdr->biBitCount <= 8) 100 rgbsize = (1<<bmpHdr->biBitCount)*sizeof(RGB2); 101 else rgbsize = 0; 102 103 switch(bmpHdr->biBitCount) { 104 case 1: 105 colorsize /= 8; 106 break; 107 case 4: 108 colorsize /= 2; 109 break; 110 case 8: 111 break; 112 case 16: 113 colorsize *= 2; 114 break; 115 case 24: 116 colorsize *= 3; 117 break; 118 case 32: 119 colorsize *= 4; 120 break; 121 } 122 if(bmpHdr->biSizeImage == 0 && bmpHdr->biCompression == 0) { 123 bmpHdr->biSizeImage = bwsize + colorsize; 124 } 125 126 //SvL: 28-09-'98: cllngenu.dll has an incorrect size in the header 127 if(bmpHdr->biSizeImage < colorsize) { 128 bmpHdr->biSizeImage = colorsize; 129 } 130 if(bmpHdr->biBitCount == 1) { 131 //And + xor mask 132 cursorsize = sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 2*bwsize; 133 } 134 else { 135 //And mask, xor mask (0) + color image 136 cursorsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 137 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 138 } 57 139 58 140 cursorhdr = (BITMAPFILEHEADER2 *)malloc(cursorsize); … … 63 145 64 146 /* @@@PH y-hotspot is upside down ! */ 65 cursorhdr->yHotspot = (b hdr->biHeight >> 1) /* height div 2 */147 cursorhdr->yHotspot = (bmpHdr->biHeight >> 1) /* height div 2 */ 66 148 - curHdr->yHotspot; /* subtract hot.y */ 67 149 … … 69 151 dprintf(("Cursor Hot.y : %d", curHdr->yHotspot)); 70 152 71 cursorhdr->offBits = sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + offsetBits; 153 if(bmpHdr->biBitCount == 1) { 154 cursorhdr->offBits = sizeof(BITMAPFILEHEADER2) + 155 2*sizeof(RGB2) + offsetBits; 156 } 157 else { 158 cursorhdr->offBits = 2*sizeof(BITMAPFILEHEADER2) + 159 2*sizeof(RGB2) + rgbsize + offsetBits; 160 } 161 72 162 cursorhdr->bmp2.cbFix = sizeof(BITMAPINFOHEADER2); 73 cursorhdr->bmp2.cx = (USHORT)b hdr->biWidth;74 cursorhdr->bmp2.cy = (USHORT)(b hdr->biHeight);75 cursorhdr->bmp2.cPlanes = b hdr->biPlanes;76 cursorhdr->bmp2.cBitCount = bhdr->biBitCount;163 cursorhdr->bmp2.cx = (USHORT)bmpHdr->biWidth; 164 cursorhdr->bmp2.cy = (USHORT)(bmpHdr->biHeight); 165 cursorhdr->bmp2.cPlanes = bmpHdr->biPlanes; 166 cursorhdr->bmp2.cBitCount = 1; 77 167 cursorhdr->bmp2.ulCompression = BCA_UNCOMP; 78 168 cursorhdr->bmp2.ulColorEncoding = BCE_RGB; 79 dprintf(("Cursor size : %d", b hdr->biSizeImage));80 dprintf(("Cursor Width : %d", b hdr->biWidth));169 dprintf(("Cursor size : %d", bmpHdr->biSizeImage)); 170 dprintf(("Cursor Width : %d", bmpHdr->biWidth)); 81 171 //height for both the XOR and AND bitmap (color & BW) 82 dprintf(("Height : %d", b hdr->biHeight));83 dprintf(("Cursor Bitcount: %d", b hdr->biBitCount));84 dprintf(("Cursor Compress: %d", b hdr->biCompression));172 dprintf(("Height : %d", bmpHdr->biHeight)); 173 dprintf(("Cursor Bitcount: %d", bmpHdr->biBitCount)); 174 dprintf(("Cursor Compress: %d", bmpHdr->biCompression)); 85 175 86 176 os2rgb = (RGB2 *)(cursorhdr+1); 87 rgb = (RGBQUAD *)(bhdr+1); 88 for(i=0;i<(1<<bhdr->biBitCount);i++) { 89 os2rgb->bRed = rgb->red; 90 os2rgb->bBlue = rgb->blue; 91 os2rgb->bGreen = rgb->green; 92 os2rgb++; 93 rgb++; 94 } 95 96 bhdr->biSizeImage *= 2; // we have 2 bitmaps ! 97 98 if(bhdr->biSizeImage > bmpsize || bhdr->biSizeImage == 0) { 99 bwsize = bhdr->biWidth*(bhdr->biHeight); 100 101 switch(bhdr->biBitCount) { 102 case 1: 103 bwsize /= 8; 104 break; 105 case 4: 106 bwsize /= 2; 107 break; 108 case 8: 109 break; 110 case 16: 111 bwsize *= 2; 112 break; 113 case 24: 114 bwsize *= 3; 115 break; 116 case 32: 117 bwsize *= 4; 118 break; 119 } 120 } 121 else bwsize = bhdr->biSizeImage; 122 123 //write XOR and AND mask 124 memcpy((char *)os2rgb, (char *)rgb, bwsize); 177 rgb = (RGBQUAD *)(bmpHdr+1); 178 if(bmpHdr->biBitCount == 1) { 179 for(i=0;i<2;i++) { 180 os2rgb->bRed = rgb->red; 181 os2rgb->bBlue = rgb->blue; 182 os2rgb->bGreen = rgb->green; 183 os2rgb++; 184 rgb++; 185 } 186 //write XOR and AND mask 187 memcpy((char *)os2rgb, (char *)rgb, bwsize*2); 188 } 189 else { 190 memset(os2rgb, 0, sizeof(RGB2)); 191 memset(os2rgb+1, 0xff, sizeof(RGB)); //not reserved byte! 192 cursorhdr2 = (BITMAPFILEHEADER2 *)(os2rgb+2); 193 cursorhdr2->usType = BFT_COLORICON; 194 cursorhdr2->cbSize = sizeof(BITMAPFILEHEADER2); 195 cursorhdr2->xHotspot = curHdr->xHotspot; 196 cursorhdr2->yHotspot = (bmpHdr->biHeight >> 1) /* height div 2 */ 197 - curHdr->yHotspot; /* subtract hot.y */ 198 cursorhdr2->offBits = 2*sizeof(BITMAPFILEHEADER2) + 199 2*sizeof(RGB2) + rgbsize + 2*bwsize + offsetBits; 200 cursorhdr2->bmp2.cbFix = sizeof(BITMAPINFOHEADER2); 201 cursorhdr2->bmp2.cx = (USHORT)bmpHdr->biWidth; 202 cursorhdr2->bmp2.cy = (USHORT)(bmpHdr->biHeight/2); 203 cursorhdr2->bmp2.cPlanes = bmpHdr->biPlanes; 204 cursorhdr2->bmp2.cBitCount= bmpHdr->biBitCount; 205 cursorhdr2->bmp2.ulCompression = BCA_UNCOMP; 206 cursorhdr2->bmp2.ulColorEncoding = BCE_RGB; 207 os2rgb = (RGB2 *)(cursorhdr2+1); 208 rgb = (RGBQUAD *)(bmpHdr+1); 209 if(bmpHdr->biBitCount <= 8) { 210 for(i=0;i<(1<<bmpHdr->biBitCount);i++) { 211 os2rgb->bRed = rgb->red; 212 os2rgb->bBlue = rgb->blue; 213 os2rgb->bGreen = rgb->green; 214 os2rgb++; 215 rgb++; 216 } 217 } 218 //write XOR and AND mask 219 char *pXor = (char *)os2rgb; 220 char *pAnd = (char *)os2rgb + bwsize; 221 222 memcpy (pAnd, (char *)rgb + colorsize, bwsize); 223 memset (pXor, 0, bwsize); 224 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize); 225 } 125 226 126 227 *os2size = cursorsize; -
trunk/src/kernel32/cvticon.cpp
r1407 r1475 1 /* $Id: cvticon.cpp,v 1. 5 1999-10-23 10:21:00sandervl Exp $ */1 /* $Id: cvticon.cpp,v 1.6 1999-10-27 10:35:41 sandervl Exp $ */ 2 2 3 3 /* … … 167 167 os2rgb = (RGB2 *)(iconhdr2+1); 168 168 rgb = (RGBQUAD *)(bmpHdr+1); 169 if(bmpHdr->biBitCount < 24) {169 if(bmpHdr->biBitCount <= 8) { 170 170 for(i=0;i<(1<<bmpHdr->biBitCount);i++) { 171 171 os2rgb->bRed = rgb->red; … … 177 177 } 178 178 179 #if 0180 //write 2*mono pixels + color pixels181 //There are icons without an AND mask, so check for it182 if(bmpHdr->biSizeImage == colorsize)183 {184 memset((char *)os2rgb, 0, bwsize);185 memset((char *)os2rgb+bwsize, 0, bwsize);186 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize);187 }188 else {189 memset((char *)os2rgb, 0, bwsize); // windows has no xor mask190 memcpy((char *)os2rgb+bwsize, (char *)rgb+colorsize, bwsize); // and-mask191 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize); // color(xor-mask)192 193 // memcpy((char *)os2rgb, (char *)rgb+colorsize, bwsize);194 // memcpy((char *)os2rgb+bwsize, (char *)rgb+colorsize, bwsize);195 // memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize);196 }197 #else198 179 pXor = (char *)os2rgb; 199 180 pAnd = (char *)os2rgb + bwsize; … … 219 200 } 220 201 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize); 221 #endif222 202 223 203 *os2size = iconsize; -
trunk/src/kernel32/winimagebase.cpp
r978 r1475 1 /* $Id: winimagebase.cpp,v 1. 2 1999-09-18 17:47:10sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.3 1999-10-27 10:35:42 sandervl Exp $ */ 2 2 3 3 /* … … 117 117 dllfile = OSLibDosOpen(filename, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 118 118 if(dllfile == NULL) {//search in libpath for dll 119 syspath = getenv("WIN32LIBPATH"); 120 if(syspath) { 121 strcpy(modname, syspath); 122 if(modname[strlen(modname)-1] != '\\') { 123 strcat(modname, "\\"); 124 } 125 strcat(modname, filename); 126 strcpy(filename, modname); 127 } 119 strcpy(modname, kernel32Path); 120 strcat(modname, filename); 121 strcpy(filename, modname); 128 122 } 129 123 else OSLibDosClose(dllfile); -
trunk/src/kernel32/winimagepeldr.cpp
r1410 r1475 1 /* $Id: winimagepeldr.cpp,v 1. 8 1999-10-23 12:34:48sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.9 1999-10-27 10:35:42 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 #include "initterm.h" 45 45 #include <win\virtual.h> 46 #include "oslibdos.h" 46 47 47 48 char szErrorTitle[] = "Odin"; … … 67 68 //****************************************************************************** 68 69 //****************************************************************************** 69 Win32PeLdrImage::Win32PeLdrImage(char * szFileName, int loadtype) :70 Win32PeLdrImage::Win32PeLdrImage(char *pszFileName, int loadtype) : 70 71 Win32ImageBase(-1), 71 72 nrsections(0), imageSize(0), … … 74 75 pResSection(NULL), fImgMapping(0) 75 76 { 77 HFILE dllfile; 78 76 79 loadType = loadtype; 77 80 78 strcpy(this->szFileName, szFileName); 81 strcpy(szFileName, pszFileName); 82 strupr(szFileName); 83 if(!strchr(szFileName, (int)'.')) { 84 strcat(szFileName,".DLL"); 85 } 86 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 87 if(dllfile == NULL) {//search in libpath for dll 88 strcpy(szModule, kernel32Path); 89 strcat(szModule, szFileName); 90 strcpy(szFileName, szModule); 91 } 92 else OSLibDosClose(dllfile); 79 93 80 94 strcpy(szModule, OSLibStripPath(szFileName)); -
trunk/src/kernel32/wprocess.cpp
r1458 r1475 1 /* $Id: wprocess.cpp,v 1.4 1 1999-10-26 17:54:16sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.42 1999-10-27 10:35:42 sandervl Exp $ */ 2 2 3 3 /* … … 323 323 strcpy(modname, lpszLibFile); 324 324 strupr(modname); 325 if(!strstr(modname, ". DLL")) {325 if(!strstr(modname, ".")) { 326 326 strcat(modname,".DLL"); 327 327 }
Note:
See TracChangeset
for help on using the changeset viewer.