Beispiel #1
0
//Main entry of HEDIT application.
DWORD heditEntry(LPVOID lpParam)
{
#ifdef __CFG_SYS_DDF
	LPSTR       lpszParam     = (LPSTR)lpParam;
	HANDLE      hFile         = NULL;
	LPSTR       lpszNoTarget  = "  Please specify the target file to write.";
	LPSTR       lpszFileName  = NULL;

	if(NULL == lpszParam)
	{
		PrintLine(lpszNoTarget);
		goto __TERMINAL;
	}
	if(0 == lpszParam[0])
	{
		PrintLine(lpszNoTarget);
		goto __TERMINAL;
	}
	//Skip the space before file name in parameter string.
	lpszFileName = lpszParam;
	while(' ' == *lpszFileName)
	{
		lpszFileName ++;
	}

	hFile = CreateEditFile(lpszFileName);
	if(NULL == hFile)  //Can not create the target file.
	{
		PrintLine("  Can not create the target file.");
		PrintLine(lpszParam);  //For debugging.
		goto __TERMINAL;
	}
	//Process user input and save to file.
	GotoHome();
	ChangeLine();
	__UserInput(hFile);
	//When user terminates this application,print out version information.
	__VersionInfo();

__TERMINAL:
	if(hFile)  //Close it.
	{
		IOManager.CloseFile((__COMMON_OBJECT*)&IOManager,
			hFile);
	}
	return 0;
#else
	return 0;
#endif
}
Beispiel #2
0
//Main entry of HEDIT application.
DWORD heditEntry(LPVOID lpParam)
{
#ifdef __CFG_SYS_DDF
	__CMD_PARA_OBJ* pCmdParaObj = (__CMD_PARA_OBJ*)lpParam;
	//LPSTR       lpszParam     = (LPSTR)lpParam;
	HANDLE      hFile         = NULL;
	LPSTR       lpszNoTarget  = "  Please specify the target file to write.";
	LPSTR       lpszFileName  = NULL;

	if(NULL == pCmdParaObj || pCmdParaObj->byParameterNum < 2)
	{
		PrintLine(lpszNoTarget);
		goto __TERMINAL;
	}

	hFile = CreateEditFile(pCmdParaObj->Parameter[1]);
	if(NULL == hFile)  //Can not create the target file.
	{
		PrintLine("  Can not create the target file.");
		PrintLine(pCmdParaObj->Parameter[1]);  //For debugging.
		goto __TERMINAL;
	}
	//Process user input and save to file.
	GotoHome();
	ChangeLine();
	__UserInput(hFile);
	//When user terminates this application,print out version information.
	__VersionInfo();

__TERMINAL:
	if(hFile)  //Close it.
	{
		IOManager.CloseFile((__COMMON_OBJECT*)&IOManager,
			hFile);
	}
	return 0;
#else
	return 0;
#endif
}