Пример #1
0
// Old script.cpp SignatureHash function
uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType)
{
    static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
    if (nIn >= txTo.vin.size())
    {
        return one;
    }
    CMutableTransaction txTmp(txTo);

    // In case concatenating two scripts ends up with two codeseparators,
    // or an extra one at the end, this prevents all those possible incompatibilities.
    FindAndDelete(scriptCode, CScript(OP_CODESEPARATOR));

    // Blank out other inputs' signatures
    for (unsigned int i = 0; i < txTmp.vin.size(); i++)
        txTmp.vin[i].scriptSig = CScript();
    txTmp.vin[nIn].scriptSig = scriptCode;

    // Blank out some of the outputs
    if ((nHashType & 0x1f) == SIGHASH_NONE)
    {
        // Wildcard payee
        txTmp.vout.clear();

        // Let the others update at will
        for (unsigned int i = 0; i < txTmp.vin.size(); i++)
            if (i != nIn)
                txTmp.vin[i].nSequence = 0;
    }
    else if ((nHashType & 0x1f) == SIGHASH_SINGLE)
    {
        // Only lock-in the txout payee at same index as txin
        unsigned int nOut = nIn;
        if (nOut >= txTmp.vout.size())
        {
            return one;
        }
        txTmp.vout.resize(nOut+1);
        for (unsigned int i = 0; i < nOut; i++)
            txTmp.vout[i].SetNull();

        // Let the others update at will
        for (unsigned int i = 0; i < txTmp.vin.size(); i++)
            if (i != nIn)
                txTmp.vin[i].nSequence = 0;
    }

    // Blank out other inputs completely, not recommended for open transactions
    if (nHashType & SIGHASH_ANYONECANPAY)
    {
        txTmp.vin[0] = txTmp.vin[nIn];
        txTmp.vin.resize(1);
    }

    // Serialize and hash
    CHashWriter ss(SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
    ss << txTmp << nHashType;
    return ss.GetHash();
}
Пример #2
0
CKerName::~CKerName()
{
	DeleteAllEdges();
	FindAndDelete(&KerNamesMain->Names,this);
	RemoveFromHashTable();
	KerNamesMain->MatrixesCalculated=0;
	SAFE_DELETE_ARRAY(name);
	if(Type==eKerNTsound)
		SAFE_RELEASE(Sound);
}
Пример #3
0
// Odstrani vsechny hrany
void CKerName::DeleteAllEdges() {
	CKerNameList *p,*p3;
	CKerName *n;
	p = childs;  // zrusim odkazy mezi sebou u detmi (predpokladam jeden nebo zadny odkaz(nehlasim chybu))
	childs=0;
	while(p) {
		n=p->name;
		p3=p;
		p=p->next;
		delete p3;
		FindAndDelete(&n->parents,this);
	}
	p = parents;  // zrusim odkazy mezi sebou a predky
	parents=0;
	while(p) {
		n=p->name;
		p3=p;
		p=p->next;
		delete p3;
		FindAndDelete(&n->childs,this);
	}
	KerNamesMain->MatrixesCalculated=0;
}
Пример #4
0
int _cdecl main(
    int     argc,
    char    *argv[]
) {
    HKEY    WowKey;
    long    l;
    DWORD   dwRegValueType;
    CHAR    sz[2048];
    ULONG   ulSize;

    l = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
                      "SYSTEM\\CurrentControlSet\\Control\\WOW",
                      0,
                      KEY_QUERY_VALUE | KEY_SET_VALUE,
                      &WowKey );

    if ( l != 0 ) {
        printf("Failed to open HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\WOW\n");
        printf("Do you have administrator privleges?\n");
        exit(1);
    }

    ulSize = sizeof(sz);

    l = RegQueryValueEx( WowKey,
                         "KnownDLLs",
                         NULL,
                         &dwRegValueType,
                         sz,
                         &ulSize );

    if ( l != ERROR_SUCCESS )
    {
        printf("Failed reading [WOWKEY]\\KnownDLLs\n");
        printf("Do you have administrator privleges?\n");
        exit(1);
    }

    if ( dwRegValueType != REG_SZ ) {
        printf("Internal error, [WOWKEY]\\KnownDLLs is not a REG_SZ (string)\n");
        exit(1);
    }

    printf("\nKey was: \"%s\"\n\n", sz );

    switch (argc)
    {
    case 1:
	FindOrAdd( sz, "compobj.dll" );
	FindOrAdd( sz, "storage.dll" );
	FindOrAdd( sz, "ole2.dll" );
	FindOrAdd( sz, "ole2disp.dll" );
	FindOrAdd( sz, "typelib.dll" );
	FindOrAdd( sz, "ole2nls.dll" );
	break;
    case 2:
	if( (strcmp(argv[1],"-r") == 0) ||
            (strcmp(argv[1],"/r") == 0))
	{
	    FindAndDelete( sz, "compobj.dll" );
	    FindAndDelete( sz, "storage.dll" );
	    FindAndDelete( sz, "ole2.dll" );
	    FindAndDelete( sz, "ole2disp.dll" );
	    FindAndDelete( sz, "typelib.dll" );
	    FindAndDelete( sz, "ole2nls.dll" );
	}
	else
	{
	    printf("Unknown parameters\n");
	    exit(1);
	}

	break;
    default:
	printf("Too many parameters\n");
	exit(1);

    }


    printf("Key is now: \"%s\"\n\n", sz );

    ulSize = strlen( sz );

    l = RegSetValueEx( WowKey,
                         "KnownDLLs",
                         0,
                         dwRegValueType,
                         sz,
                         ulSize+1 );

    if ( l != ERROR_SUCCESS ) {
        printf("Error setting value (l=%ld,0x%08lX)\n",l,l);
        printf("Do you have administrator privleges?\n");
        exit(1);
    }


    l = RegCloseKey( WowKey );

    return(0);
}