]> khamidou — GitHub mirrors - electron.git/commitdiff
Correct generation of GUID on Windows.
authorHaojian Wu <hokein.wu@gmail.com>
Mon, 17 Aug 2015 05:20:36 +0000 (13:20 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Mon, 17 Aug 2015 05:20:36 +0000 (13:20 +0800)
atom/browser/ui/win/notify_icon.cc

index 962dc871b5b67a4e60e2528f859b4594e8e48202..48d0f875bcd08a04796c71f8296aeff2e142fbef 100644 (file)
@@ -39,6 +39,16 @@ NotifyIcon::NotifyIcon(NotifyIconHost* host,
     base::MD5Sum(explicit_app_id,
                  sizeof(wchar_t) * wcslen(explicit_app_id),
                  reinterpret_cast<base::MD5Digest*>(&tray_app_id_hash_));
+
+    // Set the GUID to version 4 as described in RFC 4122, section 4.4.
+    // The format of GUID version 4 must be like
+    // xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where y is one of [8, 9, A, B].
+    tray_app_id_hash_.Data3 &= 0x0fff;
+    tray_app_id_hash_.Data3 |= 0x4000;
+
+    // Set y to one of [8, 9, A, B].
+    tray_app_id_hash_.Data4[0] = 1;
+
     has_tray_app_id_hash_ = true;
     CoTaskMemFree(explicit_app_id);
   }