/** * Initialize the DCE/RPC reply. Set the SMB transaction parameter count so that the data offset * can be calculated. */ public final void initializeDCEReply() { // Set the total parameter words setParameterCount(10); // Set the total parameter/data bytes setParameter(0, 0); setParameter(1, 0); // Set the parameter byte count/offset for this packet int bytPos = DCEDataPacker.longwordAlign(getByteOffset()); setParameter(3, 0); setParameter(4, bytPos - RFCNetBIOSProtocol.HEADER_LEN); // Set the parameter displacement setParameter(5, 0); // Set the data byte count/offset for this packet setParameter(6, 0); setParameter(7, bytPos - RFCNetBIOSProtocol.HEADER_LEN); // Set the data displacement setParameter(8, 0); // Set up word count setParameter(9, 0); }
/** * Initialize the DCE/RPC request. Set the SMB transaction parameter count so that the data offset * can be calculated. * * @param handle int * @param typ byte * @param flags int * @param callId int */ public final void initializeDCERequest(int handle, byte typ, int flags, int callId) { // Initialize the transaction InitializeTransact(16, null, 0, null, 0); // Set the parameter byte count/offset for this packet int bytPos = DCEDataPacker.longwordAlign(getByteOffset()); setParameter(3, 0); setParameter(4, bytPos - RFCNetBIOSProtocol.HEADER_LEN); // Set the parameter displacement setParameter(5, 0); // Set the data byte count/offset for this packet setParameter(6, 0); setParameter(7, bytPos - RFCNetBIOSProtocol.HEADER_LEN); // Set the data displacement setParameter(8, 0); // Set up word count setParameter(9, 0); // Set the setup words setSetupParameter(0, PacketType.TransactNmPipe); setSetupParameter(1, handle); // Reset the DCE offset for a DCE reply m_offset = bytPos; // Build the DCE/RPC header byte[] buf = getBuffer(); DataPacker.putZeros(buf, m_offset, 24); buf[m_offset + VERSIONMAJOR] = HDR_VERSIONMAJOR; buf[m_offset + VERSIONMINOR] = HDR_VERSIONMINOR; buf[m_offset + PDUTYPE] = typ; buf[m_offset + HEADERFLAGS] = (byte) (flags & 0xFF); DataPacker.putIntelInt(HDR_PACKEDDATAREP, buf, m_offset + PACKEDDATAREP); DataPacker.putIntelInt(0, buf, m_offset + AUTHLEN); DataPacker.putIntelInt(callId, buf, m_offset + CALLID); }