⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udip2dos.c

📁 gdb是linux下的一个远程调试环境.能让你很方便地调试linux下的代码.
💻 C
📖 第 1 页 / 共 2 页
字号:
	if (err)		/* if any kind of error at all, give up on exp file */	    goto SpawnTipExe;	/* and go back to exe file */	else {		/* successful load, now jump to .exp file code, which will		   return back to here. First we will put the original TIPName		   into the top of stack so the TIP can find it (like an argument).		*/	    FP_SET(TIPStackPtr, packed_parmp->esp-256, packed_parmp->ss);	    _fmemmove(TIPStackPtr, NEARPTR_TO_FARPTR(TIPName), strlen(TIPName)+1);	    /* now call into loaded exp code (and hopefully return) */	    if (_exp_call_to(&parmp) != 0)	        return UDIErrorCantStartTIP;	    else	        goto TIPLoaded;        }/*else*/    } /* if DPMI present */  } /* block for ifdef DOS386 */#endifSpawnTipExe:    /* To get around DOS 2.x problems as well as problems with filename       expansion/searching, we pass the executable name as an addtional       parameter. Also, we expect the TIP to TSR, so the high byte of       the return value is probably 0x03. But some TIPs might be more       clever and really return (activating a device driver or other       TSR first), so we ignore the high byte of the return from spawnlp.    */    if ((n = spawnlp( P_WAIT, TIPName, TIPName, TIPName, NULL ) & 0xff) != 0)	return UDIErrorCantStartTIP;TIPLoaded:    /* Determine if any TIPs are currently running */	if (!UDIVecP)	/* None for this DFE */		UDIVecP = FindIntVect();	/* Try other DFEs (or new TIPs) */    return CheckForConnect(TIPName, i, Session, TIPParms);    } /* UDIConnect() */UDIError UDIDisconnect UDIParams((	UDISessionId	Session,		/* In */	UDIBool		Terminate		/* In */	)){	UDIError err;	if (Session >= NumSessions || !Connections[Session].VecRecP)		return UDIErrorNoSuchConnection;#ifdef DOS386	if (((err = UDICALL3(CurrentConnection,Disconnect,		Connections[ Session ].ConnId, Terminate, (DOSTerm _far *)term_addr ))		== UDINoError) &&		(CurrentConnection == Connections[ Session ].VecRecP))#else	if (((err = UDICALL3(CurrentConnection,Disconnect,		Connections[ Session ].ConnId, Terminate, &TermStruct))		== UDINoError) &&		(CurrentConnection == Connections[ Session ].VecRecP))#endif	CurrentConnection = NULL;    	return err;} /* UDIDisconnect() */UDIError UDISetCurrentConnection UDIParams((	UDISessionId	Session			/* In */	)){	UDIError n;	struct UDIConnections *ConnP;	if (Session >= NumSessions || !Connections[Session].VecRecP)		return UDIErrorNoSuchConnection;	ConnP = &Connections[Session];	n = UDICALL1(ConnP->VecRecP,SetCurrentConnection,			   ConnP->ConnId);	if (n == UDINoError)	    CurrentConnection = ConnP->VecRecP;	return n;}  /* UDIDisconnect () */UDIError UDICapabilities UDIParams((	UDIUInt32	*TIPId,			/* Out */	UDIUInt32	*TargetId,		/* Out */	UDIUInt32	DFEId,			/* In */	UDIUInt32	DFE,			/* In */	UDIUInt32	*TIP,			/* Out */	UDIUInt32	*DFEIPCId,		/* Out */	UDIUInt32	*TIPIPCId,		/* Out */	char		*TIPString		/* Out */	)){	UDIError err;	if (!CurrentConnection)		return UDIErrorNoConnection;	err = UDICALL8(CurrentConnection,Capabilities,		TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId,		TIPIPCId, TIPString);	*DFEIPCId = (((UDIUInt32)DFEIPCIdCompany) << 16) |		(DFEIPCIdProduct << 12) | DFEIPCIdVersion;	return err;}  /* UDICapabilities() */UDIError UDIEnumerateTIPs UDIParams((	UDIInt	(*UDIETCallback)	/* In */	UDIParams(( char *Configuration ))	/* In to callback() */	)){	FILE *fp;	char buf[ FBUFSIZE ];	if ((fp = fopen( GetConfigFileName(), "r" )) == NULL)		return UDIErrorCantOpenConfigFile;	while (fgets( buf, FBUFSIZE, fp ))		if (UDIETCallback( buf ) == UDITerminateEnumeration)			break;	fclose( fp );	return UDINoError;} /* UDIEnumerateTIPs() */UDIError UDIGetErrorMsg UDIParams((	UDIError	ErrorCode,		/* In */	UDISizeT	MsgSize,		/* In */	char		*Msg,			/* Out */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL4(CurrentConnection,GetErrorMsg,		ErrorCode, MsgSize, Msg, CountDone);} /* UDIGetErrorMsg() */UDIError UDIGetTargetConfig UDIParams((	UDIMemoryRange KnownMemory[],		/* Out */	UDIInt	*NumberOfRanges,	/* In/Out */	UDIUInt32	ChipVersions[],		/* Out */	UDIInt	*NumberOfChips		/* In/Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL4(CurrentConnection,GetTargetConfig,		KnownMemory, NumberOfRanges, ChipVersions, NumberOfChips);} /* UDIGetTargetConfig() */UDIError UDICreateProcess UDIParams((	UDIPId	*PId			/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL1(CurrentConnection,CreateProcess,			PId);} /* UDICreateProcess() */UDIError UDISetCurrentProcess UDIParams((	UDIPId	PId			/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return	UDICALL1(CurrentConnection,SetCurrentProcess,			 PId);} /* UDISetCurrentProcess() */UDIError UDIDestroyProcess UDIParams((	UDIPId	PId			/* In */	)){		if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL1(CurrentConnection,DestroyProcess,			PId);	} /* UDIDestroyProcess() */UDIError UDIInitializeProcess UDIParams((	UDIMemoryRange	ProcessMemory[],	/* In */	UDIInt		NumberOfRanges,		/* In */	UDIResource	EntryPoint,		/* In */	CPUSizeT	StackSizes[],		/* In */	UDIInt		NumberOfStacks,		/* In */	char		*ArgString		/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL6(CurrentConnection,InitializeProcess,		ProcessMemory, NumberOfRanges, EntryPoint, StackSizes,		NumberOfStacks, ArgString );} /* UDIInitializeProcess() */UDIError UDIRead UDIParams((	UDIResource	From,			/* In */	UDIHostMemPtr	To,			/* Out */	UDICount	Count,			/* In */	UDISizeT	Size,			/* In */	UDICount	*CountDone,		/* Out */	UDIBool		HostEndian		/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL6(CurrentConnection,Read, 		From, To, Count, Size, CountDone, HostEndian);} /* UDIRead() */UDIError UDIWrite UDIParams((	UDIHostMemPtr	From,			/* In */	UDIResource	To,			/* In */	UDICount	Count,			/* In */	UDISizeT	Size,			/* In */	UDICount	*CountDone,		/* Out */	UDIBool		HostEndian		/* In */  )){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL6(CurrentConnection,Write,		From, To, Count, Size, CountDone, HostEndian);} /* UDIWrite() */UDIError UDICopy UDIParams((	UDIResource	From,			/* In */	UDIResource	To,			/* In */	UDICount	Count,			/* In */	UDISizeT	Size,			/* In */	UDICount	*CountDone,		/* Out */	UDIBool		Direction		/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL6(CurrentConnection,Copy,		From, To, Count, Size, CountDone, Direction);} /* UDICopy() */UDIError UDIExecute UDIParams((	void	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL0(CurrentConnection,Execute);} /* UDIExecute() */UDIError UDIStep UDIParams((	UDIUInt32	Steps,			/* In */	UDIStepType   StepType,		/* In */	UDIRange      Range			/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,Step,			Steps,StepType,Range);} /* UDIStep() */UDIVoid UDIStop UDIParams((	void	)){	if (!CurrentConnection)		return;	UDICALL0(CurrentConnection,Stop);} /* UDIStop() */UDIError UDIWait UDIParams((	UDIInt32	MaxTime,		/* In */	UDIPId		*PId,			/* Out */	UDIUInt32	*StopReason		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,Wait,		MaxTime, PId, StopReason);} /* UDIWait() */UDIError UDISetBreakpoint UDIParams((	UDIResource	Addr,			/* In */	UDIInt32	PassCount,		/* In */	UDIBreakType	Type,			/* In */	UDIBreakId	*BreakId		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL4(CurrentConnection,SetBreakpoint,		Addr, PassCount, Type, BreakId);} /* UDISetBreakpoint() */UDIError UDIQueryBreakpoint UDIParams((	UDIBreakId	BreakId,		/* In */	UDIResource	*Addr,			/* Out */	UDIInt32	*PassCount,		/* Out */	UDIBreakType	*Type,			/* Out */	UDIInt32	*CurrentCount		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL5(CurrentConnection,QueryBreakpoint,		BreakId, Addr, PassCount, Type, CurrentCount);} /* UDIQueryBreakpoint() */UDIError UDIClearBreakpoint UDIParams((	UDIBreakId	BreakId			/* In */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL1(CurrentConnection,ClearBreakpoint,		BreakId);} /* UDIClearBreakpoint() */UDIError UDIGetStdout UDIParams((	UDIHostMemPtr	Buf,			/* Out */	UDISizeT	BufSize,		/* In */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,GetStdout,		Buf, BufSize, CountDone);} /* UDIGetStout() */UDIError UDIGetStderr UDIParams((	UDIHostMemPtr	Buf,			/* Out */	UDISizeT	BufSize,		/* In */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,GetStderr,		Buf, BufSize, CountDone);} /* UDIGetStderr() */UDIError UDIPutStdin UDIParams((	UDIHostMemPtr	Buf,			/* In */	UDISizeT	Count,			/* In */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,PutStdin,		Buf, Count, CountDone);} /* UDIPutStdin() */UDIError UDIStdinMode UDIParams((	UDIMode		*Mode			/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL1(CurrentConnection,StdinMode,		Mode);} /* UDIStdinMode() */UDIError UDIPutTrans UDIParams((	UDIHostMemPtr	Buf,			/* In */	UDISizeT	Count,			/* In */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,PutTrans,		Buf, Count, CountDone);} /* UDIPutTrans() */UDIError UDIGetTrans UDIParams((	UDIHostMemPtr	Buf,			/* Out */	UDISizeT	BufSize,		/* In */	UDISizeT	*CountDone		/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL3(CurrentConnection,GetTrans,		Buf, BufSize, CountDone);} /* UDIGetTrans() */UDIError UDITransMode UDIParams((	UDIMode		*Mode			/* Out */	)){	if (!CurrentConnection)		return UDIErrorNoConnection;	return UDICALL1(CurrentConnection,TransMode,			Mode);} /* UDITransMode() */UDIUInt32 UDIGetDFEIPCId(){    return((((UDIUInt32)DFEIPCIdCompany) << 16) |(DFEIPCIdProduct << 12) | DFEIPCIdVersion);} /* UDIGetDFEIPCId() */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -