#include "includes.h"
#include "regfio.h"
+#include "reg_objects.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_REGISTRY
/* check for end of file */
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, false)) {
DEBUG(0,("write_block: stat() failed! (%s)\n", strerror(errno)));
return -1;
}
/* check for end of file */
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, false)) {
DEBUG(0,("read_block: stat() failed! (%s)\n", strerror(errno)));
return -1;
}
- if ( (size_t)file_offset >= sbuf.st_size )
+ if ( (size_t)file_offset >= sbuf.st_ex_size )
return -1;
/* if block_size == 0, we are parsing HBIN records and need
/*******************************************************************
*******************************************************************/
-static REGF_SK_REC* find_sk_record_by_sec_desc( REGF_FILE *file, SEC_DESC *sd )
+static REGF_SK_REC* find_sk_record_by_sec_desc( REGF_FILE *file, struct security_descriptor *sd )
{
REGF_SK_REC *p;
for ( p=file->sec_desc_list; p; p=p->next ) {
- if ( sec_desc_equal( p->sec_desc, sd ) )
+ if ( security_descriptor_equal( p->sec_desc, sd ) )
return p;
}
memcpy( hbin->header, "hbin", sizeof(HBIN_HDR_SIZE) );
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, false)) {
DEBUG(0,("regf_hbin_allocate: stat() failed! (%s)\n", strerror(errno)));
return NULL;
}
- hbin->file_off = sbuf.st_size;
+ hbin->file_off = sbuf.st_ex_size;
hbin->free_off = HBIN_HEADER_REC_SIZE;
hbin->free_size = block_size - hbin->free_off + sizeof(uint32);;
/*******************************************************************
*******************************************************************/
-static uint32 sk_record_data_size( SEC_DESC * sd )
+static uint32 sk_record_data_size( struct security_descriptor * sd )
{
uint32 size, size_mod8;
/* the record size is sizeof(hdr) + name + static members + data_size_field */
- size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, NULL, 0) + sizeof(uint32);
+ size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32);
/* multiple of 8 */
size_mod8 = size & 0xfffffff8;
/*******************************************************************
*******************************************************************/
-static bool create_vk_record( REGF_FILE *file, REGF_VK_REC *vk, REGISTRY_VALUE *value )
+static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk,
+ struct regval_blob *value)
{
char *name = regval_name(value);
REGF_HBIN *data_hbin;
/*******************************************************************
*******************************************************************/
- REGF_NK_REC* regfio_write_key( REGF_FILE *file, const char *name,
- REGVAL_CTR *values, struct regsubkey_ctr *subkeys,
- SEC_DESC *sec_desc, REGF_NK_REC *parent )
+ REGF_NK_REC* regfio_write_key( REGF_FILE *file, const char *name,
+ struct regval_ctr *values, struct regsubkey_ctr *subkeys,
+ struct security_descriptor *sec_desc, REGF_NK_REC *parent )
{
REGF_NK_REC *nk;
REGF_HBIN *vlist_hbin = NULL;
parent->subkey_index++;
/* sort the list by keyname */
-
- qsort( parent->subkeys.hashes, parent->subkey_index, sizeof(REGF_HASH_REC), QSORT_CAST hashrec_cmp );
+ TYPESAFE_QSORT(parent->subkeys.hashes, parent->subkey_index, hashrec_cmp);
if ( !hbin_prs_lf_records( "lf_rec", parent->subkeys.hbin, 0, parent ) )
return False;
nk->sec_desc->ref_count = 0;
/* size value must be self-inclusive */
- nk->sec_desc->size = ndr_size_security_descriptor(sec_desc, NULL, 0)
+ nk->sec_desc->size = ndr_size_security_descriptor(sec_desc, 0)
+ sizeof(uint32);
DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *);
if this is the first record, then just set the next and prev
offsets to ourself. */
- if ( nk->sec_desc->prev ) {
- REGF_SK_REC *prev = nk->sec_desc->prev;
+ if ( DLIST_PREV(nk->sec_desc) ) {
+ REGF_SK_REC *prev = DLIST_PREV(nk->sec_desc);
nk->sec_desc->prev_sk_off = prev->hbin_off + prev->hbin->first_hbin_off - HBIN_HDR_SIZE;
prev->next_sk_off = nk->sec_desc->sk_off;
for ( i=0; i<nk->num_values; i++ ) {
uint32 vk_size, namelen, datalen;
- REGISTRY_VALUE *r;
+ struct regval_blob *r;
r = regval_ctr_specific_value( values, i );
create_vk_record( file, &nk->values[i], r );