source: branches/eraser6/Eraser.Unlocker/Unlocker.h @ 1065

Revision 1065, 1.5 KB checked in by lowjoel, 6 years ago (diff)

Set svn:keywords.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24struct NameResult
25{
26    NameResult(HANDLE handle)
27    {
28        Handle = handle;
29        Event = CreateEvent(NULL, false, false, NULL);
30    }
31
32    ~NameResult()
33    {
34        CloseHandle(Event);
35    }
36
37    HANDLE Handle;
38    std::wstring Name;
39    HANDLE Event;
40};
41
42struct NameResolutionThreadParams
43{
44    NameResolutionThreadParams()
45    {
46        Semaphore = CreateSemaphore(NULL, 0, 1, NULL);
47    }
48
49    ~NameResolutionThreadParams()
50    {
51        CloseHandle(Semaphore);
52    }
53
54    /// The input/output queue.
55    std::list<NameResult*> Input;
56
57    /// Wait queue
58    HANDLE Semaphore;
59};
60
61struct AutoHandle
62{
63public:
64    AutoHandle(HANDLE handle)
65    {
66        Handle = handle;
67    }
68
69    ~AutoHandle()
70    {
71        CloseHandle(Handle);
72    }
73
74    operator HANDLE&()
75    {
76        return Handle;
77    }
78
79private:
80    HANDLE Handle;
81};
82
83void CreateNameThread(HANDLE& handle, NameResolutionThreadParams& params);
Note: See TracBrowser for help on using the repository browser.