Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "libA.h"
  2. #include "libB.h"
  3. #include <gmodule.h>
  4. #include <stdio.h>
  5. GHashTable* table;
  6.  
  7. void add_entry_to_table(void* key, void* value, void* user_data)
  8. {
  9.     GHashTable* t = (GHashTable*)user_data;
  10.     g_hash_table_insert(t, key, value);
  11. }
  12.  
  13. void register_library(const context_t* ctx)
  14. {
  15.     printf("Register 1\n");
  16.     GHashTable* temp = (*(ctx->get_ctor_map))();
  17.     g_hash_table_foreach(temp, &add_entry_to_table, table);
  18.     g_hash_table_destroy(temp);
  19. }
  20.  
  21. int main(int argc, char** argv)
  22. {
  23.     table = g_hash_table_new(&g_int_hash, &g_int_equal);
  24.  
  25.     register_library(get_context_a());
  26.     register_library(get_context_b());
  27.  
  28.     int message_id = 0xA1;
  29.     printf("lookup 1\n");
  30.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  31.  
  32.     message_id = 0xB1;
  33.     printf("lookup 1\n");
  34.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  35.  
  36.     message_id = 0xA2;
  37.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  38.  
  39.     message_id = 0xA3;
  40.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  41.  
  42.     message_id = 0xB2;
  43.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  44.  
  45.     message_id = 0xB3;
  46.     (*(void(*)())g_hash_table_lookup(table, (void*)&message_id))();
  47.  
  48.     g_hash_table_destroy(table);
  49.     return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top