ReactOS 0.4.16-dev-297-gc569aee
info.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Services
4 * FILE: base/services/wkssvc/info.c
5 * PURPOSE: Workstation service
6 * PROGRAMMER: Eric Kohl
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include "precomp.h"
12
14
15/* GLOBALS *******************************************************************/
16
18
19
20/* FUNCTIONS *****************************************************************/
21
22VOID
24{
25 HKEY hInfoKey = NULL;
26 DWORD dwType, dwSize, dwValue;
27 DWORD dwError;
28
30 L"System\\CurrentControlSet\\Services\\LanmanWorkstation\\Parameters",
31 0,
33 &hInfoKey);
34 if (dwError != ERROR_SUCCESS)
35 {
36 ERR("RegOpenKeyExW() failed!\n");
37 return;
38 }
39
40 dwSize = sizeof(dwValue);
41 dwError = RegQueryValueExW(hInfoKey,
42 L"CharWait",
43 0,
44 &dwType,
45 (PBYTE)&dwValue,
46 &dwSize);
47 if ((dwError == ERROR_SUCCESS) && (dwValue <= 65535))
49 else
51
52 dwSize = sizeof(dwValue);
53 dwError = RegQueryValueExW(hInfoKey,
54 L"CollectionTime",
55 0,
56 &dwType,
57 (PBYTE)&dwValue,
58 &dwSize);
59 if ((dwError == ERROR_SUCCESS) && (dwValue <= 65535000))
61 else
63
64 dwSize = sizeof(dwValue);
65 dwError = RegQueryValueExW(hInfoKey,
66 L"MaximumCollectionCount",
67 0,
68 &dwType,
69 (PBYTE)&dwValue,
70 &dwSize);
71 if ((dwError == ERROR_SUCCESS) && (dwValue <= 65535))
73 else
75
76 dwSize = sizeof(dwValue);
77 dwError = RegQueryValueExW(hInfoKey,
78 L"KeepConn",
79 0,
80 &dwType,
81 (PBYTE)&dwValue,
82 &dwSize);
83 if ((dwError == ERROR_SUCCESS) && (dwValue >= 1) && (dwValue <= 65535))
85 else
87
88 dwSize = sizeof(dwValue);
89 dwError = RegQueryValueExW(hInfoKey,
90 L"MaxCmds",
91 0,
92 &dwType,
93 (PBYTE)&dwValue,
94 &dwSize);
95 if ((dwError == ERROR_SUCCESS) && (dwValue >= 50) && (dwValue <= 65535))
97 else
99
100 dwSize = sizeof(dwValue);
101 dwError = RegQueryValueExW(hInfoKey,
102 L"SessTimeout",
103 0,
104 &dwType,
105 (PBYTE)&dwValue,
106 &dwSize);
107 if ((dwError == ERROR_SUCCESS) && (dwValue >= 60) && (dwValue <= 65535))
109 else
111
112
113 dwSize = sizeof(dwValue);
114 dwError = RegQueryValueExW(hInfoKey,
115 L"SizCharBuf",
116 0,
117 &dwType,
118 (PBYTE)&dwValue,
119 &dwSize);
120 if ((dwError == ERROR_SUCCESS) && (dwValue >= 64) && (dwValue <= 4096))
122 else
124
125 dwSize = sizeof(dwValue);
126 dwError = RegQueryValueExW(hInfoKey,
127 L"MaxThreads",
128 0,
129 &dwType,
130 (PBYTE)&dwValue,
131 &dwSize);
132 if ((dwError == ERROR_SUCCESS) && (dwValue >= 1) && (dwValue <= 256))
134 else
136
137 dwSize = sizeof(dwValue);
138 dwError = RegQueryValueExW(hInfoKey,
139 L"LockQuota",
140 0,
141 &dwType,
142 (PBYTE)&dwValue,
143 &dwSize);
144 if (dwError == ERROR_SUCCESS)
146 else
148
149 dwSize = sizeof(dwValue);
150 dwError = RegQueryValueExW(hInfoKey,
151 L"LockQuota",
152 0,
153 &dwType,
154 (PBYTE)&dwValue,
155 &dwSize);
156 if (dwError == ERROR_SUCCESS)
158 else
160
161 dwSize = sizeof(dwValue);
162 dwError = RegQueryValueExW(hInfoKey,
163 L"LockIncrement",
164 0,
165 &dwType,
166 (PBYTE)&dwValue,
167 &dwSize);
168 if (dwError == ERROR_SUCCESS)
170 else
172
173 dwSize = sizeof(dwValue);
174 dwError = RegQueryValueExW(hInfoKey,
175 L"LockMaximum",
176 0,
177 &dwType,
178 (PBYTE)&dwValue,
179 &dwSize);
180 if (dwError == ERROR_SUCCESS)
182 else
184
185 dwSize = sizeof(dwValue);
186 dwError = RegQueryValueExW(hInfoKey,
187 L"PipeIncrement",
188 0,
189 &dwType,
190 (PBYTE)&dwValue,
191 &dwSize);
192 if (dwError == ERROR_SUCCESS)
194 else
196
197 dwSize = sizeof(dwValue);
198 dwError = RegQueryValueExW(hInfoKey,
199 L"PipeMaximum",
200 0,
201 &dwType,
202 (PBYTE)&dwValue,
203 &dwSize);
204 if (dwError == ERROR_SUCCESS)
206 else
208
209 dwSize = sizeof(dwValue);
210 dwError = RegQueryValueExW(hInfoKey,
211 L"CacheFileTimeout",
212 0,
213 &dwType,
214 (PBYTE)&dwValue,
215 &dwSize);
216 if (dwError == ERROR_SUCCESS)
218 else
220
221 dwSize = sizeof(dwValue);
222 dwError = RegQueryValueExW(hInfoKey,
223 L"DormantFileLimit",
224 0,
225 &dwType,
226 (PBYTE)&dwValue,
227 &dwSize);
228 if (dwError == ERROR_SUCCESS && dwValue >= 1)
230 else
232
233 dwSize = sizeof(dwValue);
234 dwError = RegQueryValueExW(hInfoKey,
235 L"ReadAheadThroughput",
236 0,
237 &dwType,
238 (PBYTE)&dwValue,
239 &dwSize);
240 if (dwError == ERROR_SUCCESS)
242 else
244
245 dwSize = sizeof(dwValue);
246 dwError = RegQueryValueExW(hInfoKey,
247 L"MailslotBuffers",
248 0,
249 &dwType,
250 (PBYTE)&dwValue,
251 &dwSize);
252 if (dwError == ERROR_SUCCESS)
254 else
256
257 dwSize = sizeof(dwValue);
258 dwError = RegQueryValueExW(hInfoKey,
259 L"ServerAnnounceBuffers",
260 0,
261 &dwType,
262 (PBYTE)&dwValue,
263 &dwSize);
264 if (dwError == ERROR_SUCCESS)
266 else
268
269 dwSize = sizeof(dwValue);
270 dwError = RegQueryValueExW(hInfoKey,
271 L"NumIllegalDatagramEvents",
272 0,
273 &dwType,
274 (PBYTE)&dwValue,
275 &dwSize);
276 if (dwError == ERROR_SUCCESS)
278 else
280
281 dwSize = sizeof(dwValue);
282 dwError = RegQueryValueExW(hInfoKey,
283 L"IllegalDatagramResetTime",
284 0,
285 &dwType,
286 (PBYTE)&dwValue,
287 &dwSize);
288 if (dwError == ERROR_SUCCESS)
290 else
292
293 dwSize = sizeof(dwValue);
294 dwError = RegQueryValueExW(hInfoKey,
295 L"LogElectionPackets",
296 0,
297 &dwType,
298 (PBYTE)&dwValue,
299 &dwSize);
300 if (dwError == ERROR_SUCCESS)
302 else
304
305 dwSize = sizeof(dwValue);
306 dwError = RegQueryValueExW(hInfoKey,
307 L"UseOpportunisticLocking",
308 0,
309 &dwType,
310 (PBYTE)&dwValue,
311 &dwSize);
312 if (dwError == ERROR_SUCCESS)
314 else
316
317 dwSize = sizeof(dwValue);
318 dwError = RegQueryValueExW(hInfoKey,
319 L"UseUnlockBehind",
320 0,
321 &dwType,
322 (PBYTE)&dwValue,
323 &dwSize);
324 if (dwError == ERROR_SUCCESS)
326 else
328
329 dwError = RegQueryValueExW(hInfoKey,
330 L"UseCloseBehind",
331 0,
332 &dwType,
333 (PBYTE)&dwValue,
334 &dwSize);
335 if (dwError == ERROR_SUCCESS)
337 else
339
340 dwError = RegQueryValueExW(hInfoKey,
341 L"BufNamedPipes",
342 0,
343 &dwType,
344 (PBYTE)&dwValue,
345 &dwSize);
346 if (dwError == ERROR_SUCCESS)
348 else
350
351 dwError = RegQueryValueExW(hInfoKey,
352 L"UseLockReadUnlock",
353 0,
354 &dwType,
355 (PBYTE)&dwValue,
356 &dwSize);
357 if (dwError == ERROR_SUCCESS)
359 else
361
362 dwError = RegQueryValueExW(hInfoKey,
363 L"UtilizeNtCaching",
364 0,
365 &dwType,
366 (PBYTE)&dwValue,
367 &dwSize);
368 if (dwError == ERROR_SUCCESS)
370 else
372
373 dwError = RegQueryValueExW(hInfoKey,
374 L"UseRawRead",
375 0,
376 &dwType,
377 (PBYTE)&dwValue,
378 &dwSize);
379 if (dwError == ERROR_SUCCESS)
381 else
383
384 dwError = RegQueryValueExW(hInfoKey,
385 L"UseRawWrite",
386 0,
387 &dwType,
388 (PBYTE)&dwValue,
389 &dwSize);
390 if (dwError == ERROR_SUCCESS)
392 else
394
395 dwError = RegQueryValueExW(hInfoKey,
396 L"UseWriteRawData",
397 0,
398 &dwType,
399 (PBYTE)&dwValue,
400 &dwSize);
401 if (dwError == ERROR_SUCCESS)
403 else
405
406 dwError = RegQueryValueExW(hInfoKey,
407 L"UseEncryption",
408 0,
409 &dwType,
410 (PBYTE)&dwValue,
411 &dwSize);
412 if (dwError == ERROR_SUCCESS)
414 else
416
417 dwError = RegQueryValueExW(hInfoKey,
418 L"BufFilesDenyWrite",
419 0,
420 &dwType,
421 (PBYTE)&dwValue,
422 &dwSize);
423 if (dwError == ERROR_SUCCESS)
425 else
427
428 dwError = RegQueryValueExW(hInfoKey,
429 L"BufReadOnlyFiles",
430 0,
431 &dwType,
432 (PBYTE)&dwValue,
433 &dwSize);
434 if (dwError == ERROR_SUCCESS)
436 else
438
439 dwError = RegQueryValueExW(hInfoKey,
440 L"ForceCoreCreateMode",
441 0,
442 &dwType,
443 (PBYTE)&dwValue,
444 &dwSize);
445 if (dwError == ERROR_SUCCESS)
447 else
449
450 dwError = RegQueryValueExW(hInfoKey,
451 L"Use512ByteMaxTransfer",
452 0,
453 &dwType,
454 (PBYTE)&dwValue,
455 &dwSize);
456 if (dwError == ERROR_SUCCESS)
458 else
460
461 RegCloseKey(hInfoKey);
462}
463
464
465VOID
468{
469 HKEY hInfoKey = NULL;
470 DWORD dwError;
471
473 L"System\\CurrentControlSet\\Services\\LanmanWorkstation\\Parameters",
474 0,
475 KEY_WRITE,
476 &hInfoKey);
477 if (dwError != ERROR_SUCCESS)
478 {
479 ERR("RegOpenKeyExW() failed!\n");
480 return;
481 }
482
483 switch (Level)
484 {
485 case 502:
486 RegSetValueExW(hInfoKey,
487 L"CharWait",
488 0,
489 REG_DWORD,
491 sizeof(DWORD));
492
493 RegSetValueExW(hInfoKey,
494 L"CollectionTime",
495 0,
496 REG_DWORD,
498 sizeof(DWORD));
499
500 RegSetValueExW(hInfoKey,
501 L"MaximumCollectionCount",
502 0,
503 REG_DWORD,
505 sizeof(DWORD));
506
507 RegSetValueExW(hInfoKey,
508 L"KeepConn",
509 0,
510 REG_DWORD,
512 sizeof(DWORD));
513
514 RegSetValueExW(hInfoKey,
515 L"MaxCmds",
516 0,
517 REG_DWORD,
519 sizeof(DWORD));
520
521 RegSetValueExW(hInfoKey,
522 L"SessTimeout",
523 0,
524 REG_DWORD,
526 sizeof(DWORD));
527
528 RegSetValueExW(hInfoKey,
529 L"SizCharBuf",
530 0,
531 REG_DWORD,
533 sizeof(DWORD));
534
535 RegSetValueExW(hInfoKey,
536 L"MaxThreads",
537 0,
538 REG_DWORD,
540 sizeof(DWORD));
541
542 RegSetValueExW(hInfoKey,
543 L"LockQuota",
544 0,
545 REG_DWORD,
547 sizeof(DWORD));
548
549 RegSetValueExW(hInfoKey,
550 L"LockIncrement",
551 0,
552 REG_DWORD,
554 sizeof(DWORD));
555
556 RegSetValueExW(hInfoKey,
557 L"LockMaximum",
558 0,
559 REG_DWORD,
561 sizeof(DWORD));
562
563 RegSetValueExW(hInfoKey,
564 L"PipeIncrement",
565 0,
566 REG_DWORD,
568 sizeof(DWORD));
569
570 RegSetValueExW(hInfoKey,
571 L"PipeMaximum",
572 0,
573 REG_DWORD,
575 sizeof(DWORD));
576
577 RegSetValueExW(hInfoKey,
578 L"CacheFileTimeout",
579 0,
580 REG_DWORD,
582 sizeof(DWORD));
583
584 RegSetValueExW(hInfoKey,
585 L"DormantFileLimit",
586 0,
587 REG_DWORD,
589 sizeof(DWORD));
590
591 RegSetValueExW(hInfoKey,
592 L"ReadAheadThroughput",
593 0,
594 REG_DWORD,
596 sizeof(DWORD));
597
598 RegSetValueExW(hInfoKey,
599 L"MailslotBuffers",
600 0,
601 REG_DWORD,
603 sizeof(DWORD));
604
605 RegSetValueExW(hInfoKey,
606 L"ServerAnnounceBuffers",
607 0,
608 REG_DWORD,
610 sizeof(DWORD));
611
612 RegSetValueExW(hInfoKey,
613 L"NumIllegalDatagramEvents",
614 0,
615 REG_DWORD,
617 sizeof(DWORD));
618
619 RegSetValueExW(hInfoKey,
620 L"IllegalDatagramResetTime",
621 0,
622 REG_DWORD,
624 sizeof(DWORD));
625
626 RegSetValueExW(hInfoKey,
627 L"LogElectionPackets",
628 0,
629 REG_DWORD,
631 sizeof(BOOL));
632
633 RegSetValueExW(hInfoKey,
634 L"UseOpportunisticLocking",
635 0,
636 REG_DWORD,
638 sizeof(BOOL));
639
640 RegSetValueExW(hInfoKey,
641 L"UseUnlockBehind",
642 0,
643 REG_DWORD,
645 sizeof(BOOL));
646
647 RegSetValueExW(hInfoKey,
648 L"UseCloseBehind",
649 0,
650 REG_DWORD,
652 sizeof(BOOL));
653
654 RegSetValueExW(hInfoKey,
655 L"BufNamedPipes",
656 0,
657 REG_DWORD,
659 sizeof(BOOL));
660
661 RegSetValueExW(hInfoKey,
662 L"UseLockReadUnlock",
663 0,
664 REG_DWORD,
666 sizeof(BOOL));
667
668 RegSetValueExW(hInfoKey,
669 L"UtilizeNtCaching",
670 0,
671 REG_DWORD,
673 sizeof(BOOL));
674
675 RegSetValueExW(hInfoKey,
676 L"UseRawRead",
677 0,
678 REG_DWORD,
680 sizeof(BOOL));
681
682 RegSetValueExW(hInfoKey,
683 L"UseRawWrite",
684 0,
685 REG_DWORD,
687 sizeof(BOOL));
688
689 RegSetValueExW(hInfoKey,
690 L"UseWriteRawData",
691 0,
692 REG_DWORD,
694 sizeof(BOOL));
695
696 RegSetValueExW(hInfoKey,
697 L"UseEncryption",
698 0,
699 REG_DWORD,
701 sizeof(BOOL));
702
703 RegSetValueExW(hInfoKey,
704 L"BufFilesDenyWrite",
705 0,
706 REG_DWORD,
708 sizeof(BOOL));
709
710 RegSetValueExW(hInfoKey,
711 L"BufReadOnlyFiles",
712 0,
713 REG_DWORD,
715 sizeof(BOOL));
716
717 RegSetValueExW(hInfoKey,
718 L"ForceCoreCreateMode",
719 0,
720 REG_DWORD,
722 sizeof(BOOL));
723
724 RegSetValueExW(hInfoKey,
725 L"Use512ByteMaxTransfer",
726 0,
727 REG_DWORD,
729 sizeof(BOOL));
730 break;
731
732 case 1013:
733 RegSetValueExW(hInfoKey,
734 L"KeepConn",
735 0,
736 REG_DWORD,
738 sizeof(DWORD));
739 break;
740
741 case 1018:
742 RegSetValueExW(hInfoKey,
743 L"SessTimeout",
744 0,
745 REG_DWORD,
747 sizeof(DWORD));
748 break;
749
750 case 1046:
751 RegSetValueExW(hInfoKey,
752 L"DormantFileLimit",
753 0,
754 REG_DWORD,
756 sizeof(DWORD));
757 break;
758 }
759
760 RegCloseKey(hInfoKey);
761}
762
763/* EOF */
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
VOID SaveWorkstationInfo(_In_ DWORD Level)
Definition: info.c:466
VOID InitWorkstationInfo(VOID)
Definition: info.c:23
WKSTA_INFO_502 WkstaInfo502
Definition: info.c:17
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define _In_
Definition: no_sal2.h:158
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
#define REG_DWORD
Definition: sdbapi.c:596
DWORD wki502_dormant_file_limit
Definition: lmwksta.h:148
DWORD wki502_illegal_datagram_event_reset_frequency
Definition: lmwksta.h:153
BOOL wki502_use_opportunistic_locking
Definition: lmwksta.h:155
DWORD wki502_pipe_increment
Definition: lmwksta.h:145
DWORD wki502_char_wait
Definition: lmwksta.h:134
BOOL wki502_use_raw_write
Definition: lmwksta.h:162
DWORD wki502_lock_maximum
Definition: lmwksta.h:144
DWORD wki502_cache_file_timeout
Definition: lmwksta.h:147
DWORD wki502_keep_conn
Definition: lmwksta.h:137
DWORD wki502_num_mailslot_buffers
Definition: lmwksta.h:150
BOOL wki502_force_core_create_mode
Definition: lmwksta.h:167
BOOL wki502_buf_named_pipes
Definition: lmwksta.h:158
BOOL wki502_utilize_nt_caching
Definition: lmwksta.h:160
BOOL wki502_use_close_behind
Definition: lmwksta.h:157
BOOL wki502_use_encryption
Definition: lmwksta.h:164
DWORD wki502_read_ahead_throughput
Definition: lmwksta.h:149
DWORD wki502_num_srv_announce_buffers
Definition: lmwksta.h:151
BOOL wki502_buf_read_only_files
Definition: lmwksta.h:166
DWORD wki502_siz_char_buf
Definition: lmwksta.h:140
BOOL wki502_use_unlock_behind
Definition: lmwksta.h:156
DWORD wki502_collection_time
Definition: lmwksta.h:135
BOOL wki502_use_512_byte_max_transfer
Definition: lmwksta.h:168
DWORD wki502_sess_timeout
Definition: lmwksta.h:139
BOOL wki502_log_election_packets
Definition: lmwksta.h:154
DWORD wki502_max_illegal_datagram_events
Definition: lmwksta.h:152
DWORD wki502_maximum_collection_count
Definition: lmwksta.h:136
BOOL wki502_use_raw_read
Definition: lmwksta.h:161
DWORD wki502_lock_increment
Definition: lmwksta.h:143
BOOL wki502_use_write_raw_data
Definition: lmwksta.h:163
BOOL wki502_buf_files_deny_write
Definition: lmwksta.h:165
DWORD wki502_max_cmds
Definition: lmwksta.h:138
DWORD wki502_pipe_maximum
Definition: lmwksta.h:146
DWORD wki502_lock_quota
Definition: lmwksta.h:142
DWORD wki502_max_threads
Definition: lmwksta.h:141
BOOL wki502_use_lock_read_unlock
Definition: lmwksta.h:159
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56