Commit a2545727 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Return the machine ID for Win32_ComputerSystemProduct.UUID on Linux.

parent 9842bf33
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "config.h" #include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
...@@ -1346,6 +1347,33 @@ static WCHAR *get_compsysproduct_uuid(void) ...@@ -1346,6 +1347,33 @@ static WCHAR *get_compsysproduct_uuid(void)
return ret; return ret;
} }
#endif #endif
#ifdef __linux__
int file;
if ((file = open( "/var/lib/dbus/machine-id", O_RDONLY )) != -1)
{
unsigned char buf[32];
if (read( file, buf, sizeof(buf) ) == sizeof(buf))
{
unsigned int i, j;
WCHAR *ret, *p;
close( file );
if (!(p = ret = heap_alloc( 37 * sizeof(WCHAR) ))) return NULL;
for (i = 0, j = 0; i < 8; i++) p[i] = toupperW( buf[j++] );
p[8] = '-';
for (i = 9; i < 13; i++) p[i] = toupperW( buf[j++] );
p[13] = '-';
for (i = 14; i < 18; i++) p[i] = toupperW( buf[j++] );
p[18] = '-';
for (i = 19; i < 23; i++) p[i] = toupperW( buf[j++] );
p[23] = '-';
for (i = 24; i < 36; i++) p[i] = toupperW( buf[j++] );
ret[i] = 0;
return ret;
}
close( file );
}
#endif
return heap_strdupW( compsysproduct_uuidW ); return heap_strdupW( compsysproduct_uuidW );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment