kerneltest/f32test/plugins/version_1/virus/t_vshook.cpp
changeset 273 6a75fa55495f
parent 0 a41df078684a
equal deleted inserted replaced
271:dc268b18d709 273:6a75fa55495f
   148 	HBufC8* signatureBuf = NULL;
   148 	HBufC8* signatureBuf = NULL;
   149 	while (bytesParsed < fileSize)
   149 	while (bytesParsed < fileSize)
   150 		{
   150 		{
   151 		ptr.Set(defBuf->Des());
   151 		ptr.Set(defBuf->Des());
   152 		ptr.Set(&ptr[bytesParsed], fileSize-bytesParsed, fileSize-bytesParsed);
   152 		ptr.Set(&ptr[bytesParsed], fileSize-bytesParsed, fileSize-bytesParsed);
   153 		stringBeginPos = ptr.MatchF(_L8("startdef:*:enddef*"));
   153 		stringBeginPos = ptr.MatchF(_L8(":*;*"));
   154 
   154 
   155 		if (stringBeginPos < 0)
   155 		if (stringBeginPos < 0)
   156 			{
   156 			{
   157 			break;
   157 			break;
   158 			}
   158 			}
   159 
   159 
   160 		stringBeginPos += 9; //stardef:
   160 		stringBeginPos += 1; //:
   161 		stringBeginPos += bytesParsed;
   161 		stringBeginPos += bytesParsed;
   162 		ptr.Set(defBuf->Des());
   162 		ptr.Set(defBuf->Des());
   163 		ptr.Set(&ptr[stringBeginPos], fileSize-stringBeginPos, fileSize-stringBeginPos);
   163 		ptr.Set(&ptr[stringBeginPos], fileSize-stringBeginPos, fileSize-stringBeginPos);
   164 		stringEndPos = ptr.MatchF(_L8("*:enddef*"));
   164 		stringEndPos = ptr.MatchF(_L8("*;*"));
   165 
   165 
   166 		if (stringEndPos < 0)
   166 		if (stringEndPos < 0)
   167 			{
   167 			{
   168 			break;
   168 			break;
   169 			}
   169 			}
   170 
   170 
   171 		stringEndPos += 9; //stardef:
       
   172 		stringEndPos += bytesParsed;
   171 		stringEndPos += bytesParsed;
   173 		stringLength = stringEndPos - stringBeginPos;
   172 		stringLength = stringEndPos - stringBeginPos + 1;
   174 
   173 
   175 		ptr.Set(defBuf->Des());
   174 		ptr.Set(defBuf->Des());
   176 		TRAP(r,signatureBuf = HBufC8::NewL(stringLength));
   175 		TRAP(r,signatureBuf = HBufC8::NewL(stringLength));
   177 		
   176 		
   178 		TPtrC8 actualSig(ptr.Mid(stringBeginPos, stringLength));
   177 		TPtrC8 actualSig(ptr.Mid(stringBeginPos, stringLength));
   180 		TPtr8 ptr2(signatureBuf->Des());
   179 		TPtr8 ptr2(signatureBuf->Des());
   181 		ptr2.Append(actualSig);
   180 		ptr2.Append(actualSig);
   182 		iKnownSignatures[iSignaturesLoaded] = signatureBuf;
   181 		iKnownSignatures[iSignaturesLoaded] = signatureBuf;
   183 		iSignaturesLoaded++;
   182 		iSignaturesLoaded++;
   184 
   183 
   185 		bytesParsed += 9; //startdef:
   184 		bytesParsed += 1; //:
   186 		bytesParsed += stringLength;
   185 		bytesParsed += stringLength;
   187 		bytesParsed += 9; //:enddef\n
   186 		bytesParsed += 1; //;
   188 		}
   187 		}
   189 
   188 
   190 	//Cleanup
   189 	//Cleanup
   191 	delete defBuf;
   190 	delete defBuf;
   192 	vsDefFile.Close();
   191 	vsDefFile.Close();