INT EncKeyInfo( const CHAR * PrivateKey ) { CHAR * Pass = NULL; PCRYPT_CONTEXT Context = NULL; INT Ret = -1; if((Pass = AskPass(CHECK_PASS, "Enter the password for the key:", NULL)) == NULL) goto err; if((Context = ReadKeyFile(PrivateKey, Pass)) == NULL) { goto err; } DumpKey(&Context->key); PrintMessage("%s\n", "EncKeyInfo: success!"); Ret = 0; err: if(NULL != Pass) { free(Pass); Pass = NULL; } if(NULL != Context) { free(Context); Context = NULL; } return Ret; }
cli::Error_e cmdValKey( CLIARGS args, cli::Param_t prm) { typedef ValKeyA ValKey; { ValKey r( "jhcValKeyRoot", "k1", true ); r.SetVal( "String1", "Helloo" ); r.SetVal( "Dword1" , 1111 ); { ValKey r2( r, "k2", true ); r2.SetVal( "String2", "Helloo22" ); r2.SetVal( "Dword2" , 2222 ); r2.SetVal( "Dword3" , 3333 ); { ValKey r3( r2, "k3", true ); r3.SetVal( "Dword4" , 4444 ); DumpKey( r3 ); } ValKey r4( r, "k4" ); r4.SetVal( "Dword5", 5555 ); DumpKey( r2 ); DumpKey( r4 ); } r.SetVal( "Dword6" , 6666 ); DumpKey( r ); } // char sz[100]; memset( sz, 0, sizeof sz ); // r.GetVal( "String1" , sz, 100 ); printf( "String1: %s\n", sz ); // r.GetVal( "k2\\String2", sz, 100 ); printf( "String2: %s\n", sz ); // // DWORD dw = 0; // r.GetVal( "k3\\Dword1" , dw ); printf( "Dword1: %u\n", dw ); // r.GetVal( "k4\\Dword2" , dw ); printf( "Dword2: %u\n", dw ); // r.GetVal( "k4\\k5\\Dword3", dw ); printf( "Dword3: %u\n", dw ); printf("\n"); printf("\n"); ValStore<char> VS; VS.Deserialize( "jhcValKeyRoot" ); VS.Dump( ConOut ); return cli::ERR_GENERAL; }
cli::Error_e cmdKTree( CLIARGS args, cli::Param_t prm) { KeyTree<char> KT; KT.AddKey( "root\\middle\\leaf" ); KT.AddValue( "root", "rval" ); KT.AddValue( "root\\middle", "mval" ); KT.AddValue( "root\\middle\\leaf", "lval" ); KT.AddValue( "root\\middle\\leaf", "lval2" ); DumpKey( KT, "root" ); DumpKey( KT, "root\\middle" ); DumpKey( KT, "root\\middle\\leaf" ); return cli::ERR_NOERROR; }
cli::Error_e cmdPanReg( CLIARGS args, cli::Param_t prm) { ValStore<char> VS; VS.SetVal( "root\\mid1\\mid2\\mid3\\leaf" , 12345678u ); VS.SetVal( "root\\mid1\\mid2\\mid3\\leaf1", 22345678u ); VS.SetVal( "root\\mid1\\mid2\\mid3\\leaf2", 32345678u ); VS.SetVal( "root\\mid1\\mid2\\mid3a\\leaf" , 12345678u ); VS.SetVal( "root\\mid1\\mid2\\mid3a\\leaf1", 22345678u ); VS.SetVal( "root\\mid1\\mid2\\mid3a\\leaf2", 32345678u ); VS.SetVal( "root\\mid1\\mid2a\\leaf" , 12345678u ); VS.SetVal( "root\\mid1\\mid2a\\leaf1", 22345678u ); VS.SetVal( "root\\mid1\\mid2a\\leaf2", 32345678u ); VS.SetVal( "root\\mid1\\leaf" , 12345678u ); VS.SetVal( "root\\mid1\\leaf1", 22345678u ); VS.SetVal( "root\\mid1\\leaf2", 32345678u ); VS.SetVal( "root\\leaf" , 12345678u ); VS.SetVal( "root\\leaf1", 22345678u ); VS.SetVal( "root\\leaf2", 32345678u ); VS.Serialize ( "valStoreReg" ); VS.Deserialize( "valStoreReg" ); KeyTree<char> KT; VS.BuildKeyTree( KT ); DumpKey( KT, "root" ); DumpKey( KT, "root\\mid1" ); DumpKey( KT, "root\\mid1\\mid2a" ); DumpKey( KT, "root\\mid1\\mid2" ); DumpKey( KT, "root\\mid1\\mid2\\mid3" ); return cli::ERR_NOERROR; }
static void DumpDB( DB_Struct *db) { int i; ENTER_FUNC; printf("\t\tDB group = [%s]\n",((DBG_Struct *)db->dbg)->name); DumpKey(db->pkey); if ( db->pcount > 0 ) { printf("\t\tpath ------\n"); for ( i = 0 ; i < db->pcount ; i ++ ) { DumpPath(db->path[i]); } } LEAVE_FUNC; }
void EventMapView::DumpMap(const char *aPrefix, EKeyMap *aKeyMap) { EKey *Key; Key = aKeyMap->fKeys; while (Key) { if (Key->fKeyMap) { char Prefix[32] = ""; if (aPrefix) { strcpy(Prefix, aPrefix); strcat(Prefix, "_"); } GetKeyName(Prefix + strlen(Prefix), sizeof(Prefix)-strlen(Prefix), Key->fKey); DumpMap(Prefix, Key->fKeyMap); } else { DumpKey(aPrefix, Key); } Key = Key->fNext; } }