Skip to content

Commit 51b5598

Browse files
committed
[WKSSVC] Implement undocumented NetrWkstaGetInfo Level 502 and NetrWkstaSetInfo
- Provide default Level 502 data only. - Level 502 data need to be stored in the Registry.
1 parent 3ddb05d commit 51b5598

File tree

5 files changed

+192
-3
lines changed

5 files changed

+192
-3
lines changed

base/services/wkssvc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ spec2def(wkssvc.dll wkssvc.spec ADD_IMPORTLIB)
55

66
add_library(wkssvc MODULE
77
domain.c
8+
info.c
89
rpcserver.c
910
wkssvc.c
1011
wkssvc.rc

base/services/wkssvc/info.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
13+
WINE_DEFAULT_DEBUG_CHANNEL(wkssvc);
14+
15+
/* GLOBALS *******************************************************************/
16+
17+
WKSTA_INFO_502 WkstaInfo502;
18+
19+
20+
/* FUNCTIONS *****************************************************************/
21+
22+
VOID
23+
InitWorkstationInfo(VOID)
24+
{
25+
WkstaInfo502.wki502_char_wait = 0;
26+
WkstaInfo502.wki502_collection_time = 250;
27+
WkstaInfo502.wki502_maximum_collection_count = 16;
28+
WkstaInfo502.wki502_keep_conn = 600;
29+
WkstaInfo502.wki502_max_cmds = 50;
30+
WkstaInfo502.wki502_sess_timeout = 60;
31+
WkstaInfo502.wki502_siz_char_buf = 512;
32+
WkstaInfo502.wki502_max_threads = 17;
33+
WkstaInfo502.wki502_lock_quota = 6144;
34+
WkstaInfo502.wki502_lock_increment = 10;
35+
WkstaInfo502.wki502_lock_maximum = 500;
36+
WkstaInfo502.wki502_pipe_increment = 10;
37+
WkstaInfo502.wki502_pipe_maximum = 500;
38+
WkstaInfo502.wki502_cache_file_timeout = 40;
39+
WkstaInfo502.wki502_dormant_file_limit = 0; /* 1 */
40+
WkstaInfo502.wki502_read_ahead_throughput = 0;
41+
WkstaInfo502.wki502_num_mailslot_buffers = 3;
42+
WkstaInfo502.wki502_num_srv_announce_buffers = 20;
43+
WkstaInfo502.wki502_max_illegal_datagram_events = 5;
44+
WkstaInfo502.wki502_illegal_datagram_event_reset_frequency = 3600;
45+
WkstaInfo502.wki502_log_election_packets = 0;
46+
WkstaInfo502.wki502_use_opportunistic_locking = 1;
47+
WkstaInfo502.wki502_use_unlock_behind = 1;
48+
WkstaInfo502.wki502_use_close_behind = 1;
49+
WkstaInfo502.wki502_buf_named_pipes = 1;
50+
WkstaInfo502.wki502_use_lock_read_unlock = 1;
51+
WkstaInfo502.wki502_utilize_nt_caching = 1;
52+
WkstaInfo502.wki502_use_raw_read = 1;
53+
WkstaInfo502.wki502_use_raw_write = 1;
54+
WkstaInfo502.wki502_use_write_raw_data = 0;
55+
WkstaInfo502.wki502_use_encryption = 1;
56+
WkstaInfo502.wki502_buf_files_deny_write = 0;
57+
WkstaInfo502.wki502_buf_read_only_files = 0;
58+
WkstaInfo502.wki502_force_core_create_mode = 0;
59+
WkstaInfo502.wki502_use_512_byte_max_transfer = 0;
60+
}
61+
62+
/* EOF */

base/services/wkssvc/precomp.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@
2222

2323
#include <wine/debug.h>
2424

25+
#define WKSTA_KEEPCONN_PARMNUM 13
26+
#define WKSTA_MAXCMDS_PARMNUM 15
27+
#define WKSTA_SESSTIMEOUT_PARMNUM 18
28+
#define WKSTA_DORMANTFILELIMIT_PARMNUM 46
29+
2530
extern OSVERSIONINFOW VersionInfo;
2631
extern HANDLE LsaHandle;
2732
extern ULONG LsaAuthenticationPackage;
2833

34+
extern WKSTA_INFO_502 WkstaInfo502;
35+
36+
2937
/* domain.c */
3038

3139
NET_API_STATUS
@@ -37,6 +45,10 @@ NetpGetJoinInformation(
3745
LPWSTR *NameBuffer,
3846
PNETSETUP_JOIN_STATUS BufferType);
3947

48+
/* info */
49+
50+
VOID
51+
InitWorkstationInfo(VOID);
4052

4153
/* rpcserver.c */
4254

base/services/wkssvc/rpcserver.c

Lines changed: 115 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,21 @@ NetrWkstaGetInfo(
208208
*WkstaInfo = pWkstaInfo;
209209
break;
210210

211+
case 502:
212+
pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_502));
213+
if (pWkstaInfo == NULL)
214+
{
215+
dwResult = ERROR_NOT_ENOUGH_MEMORY;
216+
break;
217+
}
218+
219+
CopyMemory(&pWkstaInfo->WkstaInfo502, &WkstaInfo502, sizeof(WKSTA_INFO_502));
220+
221+
*WkstaInfo = pWkstaInfo;
222+
break;
223+
211224
default:
212-
FIXME("Level %d unimplemented\n", Level);
225+
FIXME("Level %lu unimplemented\n", Level);
213226
dwResult = ERROR_INVALID_LEVEL;
214227
break;
215228
}
@@ -230,8 +243,107 @@ NetrWkstaSetInfo(
230243
LPWKSTA_INFO WkstaInfo,
231244
unsigned long *ErrorParameter)
232245
{
233-
UNIMPLEMENTED;
234-
return 0;
246+
DWORD dwResult = NERR_Success;
247+
248+
TRACE("NetrWkstaSetInfo(%lu %p %p)\n",
249+
Level, WkstaInfo, ErrorParameter);
250+
251+
switch (Level)
252+
{
253+
case 502:
254+
if (WkstaInfo->WkstaInfo502.wki502_keep_conn >= 1 && WkstaInfo->WkstaInfo502.wki502_keep_conn <= 65535)
255+
{
256+
WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo502.wki502_keep_conn;
257+
258+
if (WkstaInfo->WkstaInfo502.wki502_max_cmds >= 50 && WkstaInfo->WkstaInfo502.wki502_max_cmds <= 65535)
259+
{
260+
WkstaInfo502.wki502_max_cmds = WkstaInfo->WkstaInfo502.wki502_max_cmds;
261+
262+
if (WkstaInfo->WkstaInfo502.wki502_sess_timeout >= 60 && WkstaInfo->WkstaInfo502.wki502_sess_timeout <= 65535)
263+
{
264+
WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo502.wki502_sess_timeout;
265+
266+
if (WkstaInfo->WkstaInfo502.wki502_dormant_file_limit != 0)
267+
{
268+
WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo502.wki502_dormant_file_limit;
269+
}
270+
else
271+
{
272+
if (ErrorParameter)
273+
*ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
274+
dwResult = ERROR_INVALID_PARAMETER;
275+
}
276+
}
277+
else
278+
{
279+
if (ErrorParameter)
280+
*ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
281+
dwResult = ERROR_INVALID_PARAMETER;
282+
}
283+
}
284+
else
285+
{
286+
if (ErrorParameter)
287+
*ErrorParameter = WKSTA_MAXCMDS_PARMNUM;
288+
dwResult = ERROR_INVALID_PARAMETER;
289+
}
290+
}
291+
else
292+
{
293+
if (ErrorParameter)
294+
*ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
295+
dwResult = ERROR_INVALID_PARAMETER;
296+
}
297+
break;
298+
299+
case 1013:
300+
if (WkstaInfo->WkstaInfo1013.wki1013_keep_conn >= 1 && WkstaInfo->WkstaInfo1013.wki1013_keep_conn <= 65535)
301+
{
302+
WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo1013.wki1013_keep_conn;
303+
}
304+
else
305+
{
306+
if (ErrorParameter)
307+
*ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
308+
dwResult = ERROR_INVALID_PARAMETER;
309+
}
310+
break;
311+
312+
case 1018:
313+
if (WkstaInfo->WkstaInfo1018.wki1018_sess_timeout >= 60 && WkstaInfo->WkstaInfo1018.wki1018_sess_timeout <= 65535)
314+
{
315+
WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo1018.wki1018_sess_timeout;
316+
}
317+
else
318+
{
319+
if (ErrorParameter)
320+
*ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
321+
dwResult = ERROR_INVALID_PARAMETER;
322+
}
323+
break;
324+
325+
case 1046:
326+
if (WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit != 0)
327+
{
328+
WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit;
329+
}
330+
else
331+
{
332+
if (ErrorParameter)
333+
*ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
334+
dwResult = ERROR_INVALID_PARAMETER;
335+
}
336+
break;
337+
338+
default:
339+
FIXME("Level %lu unimplemented\n", Level);
340+
dwResult = ERROR_INVALID_LEVEL;
341+
break;
342+
}
343+
344+
/* FIXME: Store the workstation info in the registry */
345+
346+
return dwResult;
235347
}
236348

237349

base/services/wkssvc/wkssvc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ ServiceInit(VOID)
8585
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
8686
GetVersionExW(&VersionInfo);
8787

88+
InitWorkstationInfo();
89+
8890
Status = LsaRegisterLogonProcess(&ProcessName,
8991
&LsaHandle,
9092
&Mode);

0 commit comments

Comments
 (0)