kernel/eka/memmodel/emul/win32/mcodeseg.cpp
branchanywhere
changeset 24 18d195b75193
parent 0 a41df078684a
equal deleted inserted replaced
23:9c130f173b89 24:18d195b75193
   377 				{
   377 				{
   378 				TUint8	mainBuf8[MAX_PATH];
   378 				TUint8	mainBuf8[MAX_PATH];
   379 				TInt	mainlen;
   379 				TInt	mainlen;
   380 				{
   380 				{
   381 				TUint16 mainBuf[MAX_PATH];
   381 				TUint16 mainBuf[MAX_PATH];
   382 				mainlen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(pM->iModuleHandle),mainBuf);
   382 				mainlen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(pM->iModuleHandle),(LPWSTR)mainBuf);
   383 				TruncToNarrow(mainBuf8, mainBuf, mainlen);
   383 				TruncToNarrow(mainBuf8, mainBuf, mainlen);
   384 				}
   384 				}
   385 				TPtrC mainp(mainBuf8,mainlen);
   385 				TPtrC mainp(mainBuf8,mainlen);
   386 				TInt ix=mainp.LocateReverse('\\');
   386 				TInt ix=mainp.LocateReverse('\\');
   387 				if (ix>=0)
   387 				if (ix>=0)
   391 
   391 
   392 				TUint8	depBuf8[MAX_PATH];
   392 				TUint8	depBuf8[MAX_PATH];
   393 				TInt	deplen;
   393 				TInt	deplen;
   394 				{
   394 				{
   395 				TUint16 depBuf[MAX_PATH];
   395 				TUint16 depBuf[MAX_PATH];
   396 				deplen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(dep.iModuleHandle),depBuf);
   396 				deplen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(dep.iModuleHandle),(LPWSTR)depBuf);
   397 				TruncToNarrow(depBuf8, depBuf, deplen);
   397 				TruncToNarrow(depBuf8, depBuf, deplen);
   398 				}
   398 				}
   399 				TPtrC depp(depBuf8,deplen);
   399 				TPtrC depp(depBuf8,deplen);
   400 				if ((ix=depp.LocateReverse('\\'))>=0)
   400 				if ((ix=depp.LocateReverse('\\'))>=0)
   401 					depp.Set(depp.Mid(ix+1));
   401 					depp.Set(depp.Mid(ix+1));
   727 		// loading EKERN.EXE
   727 		// loading EKERN.EXE
   728 		__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : EKERN"));
   728 		__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : EKERN"));
   729 		TUint16 fileNameW[KMaxFileName];
   729 		TUint16 fileNameW[KMaxFileName];
   730 		ExpandToWide(fileNameW, iFileName->Ptr(), iFileName->Length());
   730 		ExpandToWide(fileNameW, iFileName->Ptr(), iFileName->Length());
   731 		fileNameW[iFileName->Length()] = '\0';
   731 		fileNameW[iFileName->Length()] = '\0';
   732 		iWinInstance = Emulator::LoadLibrary(fileNameW);
   732 		iWinInstance = Emulator::LoadLibrary((LPCWSTR)fileNameW);
   733 		__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : EKERN %08x", iWinInstance));
   733 		__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : EKERN %08x", iWinInstance));
   734 		if (!iWinInstance)
   734 		if (!iWinInstance)
   735 			return KErrGeneral;
   735 			return KErrGeneral;
   736 		if (aInfo.iTotalDataSize)
   736 		if (aInfo.iTotalDataSize)
   737 			iMark|=EMarkData|EMarkDataPresent;
   737 			iMark|=EMarkData|EMarkDataPresent;
   738 		KernelCodeSeg=this;
   738 		KernelCodeSeg=this;
   739 		KernelModuleHandle=Emulator::GetModuleHandle(fileNameW);
   739 		KernelModuleHandle=Emulator::GetModuleHandle((LPCWSTR)fileNameW);
   740 		return RegisterCodeSeg(KernelModuleHandle);
   740 		return RegisterCodeSeg(KernelModuleHandle);
   741 		}
   741 		}
   742 	TWin32Filename w32fn(*iFileName);
   742 	TWin32Filename w32fn(*iFileName);
   743 	__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : w32fn=%S",iFileName))
   743 	__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : w32fn=%S",iFileName))
   744 	DWin32Process* p=(DWin32Process*)aProcess;
   744 	DWin32Process* p=(DWin32Process*)aProcess;
   878 	WCHAR name[MAX_PATH+1];
   878 	WCHAR name[MAX_PATH+1];
   879 	TInt r=Emulator::GetModuleFileName(aModule, name);
   879 	TInt r=Emulator::GetModuleFileName(aModule, name);
   880 	if (!r)
   880 	if (!r)
   881 		return Emulator::LastError();
   881 		return Emulator::LastError();
   882 	TUint8 name8[MAX_PATH+1];
   882 	TUint8 name8[MAX_PATH+1];
   883 	TruncToNarrow(name8,name,-1);
   883 	TruncToNarrow(name8,(const TUint16*)name,-1);
   884 
   884 
   885 	TPtrC fpptr((const TText*)name8);
   885 	TPtrC fpptr((const TText*)name8);
   886 	TInt slash=fpptr.LocateReverse('\\');
   886 	TInt slash=fpptr.LocateReverse('\\');
   887 	TPtrC nptr=fpptr.Mid(slash+1);
   887 	TPtrC nptr=fpptr.Mid(slash+1);
   888 	iFileName=HBuf::New(nptr);
   888 	iFileName=HBuf::New(nptr);