class UACParameters(ndr.NdrParameters): MEMBERS = [ ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong, ndr.NdrLong, ndr.NdrWString, ndr.NdrWString, NdrUACStartupInfo, ndr.NdrLong, ndr.NdrLong ]
class RAiLaunchAdminProcessParameters(ndr.NdrParameters): MEMBERS = [ ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong, ndr.NdrLong, ndr.NdrWString, ndr.NdrWString, NdrUACStartupInfo, ndr.NdrLong, ndr.NdrLong ]
class PLSAPR_OBJECT_ATTRIBUTES(ndr.NdrStructure): MEMBERS = [ndr.NdrLong, ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrUniquePTR(ndr.NdrLong), # We dont care of the subtype as we will pass None ndr.NdrLong, ndr.NdrUniquePTR(ndr.NdrLong), # We dont care of the subtype as we will pass None ndr.NdrUniquePTR(ndr.NdrLong)] # We dont care of the subtype as we will pass None
class ComplexAlignementStructure(ndr.NdrStructure): MEMBERS = [ ndr.NdrByte, ndr.NdrUniquePTR(ndr.NdrByte), ndr.NdrUniquePTR(ndr.NdrLong), ndr.NdrByte, ndr.NdrUniquePTR(ndr.NdrHyper), ndr.NdrUniquePTR(ndr.NdrByte) ]
class NdrUACStartupInfo(ndr.NdrStructure): MEMBERS = [ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, NDRPoint]
class SvcMoveFileInheritSecurity(ndr.NdrParameters): MEMBERS = [ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrUniquePTR(ndr.NdrWString), ndr.NdrLong]
class Towers(ndr.NdrConformantVaryingArrays): MEMBER_TYPE = ndr.NdrUniquePTR(NdrTower)
class EptMapAuthParameters(ndr.NdrParameters): MEMBERS = [ NDRIID, NdrTower, ndr.NdrUniquePTR(ndr.NdrSID), NdrContext, ndr.NdrLong ]
[ndr.NdrShort, InternalAlignementStructure, ndr.NdrShort]), (0x0101, [0x4141, 0x42, 0x43434343, 0x44, 0x4545, 0x46], 0x4747), # Verified with an actual RPC server b"\x01\x01PPAABPCCCCDPEEFPGG"), # Complex struct alignement # A struct with both primitive field & pointer to primitiv field of various size (ComplexAlignementStructure, [0x41, 0x42, 0x43434343, 0x44, 0x4545454545454545, 0x46], b"APPP\x02\x02\x02\x02\x03\x03\x03\x03\x44PPP\x05\x05\x05\x05\x06\x06\x06\x06BPPPCCCCEEEEEEEEF" ), # Complex struct alignement with nesting (due to uniqueptr at the start) # The last hyper is not aligned/pad like previous test due to the leading UniquPTR # This is the proof that NDR packing cannot be in "context-free" sub function and must share a state # This test fails for now (0.6) and I don't know if I will implem the full NDR logic someday (ndr.NdrUniquePTR(ComplexAlignementStructure), [0x41, 0x42, 0x43434343, 0x44, 0x4545454545454545, 0x46], b"\x01\x01\x01\x01APPP\x02\x02\x02\x02\x03\x03\x03\x03\x44PPP\x05\x05\x05\x05\x06\x06\x06\x06BPPPCCCCPPPPEEEEEEEEF" ) ] @pytest.mark.parametrize("ndrobj, values, result", NDR_PACK_TEST_CASE) def test_ndr_packing(ndrobj, values, result): assert ndrobj.pack(values) == result # Check the result of serializing a fixed 'EptMapAuthParameters' call known to works # It allow to test for packing of real-complexe Parameter without relying on the whole ALPC/RPC stack def test_ndr_packing_complex_epmapper_call(): # Param from a real UAC endpoint resolution
class LsarOpenPolicy2Parameter(ndr.NdrParameters): MEMBERS = [ ndr.NdrUniquePTR(ndr.NdrWString), PLSAPR_OBJECT_ATTRIBUTES, ndr.NdrLong ]