server-Registry_Timestamp: Some style improvements.

This commit is contained in:
Sebastian Lackner
2015-07-29 07:30:27 +02:00
parent c23d8e2738
commit 9454f5fc78
3 changed files with 45 additions and 46 deletions

View File

@@ -0,0 +1,50 @@
From 0cbf2798faf44d394601702bbfe97c7804c623d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 28 Jul 2015 17:46:13 +0200
Subject: server: Increase precision when saving / loading registry
modification date
---
server/registry.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/server/registry.c b/server/registry.c
index 43527df..68862a1 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -264,7 +264,8 @@ static void save_subkeys( const struct key *key, const struct key *base, FILE *f
{
fprintf( f, "\n[" );
if (key != base) dump_path( key, base, f );
- fprintf( f, "] %u\n", (unsigned int)((key->modif - ticks_1601_to_1970) / TICKS_PER_SEC) );
+ fprintf( f, "] %u %u\n", (unsigned int)((key->modif - ticks_1601_to_1970) / TICKS_PER_SEC),
+ (unsigned int)((key->modif - ticks_1601_to_1970) % TICKS_PER_SEC) );
if (key->class)
{
fprintf( f, "#class=\"" );
@@ -1346,8 +1347,8 @@ static struct key *load_key( struct key *base, const char *buffer,
{
WCHAR *p;
struct unicode_str name;
- int res;
- unsigned int mod;
+ int res, num_items;
+ unsigned int mod, mod_ticks;
timeout_t modif = current_time;
data_size_t len;
@@ -1359,8 +1360,9 @@ static struct key *load_key( struct key *base, const char *buffer,
file_read_error( "Malformed key", info );
return NULL;
}
- if (sscanf( buffer + res, " %u", &mod ) == 1)
- modif = (timeout_t)mod * TICKS_PER_SEC + ticks_1601_to_1970;
+ num_items = sscanf( buffer + res, " %u %u", &mod, &mod_ticks );
+ if (num_items >= 1) modif = (timeout_t)mod * TICKS_PER_SEC + ticks_1601_to_1970;
+ if (num_items >= 2) modif += mod_ticks;
p = info->tmp;
while (prefix_len && *p) { if (*p++ == '\\') prefix_len--; }
--
2.4.5

View File

@@ -0,0 +1 @@
Fixes: [38927] Store registry timestamps with nanoseconds precision