示例#1
0
文件: SSD.cpp 项目: zphseu/cuiyan
BOOL CSSD::SaveToReg(CString RegPath)
{
	CRegistry Reg;
	
	if (RegPath.IsEmpty())
		RegPath = GetRegPath();

	if (m_ssd.m_szName.IsEmpty() || m_ssd.m_szEmail.IsEmpty() 
		|| m_ssd.m_szSerial.IsEmpty())
		return FALSE;

	if (!Reg.VerifyKey(HKEY_LOCAL_MACHINE, RegPath) &&
		!Reg.CreateKey(HKEY_LOCAL_MACHINE, RegPath) )
			return FALSE;
	
	if (!Reg.Open(HKEY_LOCAL_MACHINE, RegPath))
		return FALSE;

	if (!Reg.WriteString(_T("Name"), m_ssd.m_szName) ||
		!Reg.WriteString(_T("Email"), m_ssd.m_szEmail) ||
		!Reg.WriteString(_T("SSD"), m_ssd.m_szSerial) )
		return FALSE;
	
	Reg.Close();

	return TRUE;
}
示例#2
0
文件: Ftpapp.c 项目: LucidOne/Rovio
int Config_SetFtp(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_ADMIN;
		break;
	case CA_CONFIG:
		cyg_mutex_lock(&g_ptmConfigParam);
		if (httpIsExistParam(pParamList, "FtpServer"))
			httpMyStrncpy(g_ConfigParam.acFtpServer, httpGetString(pParamList, "FtpServer"), sizeof(g_ConfigParam.acFtpServer));
		if (httpIsExistParam(pParamList, "User"))
			httpMyStrncpy(g_ConfigParam.acFtpUser, httpGetString(pParamList, "User"), sizeof(g_ConfigParam.acFtpUser));
		if (httpIsExistParam(pParamList, "Pass"))
			httpMyStrncpy(g_ConfigParam.acFtpPass, httpGetString(pParamList, "Pass"), sizeof(g_ConfigParam.acFtpPass));
		if (httpIsExistParam(pParamList, "Account"))
			httpMyStrncpy(g_ConfigParam.acFtpAccount, httpGetString(pParamList, "Account"), sizeof(g_ConfigParam.acFtpAccount));
		if (httpIsExistParam(pParamList, "UploadPath"))
		{
			char *pcPath;
			pcPath = GetRegPath(httpGetString(pParamList, "UploadPath"));
			if (pcPath == NULL) g_ConfigParam.acFtpUploadPath[0] = '\0';
			else
			{
				httpMyStrncpy(g_ConfigParam.acFtpUploadPath, pcPath, sizeof(g_ConfigParam.acFtpUploadPath));
				free(pcPath);
			}
		}
		if (httpIsExistParam(pParamList, "Enable"))
			g_ConfigParam.bFtpEnable = httpGetBool(pParamList, "Enable");
		else g_ConfigParam.bFtpEnable = FALSE;
		g_WebCamState.ucFtp = (g_ConfigParam.bFtpEnable?'\1':'\0');
		cyg_mutex_unlock(&g_ptmConfigParam);

		WebCameraLog(CL_PRIVILEGE_ADMIN, CL_SET_FTP, g_ConfigParam.acFtpServer, hConnection);

		WriteFlashMemory(&g_ConfigParam);

		return 0;
		break;
	}
	return -1;
}
示例#3
0
文件: SSD.cpp 项目: zphseu/cuiyan
BOOL CSSD::LoadFromReg(CString RegPath)
{
	CRegistry Reg;
	
	if (RegPath.IsEmpty())
		RegPath = GetRegPath();

	if (!Reg.Open(HKEY_LOCAL_MACHINE, RegPath))
		return FALSE;
	
	if (!Reg.ReadString(_T("Name"), m_ssd.m_szName) ||
		!Reg.ReadString(_T("Email"), m_ssd.m_szEmail) ||
		!Reg.ReadString(_T("SSD"), m_ssd.m_szSerial) )
		return FALSE;

	Reg.Close();
	
	return TRUE;
}