- Timestamp:
- 01/15/07 10:22:47 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfio.c
r77 r78 29 29 30 30 /* Registry types mapping */ 31 const unsigned int regfi o_num_reg_types = 12;32 static const char* regfi o_type_names[] =31 const unsigned int regfi_num_reg_types = 12; 32 static const char* regfi_type_names[] = 33 33 {"NONE", "SZ", "EXPAND_SZ", "BINARY", "DWORD", "DWORD_BE", "LINK", 34 34 "MULTI_SZ", "RSRC_LIST", "RSRC_DESC", "RSRC_REQ_LIST", "QWORD"}; … … 36 36 37 37 /* Returns NULL on error */ 38 const char* regfi o_type_val2str(unsigned int val)38 const char* regfi_type_val2str(unsigned int val) 39 39 { 40 40 if(val == REG_KEY) 41 41 return "KEY"; 42 42 43 if(val >= regfi o_num_reg_types)43 if(val >= regfi_num_reg_types) 44 44 return NULL; 45 45 46 return regfi o_type_names[val];46 return regfi_type_names[val]; 47 47 } 48 48 49 49 50 50 /* Returns -1 on error */ 51 int regfi o_type_str2val(const char* str)51 int regfi_type_str2val(const char* str) 52 52 { 53 53 int i; … … 56 56 return REG_KEY; 57 57 58 for(i=0; i < regfi o_num_reg_types; i++)59 if (strcmp(regfi o_type_names[i], str) == 0)58 for(i=0; i < regfi_num_reg_types; i++) 59 if (strcmp(regfi_type_names[i], str) == 0) 60 60 return i; 61 61 … … 69 69 /* Security descriptor parsing functions */ 70 70 71 const char* regfi o_ace_type2str(uint8 type)71 const char* regfi_ace_type2str(uint8 type) 72 72 { 73 73 static const char* map[7] … … 89 89 * http://msdn2.microsoft.com/en-us/library/aa772242.aspx 90 90 */ 91 char* regfi o_ace_flags2str(uint8 flags)91 char* regfi_ace_flags2str(uint8 flags) 92 92 { 93 93 static const char* flag_map[32] = … … 147 147 148 148 149 char* regfi o_ace_perms2str(uint32 perms)149 char* regfi_ace_perms2str(uint32 perms) 150 150 { 151 151 uint32 i, p; … … 226 226 227 227 228 char* regfi o_sid2str(DOM_SID* sid)228 char* regfi_sid2str(DOM_SID* sid) 229 229 { 230 230 uint32 i, size = MAXSUBAUTHS*11 + 24; … … 248 248 249 249 250 char* regfi o_get_acl(SEC_ACL* acl)250 char* regfi_get_acl(SEC_ACL* acl) 251 251 { 252 252 uint32 i, extra, size = 0; … … 263 263 for (i = 0; i < acl->num_aces && !failed; i++) 264 264 { 265 sid_str = regfi o_sid2str(&acl->ace[i].trustee);266 type_str = regfi o_ace_type2str(acl->ace[i].type);267 perms_str = regfi o_ace_perms2str(acl->ace[i].info.mask);268 flags_str = regfi o_ace_flags2str(acl->ace[i].flags);265 sid_str = regfi_sid2str(&acl->ace[i].trustee); 266 type_str = regfi_ace_type2str(acl->ace[i].type); 267 perms_str = regfi_ace_perms2str(acl->ace[i].info.mask); 268 flags_str = regfi_ace_flags2str(acl->ace[i].flags); 269 269 270 270 if(flags_str != NULL && perms_str != NULL … … 307 307 308 308 309 char* regfi o_get_sacl(SEC_DESC *sec_desc)309 char* regfi_get_sacl(SEC_DESC *sec_desc) 310 310 { 311 311 if (sec_desc->sacl) 312 return regfi o_get_acl(sec_desc->sacl);312 return regfi_get_acl(sec_desc->sacl); 313 313 else 314 314 return NULL; … … 316 316 317 317 318 char* regfi o_get_dacl(SEC_DESC *sec_desc)318 char* regfi_get_dacl(SEC_DESC *sec_desc) 319 319 { 320 320 if (sec_desc->dacl) 321 return regfi o_get_acl(sec_desc->dacl);321 return regfi_get_acl(sec_desc->dacl); 322 322 else 323 323 return NULL; … … 325 325 326 326 327 char* regfi o_get_owner(SEC_DESC *sec_desc)328 { 329 return regfi o_sid2str(sec_desc->owner_sid);330 } 331 332 333 char* regfi o_get_group(SEC_DESC *sec_desc)334 { 335 return regfi o_sid2str(sec_desc->grp_sid);327 char* regfi_get_owner(SEC_DESC *sec_desc) 328 { 329 return regfi_sid2str(sec_desc->owner_sid); 330 } 331 332 333 char* regfi_get_group(SEC_DESC *sec_desc) 334 { 335 return regfi_sid2str(sec_desc->grp_sid); 336 336 } 337 337 … … 1368 1368 first hbin offset. 1369 1369 *******************************************************************/ 1370 REGF_FILE* regfi o_open( const char *filename )1370 REGF_FILE* regfi_open( const char *filename ) 1371 1371 { 1372 1372 REGF_FILE *rb; … … 1382 1382 /* if ( !(rb->mem_ctx = talloc_init( "read_regf_block" )) ) 1383 1383 { 1384 regfi o_close( rb );1384 regfi_close( rb ); 1385 1385 return NULL; 1386 1386 } … … 1391 1391 1392 1392 if ( (rb->fd = open(filename, flags)) == -1 ) { 1393 /* DEBUG(0,("regfi o_open: failure to open %s (%s)\n", filename, strerror(errno)));*/1394 regfi o_close( rb );1393 /* DEBUG(0,("regfi_open: failure to open %s (%s)\n", filename, strerror(errno)));*/ 1394 regfi_close( rb ); 1395 1395 return NULL; 1396 1396 } … … 1399 1399 1400 1400 if ( !read_regf_block( rb ) ) { 1401 /* DEBUG(0,("regfi o_open: Failed to read initial REGF block\n"));*/1402 regfi o_close( rb );1401 /* DEBUG(0,("regfi_open: Failed to read initial REGF block\n"));*/ 1402 regfi_close( rb ); 1403 1403 return NULL; 1404 1404 } … … 1412 1412 /******************************************************************* 1413 1413 *******************************************************************/ 1414 static void regfi o_mem_free( REGF_FILE *file )1414 static void regfi_mem_free( REGF_FILE *file ) 1415 1415 { 1416 1416 /* free any zalloc()'d memory */ … … 1424 1424 /******************************************************************* 1425 1425 *******************************************************************/ 1426 int regfi o_close( REGF_FILE *file )1426 int regfi_close( REGF_FILE *file ) 1427 1427 { 1428 1428 int fd; 1429 1429 1430 regfi o_mem_free( file );1430 regfi_mem_free( file ); 1431 1431 1432 1432 /* nothing to do if there is no open file */ … … 1447 1447 on my experience. --jerry 1448 1448 *******************************************************************/ 1449 REGF_NK_REC* regfi o_rootkey( REGF_FILE *file )1449 REGF_NK_REC* regfi_rootkey( REGF_FILE *file ) 1450 1450 { 1451 1451 REGF_NK_REC *nk; … … 1459 1459 1460 1460 if ( !(nk = (REGF_NK_REC*)zalloc(sizeof(REGF_NK_REC) )) ) { 1461 /*DEBUG(0,("regfi o_rootkey: zalloc() failed!\n"));*/1461 /*DEBUG(0,("regfi_rootkey: zalloc() failed!\n"));*/ 1462 1462 return NULL; 1463 1463 } … … 1492 1492 1493 1493 if ( !found ) { 1494 /*DEBUG(0,("regfi o_rootkey: corrupt registry file ? No root key record located\n"));*/1494 /*DEBUG(0,("regfi_rootkey: corrupt registry file ? No root key record located\n"));*/ 1495 1495 return NULL; 1496 1496 } … … 1510 1510 NK record. Remember that offsets are from the *first* HBIN block. 1511 1511 *******************************************************************/ 1512 REGF_NK_REC* regfi o_fetch_subkey( REGF_FILE *file, REGF_NK_REC *nk )1512 REGF_NK_REC* regfi_fetch_subkey( REGF_FILE *file, REGF_NK_REC *nk ) 1513 1513 { 1514 1514 REGF_NK_REC *subkey; … … 1529 1529 return NULL; 1530 1530 } 1531 1531 1532 1532 nk_offset = nk->subkeys.hashes[nk->subkey_index].nk_off; 1533 1533 if(!prs_set_offset(&hbin->ps,
Note: See TracChangeset
for help on using the changeset viewer.