https://git.reactos.org/?p=reactos.git;a=commitdiff;h=51b55982e4cb7dfbd396a…
commit 51b55982e4cb7dfbd396a94aee3929f03f73f63b
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Wed Oct 23 23:48:01 2024 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Wed Oct 23 23:48:33 2024 +0200
[WKSSVC] Implement undocumented NetrWkstaGetInfo Level 502 and NetrWkstaSetInfo
- Provide default Level 502 data only.
- Level 502 data need to be stored in the Registry.
---
base/services/wkssvc/CMakeLists.txt | 1 +
base/services/wkssvc/info.c | 62 +++++++++++++++++++
base/services/wkssvc/precomp.h | 12 ++++
base/services/wkssvc/rpcserver.c | 118 +++++++++++++++++++++++++++++++++++-
base/services/wkssvc/wkssvc.c | 2 +
5 files changed, 192 insertions(+), 3 deletions(-)
diff --git a/base/services/wkssvc/CMakeLists.txt b/base/services/wkssvc/CMakeLists.txt
index 8ce12e206bb..2bdaa71b1e0 100644
--- a/base/services/wkssvc/CMakeLists.txt
+++ b/base/services/wkssvc/CMakeLists.txt
@@ -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
diff --git a/base/services/wkssvc/info.c b/base/services/wkssvc/info.c
new file mode 100644
index 00000000000..0cca6b7e788
--- /dev/null
+++ b/base/services/wkssvc/info.c
@@ -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 */
diff --git a/base/services/wkssvc/precomp.h b/base/services/wkssvc/precomp.h
index ac6d6e8d0c7..6c1622d0e65 100644
--- a/base/services/wkssvc/precomp.h
+++ b/base/services/wkssvc/precomp.h
@@ -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 */
diff --git a/base/services/wkssvc/rpcserver.c b/base/services/wkssvc/rpcserver.c
index d95cab57e94..f8e3655e099 100644
--- a/base/services/wkssvc/rpcserver.c
+++ b/base/services/wkssvc/rpcserver.c
@@ -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;
}
diff --git a/base/services/wkssvc/wkssvc.c b/base/services/wkssvc/wkssvc.c
index dbb485f5a6e..d286cf0216d 100644
--- a/base/services/wkssvc/wkssvc.c
+++ b/base/services/wkssvc/wkssvc.c
@@ -85,6 +85,8 @@ ServiceInit(VOID)
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
GetVersionExW(&VersionInfo);
+ InitWorkstationInfo();
+
Status = LsaRegisterLogonProcess(&ProcessName,
&LsaHandle,
&Mode);