server: Store registry modification date without rounding to seconds.
Sebastian Lackner
sebastian at fds-team.de
Wed Jul 29 15:16:12 CDT 2015
From: Michael Müller <michael at fds-team.de>
For https://bugs.winehq.org/show_bug.cgi?id=38927.
The DRM mechanism expects that the registry timestamps are stored with full precision.
The patch is written in such a way, that the registry format is forwards/backwards
compatible with other versions of Wine.
---
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
More information about the wine-patches
mailing list