[WKSSVC] Implement undocumented NetrWkstaGetInfo Level 502 and NetrWkstaSetInfo

- Provide default Level 502 data only.
- Level 502 data need to be stored in the Registry.
This commit is contained in:
Eric Kohl 2024-10-23 23:48:01 +02:00
parent 3ddb05d443
commit 51b55982e4
5 changed files with 192 additions and 3 deletions

View file

@ -5,6 +5,7 @@ spec2def(wkssvc.dll wkssvc.spec ADD_IMPORTLIB)
add_library(wkssvc MODULE
domain.c
info.c
rpcserver.c
wkssvc.c
wkssvc.rc

View file

@ -0,0 +1,62 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Services
* FILE: base/services/wkssvc/info.c
* PURPOSE: Workstation service
* PROGRAMMER: Eric Kohl
*/
/* INCLUDES *****************************************************************/
#include "precomp.h"
WINE_DEFAULT_DEBUG_CHANNEL(wkssvc);
/* GLOBALS *******************************************************************/
WKSTA_INFO_502 WkstaInfo502;
/* FUNCTIONS *****************************************************************/
VOID
InitWorkstationInfo(VOID)
{
WkstaInfo502.wki502_char_wait = 0;
WkstaInfo502.wki502_collection_time = 250;
WkstaInfo502.wki502_maximum_collection_count = 16;
WkstaInfo502.wki502_keep_conn = 600;
WkstaInfo502.wki502_max_cmds = 50;
WkstaInfo502.wki502_sess_timeout = 60;
WkstaInfo502.wki502_siz_char_buf = 512;
WkstaInfo502.wki502_max_threads = 17;
WkstaInfo502.wki502_lock_quota = 6144;
WkstaInfo502.wki502_lock_increment = 10;
WkstaInfo502.wki502_lock_maximum = 500;
WkstaInfo502.wki502_pipe_increment = 10;
WkstaInfo502.wki502_pipe_maximum = 500;
WkstaInfo502.wki502_cache_file_timeout = 40;
WkstaInfo502.wki502_dormant_file_limit = 0; /* 1 */
WkstaInfo502.wki502_read_ahead_throughput = 0;
WkstaInfo502.wki502_num_mailslot_buffers = 3;
WkstaInfo502.wki502_num_srv_announce_buffers = 20;
WkstaInfo502.wki502_max_illegal_datagram_events = 5;
WkstaInfo502.wki502_illegal_datagram_event_reset_frequency = 3600;
WkstaInfo502.wki502_log_election_packets = 0;
WkstaInfo502.wki502_use_opportunistic_locking = 1;
WkstaInfo502.wki502_use_unlock_behind = 1;
WkstaInfo502.wki502_use_close_behind = 1;
WkstaInfo502.wki502_buf_named_pipes = 1;
WkstaInfo502.wki502_use_lock_read_unlock = 1;
WkstaInfo502.wki502_utilize_nt_caching = 1;
WkstaInfo502.wki502_use_raw_read = 1;
WkstaInfo502.wki502_use_raw_write = 1;
WkstaInfo502.wki502_use_write_raw_data = 0;
WkstaInfo502.wki502_use_encryption = 1;
WkstaInfo502.wki502_buf_files_deny_write = 0;
WkstaInfo502.wki502_buf_read_only_files = 0;
WkstaInfo502.wki502_force_core_create_mode = 0;
WkstaInfo502.wki502_use_512_byte_max_transfer = 0;
}
/* EOF */

View file

@ -22,10 +22,18 @@
#include <wine/debug.h>
#define WKSTA_KEEPCONN_PARMNUM 13
#define WKSTA_MAXCMDS_PARMNUM 15
#define WKSTA_SESSTIMEOUT_PARMNUM 18
#define WKSTA_DORMANTFILELIMIT_PARMNUM 46
extern OSVERSIONINFOW VersionInfo;
extern HANDLE LsaHandle;
extern ULONG LsaAuthenticationPackage;
extern WKSTA_INFO_502 WkstaInfo502;
/* domain.c */
NET_API_STATUS
@ -37,6 +45,10 @@ NetpGetJoinInformation(
LPWSTR *NameBuffer,
PNETSETUP_JOIN_STATUS BufferType);
/* info */
VOID
InitWorkstationInfo(VOID);
/* rpcserver.c */

View file

@ -208,8 +208,21 @@ NetrWkstaGetInfo(
*WkstaInfo = pWkstaInfo;
break;
case 502:
pWkstaInfo = midl_user_allocate(sizeof(WKSTA_INFO_502));
if (pWkstaInfo == NULL)
{
dwResult = ERROR_NOT_ENOUGH_MEMORY;
break;
}
CopyMemory(&pWkstaInfo->WkstaInfo502, &WkstaInfo502, sizeof(WKSTA_INFO_502));
*WkstaInfo = pWkstaInfo;
break;
default:
FIXME("Level %d unimplemented\n", Level);
FIXME("Level %lu unimplemented\n", Level);
dwResult = ERROR_INVALID_LEVEL;
break;
}
@ -230,8 +243,107 @@ NetrWkstaSetInfo(
LPWKSTA_INFO WkstaInfo,
unsigned long *ErrorParameter)
{
UNIMPLEMENTED;
return 0;
DWORD dwResult = NERR_Success;
TRACE("NetrWkstaSetInfo(%lu %p %p)\n",
Level, WkstaInfo, ErrorParameter);
switch (Level)
{
case 502:
if (WkstaInfo->WkstaInfo502.wki502_keep_conn >= 1 && WkstaInfo->WkstaInfo502.wki502_keep_conn <= 65535)
{
WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo502.wki502_keep_conn;
if (WkstaInfo->WkstaInfo502.wki502_max_cmds >= 50 && WkstaInfo->WkstaInfo502.wki502_max_cmds <= 65535)
{
WkstaInfo502.wki502_max_cmds = WkstaInfo->WkstaInfo502.wki502_max_cmds;
if (WkstaInfo->WkstaInfo502.wki502_sess_timeout >= 60 && WkstaInfo->WkstaInfo502.wki502_sess_timeout <= 65535)
{
WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo502.wki502_sess_timeout;
if (WkstaInfo->WkstaInfo502.wki502_dormant_file_limit != 0)
{
WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo502.wki502_dormant_file_limit;
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_MAXCMDS_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
break;
case 1013:
if (WkstaInfo->WkstaInfo1013.wki1013_keep_conn >= 1 && WkstaInfo->WkstaInfo1013.wki1013_keep_conn <= 65535)
{
WkstaInfo502.wki502_keep_conn = WkstaInfo->WkstaInfo1013.wki1013_keep_conn;
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_KEEPCONN_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
break;
case 1018:
if (WkstaInfo->WkstaInfo1018.wki1018_sess_timeout >= 60 && WkstaInfo->WkstaInfo1018.wki1018_sess_timeout <= 65535)
{
WkstaInfo502.wki502_sess_timeout = WkstaInfo->WkstaInfo1018.wki1018_sess_timeout;
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_SESSTIMEOUT_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
break;
case 1046:
if (WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit != 0)
{
WkstaInfo502.wki502_dormant_file_limit = WkstaInfo->WkstaInfo1046.wki1046_dormant_file_limit;
}
else
{
if (ErrorParameter)
*ErrorParameter = WKSTA_DORMANTFILELIMIT_PARMNUM;
dwResult = ERROR_INVALID_PARAMETER;
}
break;
default:
FIXME("Level %lu unimplemented\n", Level);
dwResult = ERROR_INVALID_LEVEL;
break;
}
/* FIXME: Store the workstation info in the registry */
return dwResult;
}

View file

@ -85,6 +85,8 @@ ServiceInit(VOID)
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
GetVersionExW(&VersionInfo);
InitWorkstationInfo();
Status = LsaRegisterLogonProcess(&ProcessName,
&LsaHandle,
&Mode);