X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source%2Frpc_parse%2Fparse_misc.c;h=7321e362b89f30642cec648c46c75ec77bee8ee7;hb=5c6c8e1fe93;hp=54d8ae4785310a7d629c48a3c93a1b89a68edf8b;hpb=6585ea2cb7f417e14540495b9c7380fe9c8c717b;p=samba.git diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c index 54d8ae47853..7321e362b89 100644 --- a/source/rpc_parse/parse_misc.c +++ b/source/rpc_parse/parse_misc.c @@ -61,7 +61,7 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - + if (MARSHALLING(ps)) { low = *nttime & 0xFFFFFFFF; high = *nttime >> 32; @@ -88,6 +88,53 @@ BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) return smb_io_time( desc, nttime, ps, depth ); } +/******************************************************************* + Gets an enumeration handle from an ENUM_HND structure. +********************************************************************/ + +uint32 get_enum_hnd(ENUM_HND *enh) +{ + return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; +} + +/******************************************************************* + Inits an ENUM_HND structure. +********************************************************************/ + +void init_enum_hnd(ENUM_HND *enh, uint32 hnd) +{ + DEBUG(5,("smb_io_enum_hnd\n")); + + enh->ptr_hnd = (hnd != 0) ? 1 : 0; + enh->handle = hnd; +} + +/******************************************************************* + Reads or writes an ENUM_HND structure. +********************************************************************/ + +BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +{ + if (hnd == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_enum_hnd"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_hnd", ps, depth, &hnd->ptr_hnd)) /* pointer */ + return False; + + if (hnd->ptr_hnd != 0) { + if(!prs_uint32("handle ", ps, depth, &hnd->handle )) /* enum handle */ + return False; + } + + return True; +} + /******************************************************************* Reads or writes a DOM_SID structure. ********************************************************************/