| Index: ui/base/win/lock_state.cc
|
| diff --git a/ui/base/win/lock_state.cc b/ui/base/win/lock_state.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8376041a879605cfab69c7ef758a49e8f82d807e
|
| --- /dev/null
|
| +++ b/ui/base/win/lock_state.cc
|
| @@ -0,0 +1,26 @@
|
| +// Copyright (c) 2014 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 "ui/base/win/lock_state.h"
|
| +
|
| +#include <windows.h>
|
| +
|
| +namespace ui {
|
| +
|
| +bool IsWorkstationLocked() {
|
| + bool is_locked = true;
|
| + HDESK input_desk = ::OpenInputDesktop(0, 0, GENERIC_READ);
|
| + if (input_desk) {
|
| + wchar_t name[256] = {0};
|
| + DWORD needed = 0;
|
| + if (::GetUserObjectInformation(
|
| + input_desk, UOI_NAME, name, sizeof(name), &needed)) {
|
| + is_locked = lstrcmpi(name, L"default") != 0;
|
| + }
|
| + ::CloseDesktop(input_desk);
|
| + }
|
| + return is_locked;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|