Пример #1
0
PString FindPluginsPath( void )
{
	CRegString regStr( "CLSID\\{C802F39D-BF85-427A-A334-77E501DB62E9}\\InprocServer32\\", "", FALSE, HKEY_CLASSES_ROOT );

	string strRead			= regStr.read();
	PString strPluginPath	= strRead;
	PINDEX nPos				= strPluginPath.FindLast( "\\" );
	strPluginPath = strPluginPath.Mid( 0, nPos + 1 ) + "js2n\\";

	return strPluginPath;
}
Пример #2
0
void RegExtDlg::writeNppPath()
{
	HKEY  hKey, hRootKey;
	DWORD dwDisp;
	long  nRet;
	generic_string regStr(nppName);
	regStr += TEXT("\\shell\\open\\command");

	nRet = ::RegCreateKeyEx(HKEY_CLASSES_ROOT, regStr.c_str(), 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisp);


	if (nRet == ERROR_SUCCESS)
	{
		//if (dwDisp == REG_CREATED_NEW_KEY)
		{
			// Write the value for new document
			::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey);
			::RegSetValueEx(hRootKey, nullptr, 0, REG_SZ, (LPBYTE)nppDoc, (lstrlen(nppDoc)+1)*sizeof(TCHAR));
			RegCloseKey(hRootKey);

			TCHAR nppPath[MAX_PATH];
			::GetModuleFileName(_hInst, nppPath, MAX_PATH);

			TCHAR nppPathParam[MAX_PATH] = TEXT("\""); 
			wcscat_s(nppPathParam, nppPath);
			wcscat_s(nppPathParam, TEXT("\" \"%1\""));

			::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
		}
		RegCloseKey(hKey);
	}

	//Set default icon value
	regStr = nppName;
	regStr += TEXT("\\DefaultIcon");
	nRet = ::RegCreateKeyEx(HKEY_CLASSES_ROOT, regStr.c_str(), 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisp);

	if (nRet == ERROR_SUCCESS)
	{
		//if (dwDisp == REG_CREATED_NEW_KEY)
		{
			TCHAR nppPath[MAX_PATH];
			::GetModuleFileName(_hInst, nppPath, MAX_PATH);

			TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
			wcscat_s(nppPathParam, nppPath);
			wcscat_s(nppPathParam, TEXT("\",0"));

			::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
		}
		RegCloseKey(hKey);
	}
}
void WirelessSettingPannel::updateWepKeyValidator()
{
    if(0 == m_wepKeyValidator){
        m_wepKeyValidator = new QRegExpValidator(this);
    }

    int lenLimit = (ui->m_wepEncryptionLenCB->currentText().contains("64") ? 10 : 26);

    QString regStr(WEP_KEY_VALIDATOR_REGEXP);
    m_wepKeyValidator->setRegExp(QRegExp(regStr.arg(lenLimit)));

    ui->m_wepkey1LE->setValidator(m_wepKeyValidator);
    ui->m_wepkey2LE->setValidator(m_wepKeyValidator);
    ui->m_wepkey3LE->setValidator(m_wepKeyValidator);
    ui->m_wepkey4LE->setValidator(m_wepKeyValidator);

    ui->m_wepkey1LE->setMaxLength(lenLimit);
    ui->m_wepkey2LE->setMaxLength(lenLimit);
    ui->m_wepkey3LE->setMaxLength(lenLimit);
    ui->m_wepkey4LE->setMaxLength(lenLimit);
}
Пример #4
0
// Print the tree for debugging
void PrintParseTree(struct tree_node* pNode, int depth)
{
	int i;
	for (i = 0; i < depth; i++)
		printf("  ");
		
	printf("NODE (%d): ", pNode->id);
	if (pNode->type == TN_INTEGER)
		printf("INTEGER (%d)\n", pNode->ival);
	else if (pNode->type == TN_QSTRING)
		printf("QSTRING\n");
	else if (pNode->type == TN_CHAR)
		printf("CHAR ('%s')\n", pNode->sval);
	else if (pNode->type == TN_BYTE_IDENT)
		printf("BYTE IDENTIFIER (\"%s\"  offset: %d)\n", pNode->sval, pNode->ival);
	else if (pNode->type == TN_WORD_IDENT)
		printf("WORD IDENTIFIER (\"%s\"  offset: %d)\n", pNode->sval, pNode->ival);
	else if (pNode->type == TN_BOOL_IDENT)
		printf("BOOLEAN IDENTIFIER (\"%s\" offset: %d)\n", pNode->sval, pNode->ival);
	else if (pNode->type == TN_PTR_IDENT)
		printf("PTR IDENTIFIER (\"%s\" offset: %d)\n", pNode->sval, pNode->ival);
	else if (pNode->type == TN_PTR_BYTE_ASSIGN)
		printf("BYTE POINTER ELEMENT ASSIGNMENT (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_PTR_WORD_ASSIGN)
		printf("WORD POINTER ELEMENT ASSIGNMENT (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_PTR_BYTE)
		printf("BYTE PTR DEREFERENCE (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_PTR_WORD)
		printf("WORD PTR DEREFERENCE (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_STRING_LITERAL)
		printf("STRING LITERAL (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_BYTE_BLOCK)
		printf("BYTE BLOCK\n");
	else if (pNode->type == TN_WORD_BLOCK)
		printf("WORD BLOCK\n");
	else if (pNode->type == TN_FUNCTION)
		printf("FUNCTION\n");
	else if (pNode->type == TN_FUNCTIONCALL)
		printf("FUNCTION CALL (\"%s\")\n", pNode->sval);
	else if (pNode->type == TN_SEGCALL)
		printf("SEGMENT() CALL\n");
	else if (pNode->type == TN_OFFCALL)
		printf("OFFSET() CALL\n");
	else if (pNode->type == TN_BYTE_ASSIGN)
		printf("BYTE ASSIGN\n");
	else if (pNode->type == TN_WORD_ASSIGN)
		printf("WORD ASSIGN\n");
	else if (pNode->type == TN_BOOL_ASSIGN)
		printf("BOOL ASSIGN\n");
	else if (pNode->type == TN_PTR_ASSIGN)
		printf("PTR ASSIGN\n");
	else if (pNode->type == TN_RET_INT)
		printf("RETURN INT\n");
	else if (pNode->type == TN_RET_BOOL)
		printf("RETURN BOOL\n");
	else if (pNode->type == TN_RET_PTR)
		printf("RETURN PTR\n");
	else if (pNode->type == TN_WHILE)
		printf("WHILE\n");
	else if (pNode->type == TN_TRUE)
		printf("TRUE\n");
	else if (pNode->type == TN_FALSE)
		printf("FALSE\n");
	else if (pNode->type == TN_NULL)
		printf("NULL\n");
	else if (pNode->type == TN_IF)
		printf("IF\n");
	else if (pNode->type == TN_ARGLIST)
		printf("ARGUMENT LIST\n");
	else if (pNode->type == TN_PARAM)
		printf("PARAM (%s %s)\n", identStr(pNode->ival), pNode->sval);
	else if (pNode->type == TN_PARAMLIST)
		printf("PARAMLIST\n");
	else if (pNode->type == TN_FDEF)
		printf("FUNCTION DEFINITION (%s)\n", pNode->sval);
	else if (pNode->type == TN_ASM)
		printf("ASM\n");
	else if (pNode->type == TN_ASMLOC)
		printf("MEMLOC\n");
	else if (pNode->type == TN_ASMREG)
		printf("REGISTER (%s)\n", regStr(pNode->ival));
	else if (pNode->type == TN_AMOV)
		printf("MOV\n");
	else if (pNode->type == TN_ACALL)
		printf("CALL\n");
	else if (pNode->type == TN_AINT)
		printf("INT\n");
	else if (pNode->type == TN_IADD)
		printf("ADD\n");
	else if (pNode->type == TN_ISUB)
		printf("SUB\n");
	else if (pNode->type == TN_UMINUS)
		printf("UNARY MINUS\n");
	else if (pNode->type == TN_IMUL)
		printf("MUL\n");
	else if (pNode->type == TN_IDIV)
		printf("DIV\n");
	else if (pNode->type == TN_IMOD)
		printf("MOD\n");
	else if (pNode->type == TN_IEQ || pNode->type == TN_BEQ || pNode->type == TN_PEQ)
		printf("EQ\n");
	else if (pNode->type == TN_INEQ || pNode->type == TN_BNEQ || pNode->type == TN_PNEQ || pNode->type == TN_UBNEQ)
		printf("NEQ\n");
	else if (pNode->type == TN_ILT)
		printf("LT\n");
	else if (pNode->type == TN_IGT)
		printf("GT\n");
	else if (pNode->type == TN_ILTE)
		printf("LTE\n");
	else if (pNode->type == TN_IGTE)
		printf("GTE\n");
	else if (pNode->type == TN_REF)
		printf("MEMORY ADDRESS\n");
	else
		printf("NO TYPE\n");

	for (i = 0; i < pNode->numOperands; i++)
		if (pNode->operands[i] != NULL)
			PrintParseTree(pNode->operands[i], depth + 1);
		else
			printf("WARNING: UNEXPECTED NULL OPERAND!\n");
			
	if (pNode->pNextStatement != NULL)
		PrintParseTree(pNode->pNextStatement, depth);
}