diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index b0f5faa4216..cf9ae5c8437 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -22,6 +22,7 @@ #include "config.h" #include +#include #ifdef HAVE_UNISTD_H # include #endif @@ -1345,6 +1346,33 @@ static WCHAR *get_compsysproduct_uuid(void) uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] ); return ret; } +#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 ); }