uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status ) { uint32 size = 0; size += size_of_relative_string( &status->servicename ); size += size_of_relative_string( &status->displayname ); size += sizeof(SERVICE_STATUS); return size; }
BOOL smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); uint32 relative_offset; buffer->string_at_end -= (size_of_relative_string(string) - 4); if(!prs_set_offset(ps, buffer->string_at_end)) return False; #if 0 /* JERRY */ /* * Win2k does not align strings in a buffer * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry */ if (!prs_align(ps)) return False; #endif buffer->string_at_end = prs_offset(ps); /* write the string */ if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, struct_offset)) return False; relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; } else { uint32 old_offset; /* read the offset */ if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) return False; if (buffer->string_at_end == 0) return True; old_offset = prs_offset(ps); if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) return False; /* read the string */ if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, old_offset)) return False; } return True; }