Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: cloud_print/service/win/service_utils.cc

Issue 12676018: Moved GetCurrentUserName to service_utils.* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cloud_print/service/win/service_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cloud_print/service/win/service_utils.cc
diff --git a/cloud_print/service/win/service_utils.cc b/cloud_print/service/win/service_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1aa42b45bb71ddc72f5278c7939b154d8bd2f991
--- /dev/null
+++ b/cloud_print/service/win/service_utils.cc
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cloud_print/service/win/service_utils.h"
+
+#include <windows.h>
+#include <security.h> // NOLINT
+
+string16 GetCurrentUserName() {
+ ULONG size = 0;
+ string16 result;
+ ::GetUserNameEx(::NameSamCompatible, NULL, &size);
+ result.resize(size);
+ if (result.empty())
+ return result;
+ if (!::GetUserNameEx(::NameSamCompatible, &result[0], &size))
+ result.clear();
+ result.resize(size);
+ return result;
+}
+
+
« no previous file with comments | « cloud_print/service/win/service_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698