5 |
|
// Windows Finger Daemon |
6 |
|
|
7 |
|
#include <windows.h> |
8 |
– |
#include <tchar.h> |
9 |
– |
#include <signal.h> |
10 |
– |
#include <wtsapi32.h> |
8 |
|
#include <lm.h> |
9 |
+ |
#include <signal.h> |
10 |
+ |
#include <tchar.h> |
11 |
|
#include <shlobj.h> |
12 |
+ |
#include <wtsapi32.h> |
13 |
|
|
14 |
|
#include <algorithm> |
15 |
< |
#include <iostream> |
15 |
> |
#include <cctype> |
16 |
> |
#include <cwctype> |
17 |
> |
#include <fstream> |
18 |
|
#include <iomanip> |
19 |
< |
#include <string> |
19 |
> |
#include <iostream> |
20 |
> |
#include <map> |
21 |
|
#include <sstream> |
22 |
+ |
#include <string> |
23 |
|
#include <vector> |
20 |
– |
#include <map> |
21 |
– |
#include <cwctype> |
24 |
|
|
25 |
|
std::ostream &operator<<(std::ostream &out, WTS_CONNECTSTATE_CLASS status) |
26 |
|
{ |
146 |
|
{ |
147 |
|
for (std::multimap<std::string, Login>::const_iterator login(logins.begin()); login != logins.end(); login = logins.upper_bound(login->first)) |
148 |
|
{ |
149 |
< |
stream << "Login: " << login->first << std::string(33 - login->first.size(), ' ') << "Name: " << login->second.GetName() << "\r\nDirectory: " << login->second.GetDirectory() << "\r\n"; |
149 |
> |
if (login != logins.begin()) |
150 |
> |
stream << "\r\n"; |
151 |
> |
|
152 |
> |
std::string directory(login->second.GetDirectory()); |
153 |
> |
|
154 |
> |
stream << "Login: " << login->first << std::string(33 - login->first.size(), ' ') << "Name: " << login->second.GetName() << "\r\nDirectory: " << directory << "\r\n"; |
155 |
> |
|
156 |
> |
for (std::multimap<std::string, Login>::const_iterator login_(logins.lower_bound(login->first)); login_ != logins.upper_bound(login->first); ++login_) |
157 |
> |
stream << login_->second.status << ' ' << login_->second.session << ' ' << login_->second.id << "\r\n"; |
158 |
> |
|
159 |
> |
std::string files[] = { "\\.project", "\\.plan" }; |
160 |
> |
|
161 |
> |
for (std::string *file(files); file != files + sizeof (files) / sizeof (*file); ++file) |
162 |
> |
{ |
163 |
> |
file->insert(0, directory); |
164 |
> |
|
165 |
> |
std::ifstream in(file->c_str()); |
166 |
> |
|
167 |
> |
if (!in.is_open()) |
168 |
> |
continue; |
169 |
> |
|
170 |
> |
switch (file - files) |
171 |
> |
{ |
172 |
> |
case 0: |
173 |
> |
stream << "Project:\r\n"; |
174 |
> |
|
175 |
> |
break; |
176 |
> |
case 1: |
177 |
> |
stream << "Plan:\r\n"; |
178 |
> |
} |
179 |
> |
|
180 |
> |
std::string buffer; |
181 |
> |
|
182 |
> |
while (std::getline(in, buffer)) |
183 |
> |
stream << buffer << std::endl; |
184 |
> |
} |
185 |
|
} |
186 |
|
} |
187 |
|
|