--- a/libsam.c
+++ b/libsam.c
@@ -511,7 +511,7 @@
 
      if (gverbose) printf("put_grp_members_sid: ajusted: mofs = %x, mlen = %x (%d)\n", mofs + 0x34 ,mlen,mlen);
 
-     if (gverbose) hexdump(&c->data, 0, c->len, 1);
+     if (gverbose) hexdump((void*)&c->data, 0, c->len, 1);
 
     /* Get total size of new SID data */
 
@@ -528,7 +528,7 @@
     sidptr = &cd->data[mofs];
 
     for (i = 0; sarray[i].sidptr; i++) {
-      if (gverbose) printf("  copying : %d len %x, at %x\n",i,sarray[i].len, sidptr);
+      if (gverbose) printf("  copying : %d len %x, at %p\n",i,sarray[i].len, sidptr);
       str = sam_sid_to_string(sarray[i].sidptr);
       if (gverbose) printf("  Member # %d = <%s>\n", i, str);
       FREE(str);      
@@ -539,7 +539,7 @@
     cd->members_len = sidlen;  /* Update member count in C struct */
     cd->grp_members = i;
 
-    if (gverbose) hexdump(&c->data, 0, c->len, 1);
+    if (gverbose) hexdump((void*)&c->data, 0, c->len, 1);
 
     if (!put_buf2val(hdesc, c, 0, g, 0, TPF_VK_EXACT)) {
       fprintf(stderr,"put_grp_members_sid: could not write back group info in value %s\n",g);
--- a/ntreg.c
+++ b/ntreg.c
@@ -543,27 +543,27 @@
 #define D_OFFS(o) ( (void *)&(key->o)-(void *)hdesc->buffer-vofs )
 
   key = (struct nk_key *)(hdesc->buffer + vofs);
-  printf("%04x   type              = 0x%02x %s\n", D_OFFS(type)  ,key->type,
-	                           (key->type == KEY_ROOT ? "ROOT_KEY" : "") );
-  printf("%04x   timestamp skipped\n", D_OFFS(timestamp) );
-  printf("%04x   parent key offset = 0x%0x\n", D_OFFS(ofs_parent) ,key->ofs_parent + 0x1000);
-  printf("%04x   number of subkeys = %d\n", D_OFFS(no_subkeys),key->no_subkeys);
-  printf("%04x   lf-record offset  = 0x%0x\n",D_OFFS(ofs_lf),key->ofs_lf + 0x1000);
-  printf("%04x   number of values  = %d\n", D_OFFS(no_values),key->no_values);
-  printf("%04x   val-list offset   = 0x%0x\n",D_OFFS(ofs_vallist),key->ofs_vallist + 0x1000);
-  printf("%04x   sk-record offset  = 0x%0x\n",D_OFFS(ofs_sk),key->ofs_sk + 0x1000);
-  printf("%04x   classname offset  = 0x%0x\n",D_OFFS(ofs_classnam),key->ofs_classnam + 0x1000);
+  printf("%04tx   type              = 0x%02x %s\n", D_OFFS(type)  ,key->type,
+ 	                           (key->type == KEY_ROOT ? "ROOT_KEY" : "") );
+  printf("%04tx   timestamp skipped\n", D_OFFS(timestamp) );
+  printf("%04tx   parent key offset = 0x%0x\n", D_OFFS(ofs_parent) ,key->ofs_parent + 0x1000);
+  printf("%04tx   number of subkeys = %d\n", D_OFFS(no_subkeys),key->no_subkeys);
+  printf("%04tx   lf-record offset  = 0x%0x\n",D_OFFS(ofs_lf),key->ofs_lf + 0x1000);
+  printf("%04tx   number of values  = %d\n", D_OFFS(no_values),key->no_values);
+  printf("%04tx   val-list offset   = 0x%0x\n",D_OFFS(ofs_vallist),key->ofs_vallist + 0x1000);
+  printf("%04tx   sk-record offset  = 0x%0x\n",D_OFFS(ofs_sk),key->ofs_sk + 0x1000);
+  printf("%04tx   classname offset  = 0x%0x\n",D_OFFS(ofs_classnam),key->ofs_classnam + 0x1000);
 
-  printf("%04x   dummy3            = 0x%0x (%d)\n",D_OFFS(dummy3),key->dummy3,key->dummy3);
-  printf("%04x   dummy4            = 0x%0x (%d)\n",D_OFFS(dummy4),key->dummy4,key->dummy4);
-  printf("%04x   dummy5            = 0x%0x (%d)\n",D_OFFS(dummy5),key->dummy5,key->dummy5);
-  printf("%04x   dummy6            = 0x%0x (%d)\n",D_OFFS(dummy6),key->dummy6,key->dummy6);
-  printf("%04x   dummy7            = 0x%0x (%d)\n",D_OFFS(dummy7),key->dummy7,key->dummy7);
+  printf("%04tx   dummy3            = 0x%0x (%d)\n",D_OFFS(dummy3),key->dummy3,key->dummy3);
+  printf("%04tx   dummy4            = 0x%0x (%d)\n",D_OFFS(dummy4),key->dummy4,key->dummy4);
+  printf("%04tx   dummy5            = 0x%0x (%d)\n",D_OFFS(dummy5),key->dummy5,key->dummy5);
+  printf("%04tx   dummy6            = 0x%0x (%d)\n",D_OFFS(dummy6),key->dummy6,key->dummy6);
+  printf("%04tx   dummy7            = 0x%0x (%d)\n",D_OFFS(dummy7),key->dummy7,key->dummy7);
 
-  printf("%04x   name length       = %d\n", D_OFFS(len_name),key->len_name);
-  printf("%04x   classname length  = %d\n", D_OFFS(len_classnam),key->len_classnam);
+  printf("%04tx   name length       = %d\n", D_OFFS(len_name),key->len_name);
+  printf("%04tx   classname length  = %d\n", D_OFFS(len_classnam),key->len_classnam);
 
-  printf("%04x   Key name: <",D_OFFS(keyname) );
+  printf("%04tx   Key name: <",D_OFFS(keyname) );
   for(i = 0; i < key->len_name; i++) putchar(key->keyname[i]);
   printf(">\n== End of key info.\n");
 
@@ -581,18 +581,18 @@
 
 
   key = (struct vk_key *)(hdesc->buffer + vofs);
-  printf("%04x   name length       = %d (0x%0x)\n", D_OFFS(len_name),
+  printf("%04tx   name length       = %d (0x%0x)\n", D_OFFS(len_name),
 	                             key->len_name, key->len_name  );
-  printf("%04x   length of data    = %d (0x%0x)\n", D_OFFS(len_data),
+  printf("%04tx   length of data    = %d (0x%0x)\n", D_OFFS(len_data),
 	                             key->len_data, key->len_data  );
-  printf("%04x   data offset       = 0x%0x\n",D_OFFS(ofs_data),key->ofs_data + 0x1000);
-  printf("%04x   value type        = 0x%0x  %s\n", D_OFFS(val_type), key->val_type,
-                 (key->val_type <= REG_MAX ? val_types[key->val_type] : "(unknown)") ) ;
-
-  printf("%04x   flag              = 0x%0x\n",D_OFFS(flag),key->flag);
-  printf("%04x   *unused?*         = 0x%0x\n",D_OFFS(dummy1),key->dummy1);
+  printf("%04tx   data offset       = 0x%0x\n",D_OFFS(ofs_data),key->ofs_data + 0x1000);
+  printf("%04tx   value type        = 0x%0x  %s\n", D_OFFS(val_type), key->val_type,
+                  (key->val_type <= REG_MAX ? val_types[key->val_type] : "(unknown)") ) ;
 
-  printf("%04x   Key name: <",D_OFFS(keyname) );
+  printf("%04tx   flag              = 0x%0x\n",D_OFFS(flag),key->flag);
+  printf("%04tx   *unused?*         = 0x%0x\n",D_OFFS(dummy1),key->dummy1);
+
+  printf("%04tx   Key name: <",D_OFFS(keyname) );
   for(i = 0; i < key->len_name; i++) putchar(key->keyname[i]);
   printf(">\n== End of key info.\n");
 
@@ -610,13 +610,13 @@
   printf("== sk at offset %0x\n",vofs);
 
   key = (struct sk_key *)(hdesc->buffer + vofs);
-  printf("%04x   *unused?*         = %d\n"   , D_OFFS(dummy1),     key->dummy1    );
-  printf("%04x   Offset to prev sk = 0x%0x\n", D_OFFS(ofs_prevsk), key->ofs_prevsk + 0x1000);
-  printf("%04x   Offset to next sk = 0x%0x\n", D_OFFS(ofs_nextsk), key->ofs_nextsk + 0x1000);
-  printf("%04x   Usage counter     = %d (0x%0x)\n", D_OFFS(no_usage),
-	                                            key->no_usage,key->no_usage);
-  printf("%04x   Security data len = %d (0x%0x)\n", D_OFFS(len_sk),
-	                                            key->len_sk,key->len_sk);
+  printf("%04tx   *unused?*         = %d\n"   , D_OFFS(dummy1),     key->dummy1    );
+  printf("%04tx   Offset to prev sk = 0x%0x\n", D_OFFS(ofs_prevsk), key->ofs_prevsk + 0x1000);
+  printf("%04tx   Offset to next sk = 0x%0x\n", D_OFFS(ofs_nextsk), key->ofs_nextsk + 0x1000);
+  printf("%04tx   Usage counter     = %d (0x%0x)\n", D_OFFS(no_usage),
+	                                             key->no_usage,key->no_usage);
+  printf("%04tx   Security data len = %d (0x%0x)\n", D_OFFS(len_sk),
+	                                             key->len_sk,key->len_sk);
 
   printf("== End of key info.\n");
 
@@ -634,10 +634,10 @@
   printf("== lf at offset %0x\n",vofs);
 
   key = (struct lf_key *)(hdesc->buffer + vofs);
-  printf("%04x   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
+  printf("%04tx   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
 
   for(i = 0; i < key->no_keys; i++) {
-    printf("%04x      %3d   Offset: 0x%0x  - <%c%c%c%c>\n", 
+    printf("%04tx      %3d   Offset: 0x%0x  - <%c%c%c%c>\n", 
 	   D_OFFS(hash[i].ofs_nk), i,
 	   key->hash[i].ofs_nk + 0x1000,
            key->hash[i].name[0],
@@ -662,10 +662,10 @@
   printf("== lh at offset %0x\n",vofs);
 
   key = (struct lf_key *)(hdesc->buffer + vofs);
-  printf("%04x   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
+  printf("%04tx   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
 
   for(i = 0; i < key->no_keys; i++) {
-    printf("%04x      %3d   Offset: 0x%0x  - <hash: %08x>\n", 
+    printf("%04tx      %3d   Offset: 0x%0x  - <hash: %08x>\n", 
 	   D_OFFS(lh_hash[i].ofs_nk), i,
 	   key->lh_hash[i].ofs_nk + 0x1000,
            key->lh_hash[i].hash );
@@ -689,10 +689,10 @@
   /* #define D_OFFS(o) ( (void *)&(key->o)-(void *)hdesc->buffer-vofs ) */
 
   key = (struct li_key *)(hdesc->buffer + vofs);
-  printf("%04x   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
+  printf("%04tx   number of keys    = %d\n", D_OFFS(no_keys), key->no_keys  );
 
   for(i = 0; i < key->no_keys; i++) {
-    printf("%04x      %3d   Offset: 0x%0x\n", 
+    printf("%04tx      %3d   Offset: 0x%0x\n", 
 	   D_OFFS(hash[i].ofs_nk), i,
 	   key->hash[i].ofs_nk + 0x1000);
   }
@@ -714,10 +714,10 @@
   /* #define D_OFFS(o) ( (void *)&(key->o)-(void *)hdesc->buffer-vofs ) */
 
   key = (struct ri_key *)(hdesc->buffer + vofs);
-  printf("%04x   number of subindices = %d\n", D_OFFS(no_lis), key->no_lis  );
+  printf("%04tx   number of subindices = %d\n", D_OFFS(no_lis), key->no_lis  );
 
   for(i = 0; i < key->no_lis; i++) {
-    printf("%04x      %3d   Offset: 0x%0x\n", 
+    printf("%04tx      %3d   Offset: 0x%0x\n", 
 	   D_OFFS(hash[i].ofs_li), i,
 	   key->hash[i].ofs_li + 0x1000);
   }
@@ -736,9 +736,9 @@
   printf("== db at offset %0x\n",vofs);
 
   key = (struct db_key *)(hdesc->buffer + vofs);
-  printf("%04x   number of parts    = %d\n", D_OFFS(no_part), key->no_part  );
+  printf("%04tx   number of parts    = %d\n", D_OFFS(no_part), key->no_part  );
 
-  printf("%04x   Data list at offset: 0x%0x\n", 
+  printf("%04tx   Data list at offset: 0x%0x\n", 
 	   D_OFFS(ofs_data),
 	   key->ofs_data + 0x1000);
   
@@ -2152,7 +2152,7 @@
 
 
   } else { /* 4 bytes or less are inlined */
-    datablk = vkofs + (int32_t)&(vkkey->ofs_data) - (int32_t)vkkey;
+    datablk = vkofs + ((void*)&(vkkey->ofs_data) - (void*)vkkey);
     size |= 0x80000000;
   }
 
@@ -4257,7 +4257,7 @@
 
   if (rt < sizeof (*hdesc)) {
     fprintf(stderr,
-	    "file is too small; got %d bytes while expecting %d or more\n",
+	    "file is too small; got %d bytes while expecting %zu or more\n",
 	    rt, sizeof (*hdesc));
     closeHive(hdesc);
     return(NULL);
