From 2f4f9a086cfa7220663f69d15d27fe67e0a666e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Fri, 23 Sep 2016 17:11:27 +0200 Subject: [PATCH] s3-rpc_client: add spoolss_driver_version_to_qword() Guenther Signed-off-by: Guenther Deschner Reviewed-by: Uri Simchoni --- source3/rpc_client/init_spoolss.c | 20 ++++++++++++++++++++ source3/rpc_client/init_spoolss.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/source3/rpc_client/init_spoolss.c b/source3/rpc_client/init_spoolss.c index b4e3daac8fc..14370d8c69c 100644 --- a/source3/rpc_client/init_spoolss.c +++ b/source3/rpc_client/init_spoolss.c @@ -91,6 +91,26 @@ bool spoolss_timestr_to_NTTIME(const char *str, return true; } +/******************************************************************* + ********************************************************************/ + +bool spoolss_driver_version_to_qword(const char *str, + uint64_t *data) +{ + unsigned int v1, v2, v3, v4; + + if (sscanf(str, "%u.%u.%u.%u", &v1, &v2, &v3, &v4) != 4) { + return false; + } + + *data = ((uint64_t)(v1 & 0xFFFF) << 48) + + ((uint64_t)(v2 & 0xFFFF) << 32) + + ((uint64_t)(v3 & 0xFFFF) << 16) + + (uint64_t)(v4 & 0xFFFF); + + return true; +} + /******************************************************************* ********************************************************************/ diff --git a/source3/rpc_client/init_spoolss.h b/source3/rpc_client/init_spoolss.h index 10c899df29e..28dbb1b7b8b 100644 --- a/source3/rpc_client/init_spoolss.h +++ b/source3/rpc_client/init_spoolss.h @@ -27,6 +27,8 @@ bool init_systemtime(struct spoolss_Time *r, time_t spoolss_Time_to_time_t(const struct spoolss_Time *r); bool spoolss_timestr_to_NTTIME(const char *str, NTTIME *data); +bool spoolss_driver_version_to_qword(const char *str, + uint64_t *data); WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, union spoolss_PrinterData *data,