Esempio n. 1
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);
  }
Esempio n. 2
0
 /**
  * Set the allocation hint
  *
  * @param alloc int
  */
 public final void setAllocationHint(int alloc) {
   DataPacker.putIntelInt(alloc, getBuffer(), m_offset + ALLOCATIONHINT);
 }
Esempio n. 3
0
 /**
  * Set the long SMB error code
  *
  * @param err Long SMB error code.
  */
 public final void setLongErrorCode(int err) {
   DataPacker.putIntelInt(err, m_smbbuf, ERRORCODE);
 }
Esempio n. 4
0
 /**
  * Set the specified parameter words.
  *
  * @param idx Parameter index (zero based).
  * @param val Parameter value.
  */
 public final void setParameterLong(int idx, int val) {
   int pos = WORDCNT + (2 * idx) + 1;
   DataPacker.putIntelInt(val, m_smbbuf, pos);
 }
Esempio n. 5
0
 /**
  * Pack an integer (32 bit) value into the byte area
  *
  * @param val int
  */
 public final void packInt(int val) {
   DataPacker.putIntelInt(val, m_smbbuf, m_pos);
   m_pos += 4;
 }