{"action":"created","comment":{"url":"https://api.github.com/repos/collectd/collectd/pulls/comments/209104787","pull_request_review_id":145057386,"id":209104787,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTEwNDc4Nw==","diff_hunk":"@@ -0,0 +1,427 @@\n+/*\r\n+ * collectd - src/utils_wmi.c\r\n+ * Copyright (c) 2018  Google LLC\r\n+ *\r\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n+ * of this software and associated documentation files (the \"Software\"), to deal\r\n+ * in the Software without restriction, including without limitation the rights\r\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n+ * copies of the Software, and to permit persons to whom the Software is\r\n+ * furnished to do so, subject to the following conditions:\r\n+ *\r\n+ * The above copyright notice and this permission notice shall be included in\r\n+ * all copies or substantial portions of the Software.\r\n+ *\r\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n+ * THE SOFTWARE.\r\n+ */\r\n+#include \"common.h\"\r\n+#include \"plugin.h\"\r\n+#include \"utils_wmi.h\"\r\n+\r\n+#include <stdio.h>\r\n+#include <stdlib.h>\r\n+#include <tchar.h>\r\n+#include <wbemidl.h>\r\n+#include <windows.h>\r\n+#include <wtypes.h>\r\n+\r\n+#define log_err(...) ERROR(\"wmi_utils: \" __VA_ARGS__)\r\n+#define log_warn(...) WARNING(\"wmi_utils: \" __VA_ARGS__)\r\n+\r\n+static enum VARENUM variant_unsigned_integer_types[] = {VT_UI1, VT_UI2, VT_UI4,\r\n+                                                        VT_UI8, VT_UINT};\r\n+\r\n+static int variant_is_unsigned_integer(VARIANT *v) {\r\n+  int i;\r\n+  for (i = 0; i < COUNTOF(variant_unsigned_integer_types); i++)\r\n+    if (v->vt == variant_unsigned_integer_types[i])\r\n+      return 1;\r\n+  return 0;\r\n+}\r\n+\r\n+static enum VARENUM variant_signed_integer_types[] = {VT_I1, VT_I2, VT_I4,\r\n+                                                      VT_I8, VT_INT};\r\n+\r\n+static int variant_is_signed_integer(VARIANT *v) {\r\n+  int i;\r\n+  for (i = 0; i < COUNTOF(variant_signed_integer_types); i++)\r\n+    if (v->vt == variant_signed_integer_types[i])\r\n+      return 1;\r\n+  return 0;\r\n+}\r\n+\r\n+uint64_t variant_get_unsigned(VARIANT *v) {\r","path":"src/utils_wmi.c","position":null,"original_position":59,"commit_id":"e18ca0fbde24f8da93acebf853cf57e16b9b842a","original_commit_id":"4421c5fe1671073eabd828e3d9e6ccd62355430f","user":{"login":"SeanCampbell","id":6550015,"node_id":"MDQ6VXNlcjY1NTAwMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/6550015?v=4","gravatar_id":"","url":"https://api.github.com/users/SeanCampbell","html_url":"https://github.com/SeanCampbell","followers_url":"https://api.github.com/users/SeanCampbell/followers","following_url":"https://api.github.com/users/SeanCampbell/following{/other_user}","gists_url":"https://api.github.com/users/SeanCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/SeanCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeanCampbell/subscriptions","organizations_url":"https://api.github.com/users/SeanCampbell/orgs","repos_url":"https://api.github.com/users/SeanCampbell/repos","events_url":"https://api.github.com/users/SeanCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/SeanCampbell/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2018-08-09T23:04:48Z","updated_at":"2018-08-09T23:04:48Z","html_url":"https://github.com/collectd/collectd/pull/2886#discussion_r209104787","pull_request_url":"https://api.github.com/repos/collectd/collectd/pulls/2886","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/collectd/collectd/pulls/comments/209104787"},"html":{"href":"https://github.com/collectd/collectd/pull/2886#discussion_r209104787"},"pull_request":{"href":"https://api.github.com/repos/collectd/collectd/pulls/2886"}},"in_reply_to_id":208280649},"pull_request":{"url":"https://api.github.com/repos/collectd/collectd/pulls/2886","id":205567792,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NTY3Nzky","html_url":"https://github.com/collectd/collectd/pull/2886","diff_url":"https://github.com/collectd/collectd/pull/2886.diff","patch_url":"https://github.com/collectd/collectd/pull/2886.patch","issue_url":"https://api.github.com/repos/collectd/collectd/issues/2886","number":2886,"state":"open","locked":false,"title":"Add and enable WMI plugin for Windows","user":{"login":"SeanCampbell","id":6550015,"node_id":"MDQ6VXNlcjY1NTAwMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/6550015?v=4","gravatar_id":"","url":"https://api.github.com/users/SeanCampbell","html_url":"https://github.com/SeanCampbell","followers_url":"https://api.github.com/users/SeanCampbell/followers","following_url":"https://api.github.com/users/SeanCampbell/following{/other_user}","gists_url":"https://api.github.com/users/SeanCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/SeanCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeanCampbell/subscriptions","organizations_url":"https://api.github.com/users/SeanCampbell/orgs","repos_url":"https://api.github.com/users/SeanCampbell/repos","events_url":"https://api.github.com/users/SeanCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/SeanCampbell/received_events","type":"User","site_admin":false},"body":"Let me know if you want me to break this apart at all, e.g. utils_wmi can be submitted in a PR first, following by the wmi plugin.\r\n\r\nThis is a modified version of kele's commit on Stackdriver: https://github.com/Stackdriver/collectd/commit/181cb478f3ec88148c398b80444c9c83295ec497","created_at":"2018-08-01T22:10:48Z","updated_at":"2018-08-09T23:04:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"845ea37d08537164a5c33a7050bd4fac171ab735","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/collectd/collectd/pulls/2886/commits","review_comments_url":"https://api.github.com/repos/collectd/collectd/pulls/2886/comments","review_comment_url":"https://api.github.com/repos/collectd/collectd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/collectd/collectd/issues/2886/comments","statuses_url":"https://api.github.com/repos/collectd/collectd/statuses/e18ca0fbde24f8da93acebf853cf57e16b9b842a","head":{"label":"Stackdriver:wmi","ref":"wmi","sha":"e18ca0fbde24f8da93acebf853cf57e16b9b842a","user":{"login":"Stackdriver","id":2104369,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDQzNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/2104369?v=4","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"repo":{"id":11033551,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAzMzU1MQ==","name":"collectd","full_name":"Stackdriver/collectd","owner":{"login":"Stackdriver","id":2104369,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDQzNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/2104369?v=4","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stackdriver/collectd","description":"The system statistics collection daemon. Mirror of the canonical repository (updated hourly), but feel free to send Pull Requests!","fork":true,"url":"https://api.github.com/repos/Stackdriver/collectd","forks_url":"https://api.github.com/repos/Stackdriver/collectd/forks","keys_url":"https://api.github.com/repos/Stackdriver/collectd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stackdriver/collectd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stackdriver/collectd/teams","hooks_url":"https://api.github.com/repos/Stackdriver/collectd/hooks","issue_events_url":"https://api.github.com/repos/Stackdriver/collectd/issues/events{/number}","events_url":"https://api.github.com/repos/Stackdriver/collectd/events","assignees_url":"https://api.github.com/repos/Stackdriver/collectd/assignees{/user}","branches_url":"https://api.github.com/repos/Stackdriver/collectd/branches{/branch}","tags_url":"https://api.github.com/repos/Stackdriver/collectd/tags","blobs_url":"https://api.github.com/repos/Stackdriver/collectd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stackdriver/collectd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stackdriver/collectd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stackdriver/collectd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stackdriver/collectd/statuses/{sha}","languages_url":"https://api.github.com/repos/Stackdriver/collectd/languages","stargazers_url":"https://api.github.com/repos/Stackdriver/collectd/stargazers","contributors_url":"https://api.github.com/repos/Stackdriver/collectd/contributors","subscribers_url":"https://api.github.com/repos/Stackdriver/collectd/subscribers","subscription_url":"https://api.github.com/repos/Stackdriver/collectd/subscription","commits_url":"https://api.github.com/repos/Stackdriver/collectd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stackdriver/collectd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stackdriver/collectd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stackdriver/collectd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Stackdriver/collectd/contents/{+path}","compare_url":"https://api.github.com/repos/Stackdriver/collectd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stackdriver/collectd/merges","archive_url":"https://api.github.com/repos/Stackdriver/collectd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stackdriver/collectd/downloads","issues_url":"https://api.github.com/repos/Stackdriver/collectd/issues{/number}","pulls_url":"https://api.github.com/repos/Stackdriver/collectd/pulls{/number}","milestones_url":"https://api.github.com/repos/Stackdriver/collectd/milestones{/number}","notifications_url":"https://api.github.com/repos/Stackdriver/collectd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stackdriver/collectd/labels{/name}","releases_url":"https://api.github.com/repos/Stackdriver/collectd/releases{/id}","deployments_url":"https://api.github.com/repos/Stackdriver/collectd/deployments","created_at":"2013-06-28T17:55:42Z","updated_at":"2018-07-30T20:13:04Z","pushed_at":"2018-08-09T23:04:30Z","git_url":"git://github.com/Stackdriver/collectd.git","ssh_url":"git@github.com:Stackdriver/collectd.git","clone_url":"https://github.com/Stackdriver/collectd.git","svn_url":"https://github.com/Stackdriver/collectd","homepage":"http://collectd.org/","size":34756,"stargazers_count":29,"watchers_count":29,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":10,"watchers":29,"default_branch":"stackdriver-agent-5.5.2"}},"base":{"label":"collectd:master","ref":"master","sha":"065f3ea8879dde03344b397b07ad561ff3744d21","user":{"login":"collectd","id":1027481,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjc0ODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1027481?v=4","gravatar_id":"","url":"https://api.github.com/users/collectd","html_url":"https://github.com/collectd","followers_url":"https://api.github.com/users/collectd/followers","following_url":"https://api.github.com/users/collectd/following{/other_user}","gists_url":"https://api.github.com/users/collectd/gists{/gist_id}","starred_url":"https://api.github.com/users/collectd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectd/subscriptions","organizations_url":"https://api.github.com/users/collectd/orgs","repos_url":"https://api.github.com/users/collectd/repos","events_url":"https://api.github.com/users/collectd/events{/privacy}","received_events_url":"https://api.github.com/users/collectd/received_events","type":"Organization","site_admin":false},"repo":{"id":3208640,"node_id":"MDEwOlJlcG9zaXRvcnkzMjA4NjQw","name":"collectd","full_name":"collectd/collectd","owner":{"login":"collectd","id":1027481,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjc0ODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1027481?v=4","gravatar_id":"","url":"https://api.github.com/users/collectd","html_url":"https://github.com/collectd","followers_url":"https://api.github.com/users/collectd/followers","following_url":"https://api.github.com/users/collectd/following{/other_user}","gists_url":"https://api.github.com/users/collectd/gists{/gist_id}","starred_url":"https://api.github.com/users/collectd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/collectd/subscriptions","organizations_url":"https://api.github.com/users/collectd/orgs","repos_url":"https://api.github.com/users/collectd/repos","events_url":"https://api.github.com/users/collectd/events{/privacy}","received_events_url":"https://api.github.com/users/collectd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/collectd/collectd","description":"The system statistics collection daemon. Please send Pull Requests here!","fork":false,"url":"https://api.github.com/repos/collectd/collectd","forks_url":"https://api.github.com/repos/collectd/collectd/forks","keys_url":"https://api.github.com/repos/collectd/collectd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/collectd/collectd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/collectd/collectd/teams","hooks_url":"https://api.github.com/repos/collectd/collectd/hooks","issue_events_url":"https://api.github.com/repos/collectd/collectd/issues/events{/number}","events_url":"https://api.github.com/repos/collectd/collectd/events","assignees_url":"https://api.github.com/repos/collectd/collectd/assignees{/user}","branches_url":"https://api.github.com/repos/collectd/collectd/branches{/branch}","tags_url":"https://api.github.com/repos/collectd/collectd/tags","blobs_url":"https://api.github.com/repos/collectd/collectd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/collectd/collectd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/collectd/collectd/git/refs{/sha}","trees_url":"https://api.github.com/repos/collectd/collectd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/collectd/collectd/statuses/{sha}","languages_url":"https://api.github.com/repos/collectd/collectd/languages","stargazers_url":"https://api.github.com/repos/collectd/collectd/stargazers","contributors_url":"https://api.github.com/repos/collectd/collectd/contributors","subscribers_url":"https://api.github.com/repos/collectd/collectd/subscribers","subscription_url":"https://api.github.com/repos/collectd/collectd/subscription","commits_url":"https://api.github.com/repos/collectd/collectd/commits{/sha}","git_commits_url":"https://api.github.com/repos/collectd/collectd/git/commits{/sha}","comments_url":"https://api.github.com/repos/collectd/collectd/comments{/number}","issue_comment_url":"https://api.github.com/repos/collectd/collectd/issues/comments{/number}","contents_url":"https://api.github.com/repos/collectd/collectd/contents/{+path}","compare_url":"https://api.github.com/repos/collectd/collectd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/collectd/collectd/merges","archive_url":"https://api.github.com/repos/collectd/collectd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/collectd/collectd/downloads","issues_url":"https://api.github.com/repos/collectd/collectd/issues{/number}","pulls_url":"https://api.github.com/repos/collectd/collectd/pulls{/number}","milestones_url":"https://api.github.com/repos/collectd/collectd/milestones{/number}","notifications_url":"https://api.github.com/repos/collectd/collectd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/collectd/collectd/labels{/name}","releases_url":"https://api.github.com/repos/collectd/collectd/releases{/id}","deployments_url":"https://api.github.com/repos/collectd/collectd/deployments","created_at":"2012-01-18T13:07:51Z","updated_at":"2018-08-08T17:33:53Z","pushed_at":"2018-08-09T23:04:34Z","git_url":"git://github.com/collectd/collectd.git","ssh_url":"git@github.com:collectd/collectd.git","clone_url":"https://github.com/collectd/collectd.git","svn_url":"https://github.com/collectd/collectd","homepage":"http://collectd.org/","size":20765,"stargazers_count":2010,"watchers_count":2010,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1002,"mirror_url":null,"archived":false,"open_issues_count":438,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1002,"open_issues":438,"watchers":2010,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/collectd/collectd/pulls/2886"},"html":{"href":"https://github.com/collectd/collectd/pull/2886"},"issue":{"href":"https://api.github.com/repos/collectd/collectd/issues/2886"},"comments":{"href":"https://api.github.com/repos/collectd/collectd/issues/2886/comments"},"review_comments":{"href":"https://api.github.com/repos/collectd/collectd/pulls/2886/comments"},"review_comment":{"href":"https://api.github.com/repos/collectd/collectd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/collectd/collectd/pulls/2886/commits"},"statuses":{"href":"https://api.github.com/repos/collectd/collectd/statuses/e18ca0fbde24f8da93acebf853cf57e16b9b842a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"SeanCampbell"}}