From 5c1654cc2153c47046b9fd5a02f4d50f692fbcaf Mon Sep 17 00:00:00 2001 From: NtAlexio2 Date: Sat, 2 Dec 2023 00:19:06 +0330 Subject: [PATCH 1/2] update README.md to add MS-SRVS --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94f0341fa..6b867f043 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ However, each test suite provides users with a useful indication of interoperabi * **SMBD Server Test Suite**. It is designed to test the implementations of SMB2&3 direct (RDMA) protocol, as specified in [MS-SMBD] and [MS-SMB2]. * **Branch Cache Test Suite**. It is designed to test the implementations of [MS-PCCRTP], [MS-PCCRR], [MS-PCHC] and [MS-PCCRC] protocol. * **AZOD Test Suite**. It is designed to test the implementations of [MS-AZOD] protocol. -* **ADFamily Test Suite**. It is designed to test the implementations of the Active Directory protocols including [MS-ADA1], [MS-ADA2], [MS-ADA3], [MS-ADLS], [MS-ADSC], [MS-ADTS], [MS-APDS], [MS-DRSR], [MS-FRS2], [MS-LSAD], [MS-LSAT], [MS-SAMR] and [MS-NRPC]. +* **ADFamily Test Suite**. It is designed to test the implementations of the Active Directory protocols including [MS-ADA1], [MS-ADA2], [MS-ADA3], [MS-ADLS], [MS-ADSC], [MS-ADTS], [MS-APDS], [MS-DRSR], [MS-FRS2], [MS-LSAD], [MS-LSAT], [MS-SAMR], [MS-NRPC] and [MS-SRVS]. * **ADFSPIP Client Test Suite**. It is designed to test the implementations of ADFS Proxy and Web Application Proxy integration, as described in [MS-ADFSPIP]. * **ADOD Test Suite**. It is designed to test the implementations of [MS-ADOD] protocol. From e455b1d229506776570086391ef053af0e91124e Mon Sep 17 00:00:00 2001 From: NtAlexio2 Date: Sat, 2 Dec 2023 00:20:43 +0330 Subject: [PATCH 2/2] Add NetrShareAdd() function to ms-srvs --- ProtoSDK/MS-SRVS/SrvsClient.cs | 49 +++++++++++++++++++++++++++++++++ ProtoSDK/MS-SRVS/SrvsMessage.cs | 1 + 2 files changed, 50 insertions(+) diff --git a/ProtoSDK/MS-SRVS/SrvsClient.cs b/ProtoSDK/MS-SRVS/SrvsClient.cs index 8c4cd77df..dc89ba5ec 100644 --- a/ProtoSDK/MS-SRVS/SrvsClient.cs +++ b/ProtoSDK/MS-SRVS/SrvsClient.cs @@ -106,6 +106,55 @@ public void UnBind() } } + /// + /// The NetrShareAdd method creates a new share on the specified server. + /// + /// A string that identifies the server. If this parameter is NULL, the local computer is used. + /// An enumeration representing the level of information provided in the InfoStruct parameter. + /// A structure containing information about the share being added. + /// A pointer to a value that receives error information if the method fails. If the method returns a nonzero error code, + /// ParmErr receives additional error details; otherwise, it remains unchanged. + /// The method returns 0x00000000 (NERR_Success) to indicate success; otherwise, it returns a nonzero error code. + public uint NetrShareAdd( + string ServerName, + SHARE_ENUM_STRUCT_LEVEL Level, + SHARE_INFO InfoStruct, + ref uint? ParmErr) + { + /* NET_API_STATUS NetrShareAdd( + [in, string, unique] SRVSVC_HANDLE ServerName, + [in] DWORD Level, + [in, switch_is(Level)] LPSHARE_INFO InfoStruct, + [in, out, unique] DWORD* ParmErr + ); + */ + + Int3264[] paramList; + uint retVal = 0; + + using (SafeIntPtr pServerName = Marshal.StringToHGlobalUni(ServerName), + pShareInfo = TypeMarshal.ToIntPtr(InfoStruct, Level, null, null), + pParmErr = TypeMarshal.ToIntPtr(ParmErr)) + { + paramList = new Int3264[]{ + pServerName, + (uint)Level, + pShareInfo, // out value + pParmErr, + IntPtr.Zero // return value + }; + using (RpceInt3264Collection outParamList = RpceCall(paramList, (ushort)SRVS_OPNUM.NetrShareAdd)) + { + retVal = outParamList[paramList.Length - 1].ToUInt32(); + if (retVal == (uint)Win32ErrorCode_32.ERROR_INVALID_PARAMETER) + { + ParmErr = TypeMarshal.ToNullableStruct(outParamList[4]); + } + } + } + return retVal; + } + /// /// The NetrShareEnum method retrieves information about each shared resource on a server. /// diff --git a/ProtoSDK/MS-SRVS/SrvsMessage.cs b/ProtoSDK/MS-SRVS/SrvsMessage.cs index 750e52cd6..0e0e0591d 100644 --- a/ProtoSDK/MS-SRVS/SrvsMessage.cs +++ b/ProtoSDK/MS-SRVS/SrvsMessage.cs @@ -9,6 +9,7 @@ namespace Microsoft.Protocols.TestTools.StackSdk.Srvs { public enum SRVS_OPNUM : ushort { + NetrShareAdd = 14, NetrShareEnum = 15, NetrShareGetInfo = 16, NetrShareSetInfo = 17