Beispiel #1
0
static BOOL
SetUserProfileData(HWND hwndDlg,
                   PPROFILE_USER_DATA pUserData)
{
    PUSER_INFO_3 pUserInfo = NULL;
    LPTSTR pszProfilePath = NULL;
    LPTSTR pszScriptPath = NULL;
    LPTSTR pszHomeDir = NULL;
    LPTSTR pszHomeDrive = NULL;
    NET_API_STATUS status;
    DWORD dwIndex;
    INT nLength;
    INT nIndex;

    NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo);

    /* Get the profile path */
    nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_PATH));
    if (nLength == 0)
    {
        pUserInfo->usri3_profile = NULL;
    }
    else
    {
        pszProfilePath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
        GetDlgItemText(hwndDlg, IDC_USER_PROFILE_PATH, pszProfilePath, nLength + 1);
        pUserInfo->usri3_profile = pszProfilePath;
    }

    /* Get the script path */
    nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_SCRIPT));
    if (nLength == 0)
    {
        pUserInfo->usri3_script_path = NULL;
    }
    else
    {
        pszScriptPath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
        GetDlgItemText(hwndDlg, IDC_USER_PROFILE_SCRIPT, pszScriptPath, nLength + 1);
        pUserInfo->usri3_script_path = pszScriptPath;
    }

    if (IsDlgButtonChecked(hwndDlg, IDC_USER_PROFILE_LOCAL) == BST_CHECKED)
    {
        /* Local home directory */
        nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH));
        if (nLength == 0)
        {
            pUserInfo->usri3_home_dir = NULL;
        }
        else
        {
            pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
            GetDlgItemText(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH, pszHomeDir, nLength + 1);
            pUserInfo->usri3_home_dir = pszHomeDir;
        }
    }
    else
    {
        /* Remote home directory */
        nLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH));
        if (nLength == 0)
        {
            pUserInfo->usri3_home_dir = NULL;
        }
        else
        {
            pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
            GetDlgItemText(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH, pszHomeDir, nLength + 1);
            pUserInfo->usri3_home_dir = pszHomeDir;
        }

        nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETCURSEL, 0, 0);
        if (nIndex != CB_ERR)
        {
            nLength = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETLBTEXTLEN, nIndex, 0);
            pszHomeDrive = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
            SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETLBTEXT, nIndex, (LPARAM)pszHomeDrive);
            pUserInfo->usri3_home_dir_drive = pszHomeDrive;
        }
    }

    status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex);
    if (status != NERR_Success)
    {
        DebugPrintf(_T("Status: %lu  Index: %lu"), status, dwIndex);
    }

    if (pszProfilePath)
        HeapFree(GetProcessHeap(), 0, pszProfilePath);

    if (pszScriptPath)
        HeapFree(GetProcessHeap(), 0, pszScriptPath);

    if (pszHomeDir)
        HeapFree(GetProcessHeap(), 0, pszHomeDir);

    if (pszHomeDrive)
        HeapFree(GetProcessHeap(), 0, pszHomeDrive);

    NetApiBufferFree(pUserInfo);

    return (status == NERR_Success);
}
Beispiel #2
0
bool GobConsole::cmd_varSize(int argc, const char **argv) {
    DebugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize());
    return true;
}
Beispiel #3
0
void Sequence::Debug()
{
   wxString s;
   DebugPrintf(&s);
   wxPrintf(wxT("%s"), s.c_str());
}
PVideoFrame __stdcall MVSuper::GetFrame(int n, IScriptEnvironment* env)
{
	const unsigned char *pSrcY, *pSrcU, *pSrcV;
	unsigned char *pDstY, *pDstU, *pDstV;
	const unsigned char *pSrcPelY, *pSrcPelU, *pSrcPelV;
//	unsigned char *pDstYUY2;
	int nSrcPitchY, nSrcPitchUV;
	int nDstPitchY, nDstPitchUV;
	int nSrcPelPitchY, nSrcPelPitchUV;
//    int nDstPitchYUY2;

	DebugPrintf("MSuper: Get src frame %d clip %d",n,child);

	PVideoFrame src = child->GetFrame(n, env);
	PVideoFrame srcPel;
	if (usePelClip)
		srcPel = pelclip->GetFrame(n, env);

	PVideoFrame	dst = env->NewVideoFrame(vi);

      PROFILE_START(MOTION_PROFILE_YUY2CONVERT);
	if ( (pixelType & VideoInfo::CS_YUY2) == VideoInfo::CS_YUY2 )
	{
      if (!planar)
      {
		pSrcY = SrcPlanes->GetPtr();
		pSrcU = SrcPlanes->GetPtrU();
		pSrcV = SrcPlanes->GetPtrV();
		nSrcPitchY  = SrcPlanes->GetPitch();
		nSrcPitchUV  = SrcPlanes->GetPitchUV();
		YUY2ToPlanes(src->GetReadPtr(), src->GetPitch(), nWidth, nHeight,
			pSrcY, nSrcPitchY, pSrcU, pSrcV, nSrcPitchUV, isse);
		if (usePelClip)
		{
			pSrcPelY = SrcPelPlanes->GetPtr();
			pSrcPelU = SrcPelPlanes->GetPtrU();
			pSrcPelV = SrcPelPlanes->GetPtrV();
			nSrcPelPitchY  = SrcPelPlanes->GetPitch();
			nSrcPelPitchUV  = SrcPelPlanes->GetPitchUV();
			YUY2ToPlanes(srcPel->GetReadPtr(), srcPel->GetPitch(), srcPel->GetRowSize()/2, srcPel->GetHeight(),
				pSrcPelY, nSrcPelPitchY, pSrcPelU, pSrcPelV, nSrcPelPitchUV, isse);
		}
      }
      else
      {
			pSrcY = src->GetReadPtr();
			pSrcU = pSrcY + src->GetRowSize()/2;
			pSrcV = pSrcU + src->GetRowSize()/4;
			nSrcPitchY  = src->GetPitch();
			nSrcPitchUV  = nSrcPitchY;
        if (usePelClip)
		{
			pSrcPelY = srcPel->GetReadPtr();
			pSrcPelU = pSrcPelY + srcPel->GetRowSize()/2;
			pSrcPelV = pSrcPelU + srcPel->GetRowSize()/4;
			nSrcPelPitchY  = srcPel->GetPitch();
			nSrcPelPitchUV  = nSrcPelPitchY;
		}
      }
//		pDstY = DstPlanes->GetPtr();
//		pDstU = DstPlanes->GetPtrU();
//		pDstV = DstPlanes->GetPtrV();
//		nDstPitchY  = DstPlanes->GetPitch();
//		nDstPitchUV  = DstPlanes->GetPitchUV();
        // planer data packed to interleaved format (same as interleved2planar by kassandro) - v2.0.0.5
		pDstY = dst->GetWritePtr();
		pDstU = pDstY + nSuperWidth;
		pDstV = pDstU + nSuperWidth/2;
		nDstPitchY = dst->GetPitch();
		nDstPitchUV = nDstPitchY;
	}
	else
	{
		pSrcY = src->GetReadPtr(PLANAR_Y);
	    pSrcU = src->GetReadPtr(PLANAR_U);
	    pSrcV = src->GetReadPtr(PLANAR_V);
		nSrcPitchY = src->GetPitch(PLANAR_Y);
	    nSrcPitchUV = src->GetPitch(PLANAR_U);
		if (usePelClip)
		{
			pSrcPelY = srcPel->GetReadPtr(PLANAR_Y);
			pSrcPelU = srcPel->GetReadPtr(PLANAR_U);
			pSrcPelV = srcPel->GetReadPtr(PLANAR_V);
			nSrcPelPitchY = srcPel->GetPitch(PLANAR_Y);
			nSrcPelPitchUV = srcPel->GetPitch(PLANAR_U);
		}
		pDstY = dst->GetWritePtr(PLANAR_Y);
	    pDstU = dst->GetWritePtr(PLANAR_U);
	    pDstV = dst->GetWritePtr(PLANAR_V);
		nDstPitchY  = dst->GetPitch(PLANAR_Y);
		nDstPitchUV  = dst->GetPitch(PLANAR_U);
	}
      PROFILE_STOP(MOTION_PROFILE_YUY2CONVERT);

      PROFILE_START(MOTION_PROFILE_INTERPOLATION);

      pSrcGOF->Update(YUVPLANES, pDstY, nDstPitchY, pDstU, nDstPitchUV, pDstV, nDstPitchUV);

      pSrcGOF->SetPlane(pSrcY, nSrcPitchY, YPLANE);
      pSrcGOF->SetPlane(pSrcU, nSrcPitchUV, UPLANE);
      pSrcGOF->SetPlane(pSrcV, nSrcPitchUV, VPLANE);

      pSrcGOF->Reduce(nModeYUV, rfilter);
      pSrcGOF->Pad(nModeYUV);

	  if (usePelClip)
	  {
		  MVFrame *srcFrames = pSrcGOF->GetFrame(0);
		  MVPlane *srcPlaneY = srcFrames->GetPlane(YPLANE);
		  if (nModeYUV & YPLANE) srcPlaneY->RefineExt(pSrcPelY, nSrcPelPitchY, isPelClipPadded);
		  MVPlane *srcPlaneU = srcFrames->GetPlane(UPLANE);
		  if (nModeYUV & UPLANE) srcPlaneU->RefineExt(pSrcPelU, nSrcPelPitchUV, isPelClipPadded);
		  MVPlane *srcPlaneV = srcFrames->GetPlane(VPLANE);
		  if (nModeYUV & VPLANE) srcPlaneV->RefineExt(pSrcPelV, nSrcPelPitchUV, isPelClipPadded);
	  }
	  else
		  pSrcGOF->Refine(nModeYUV, sharp);

      PROFILE_STOP(MOTION_PROFILE_INTERPOLATION);


/*
      PROFILE_START(MOTION_PROFILE_YUY2CONVERT);

	if ( (pixelType & VideoInfo::CS_YUY2) == VideoInfo::CS_YUY2 )
	{
		pDstYUY2 = dst->GetWritePtr();
		nDstPitchYUY2 = dst->GetPitch();
		YUY2FromPlanes(pDstYUY2, nDstPitchYUY2, nSuperWidth, nSuperHeight,
					  pDstY, nDstPitchY, pDstU, pDstV, nDstPitchUV, isse);
	}
      PROFILE_STOP(MOTION_PROFILE_YUY2CONVERT);
*/

      PROFILE_CUMULATE();

	return dst;
}
Beispiel #5
0
int DbgPrintIcmp(struct icmp* icmp, int icmplen)
{
#ifdef DEBUGPRINT
  static char	*icmp_type[]={
    "Echo Reply",
    "undefined",
    "undefined",
    "Destination Unreachable",
    "Source Quench",
    "Redirect",
    "undefined",
    "undefined",
    "Echo Request",
    "Router Adverisement",
    "Router Selection",
    "Time Exceeded for Datagram",
    "Parameter Problem on Datagram",
    "Timestamp Request",
    "Timestamp Reply",
    "Information Request",
    "Information Reply",
    "Address Mask Request",
    "Address Mask Reply"
  };
  
  DebugPrintf("icmp------------------------------------\n");
  
  DebugPrintf("icmp_type=%u", icmp->icmp_type);
  if(icmp->icmp_type <= 18){
    DebugPrintf("(%s),", icmp_type[icmp->icmp_type]);
  }
  else{
    DebugPrintf("(undefined),");
  }
  DebugPrintf("icmp_code=%u,", icmp->icmp_code);
  DebugPrintf("icmp_cksum=%u\n", ntohs(icmp->icmp_cksum));
  
  if((icmp->icmp_type == 0) || (icmp->icmp_type == 8)){
    DebugPrintf("icmp_id=%u,", ntohs(icmp->icmp_id));
    DebugPrintf("icmp_seq=%u\n", ntohs(icmp->icmp_seq));
  }
  
  
  if(icmplen >= (8 + sizeof(struct iphdr))){
    DebugPrintf("icmp data : iphdr : \n");
    struct iphdr* iphdr = (struct iphdr*)((u_char*)icmp + 8);
    DbgPrintIp4Header(iphdr);
    
    
    if(iphdr->protocol == IPPROTO_TCP){
      int tcplen;
      tcplen = icmplen - 8 - iphdr->ihl * 4;
      if(tcplen >= sizeof(struct tcphdr)){
	struct tcphdr* tcphdr;
	tcphdr = (struct tcphdr*)((u_char*)iphdr + iphdr->ihl * 4);
	
	DebugPrintf( "icmp data : tcphdr : \n");
	DbgPrintTcpHeader(tcphdr);
      }
    }else if(iphdr->protocol == IPPROTO_UDP){
      int udplen;
      udplen = icmplen - 8 - iphdr->ihl * 4;
      if(udplen >= sizeof(struct udphdr)){
	struct udphdr* udphdr;
	udphdr = (struct udphdr*)((u_char*)iphdr + iphdr->ihl * 4);
	
	DebugPrintf( "icmp data : udphdr : \n");
	DbgPrintUdpHeader(udphdr);
      }
    }
  }
#endif
  
  return(0);
}
Beispiel #6
0
bool DemoDebugger::Cmd_MoveObject(int argc, const char **argv) {
	DebugPrintf("Not available in Demo\n");
	return true;
}
Beispiel #7
0
int
main () {
  DebugPrintf("d: %s\n", "hoge");
  return (0);
}
Beispiel #8
0
int DbgPrintArp(struct ether_arp* arp)
{
#ifdef DEBUGPRINT
  static char* hrd[]={
    "From KA9Q: NET/ROM pseudo.",
    "Ethernet 10/100Mbps.",
    "Experimental Ethernet.",
    "AX.25 Level 2.",
    "PROnet token ring.",
    "Chaosnet.",
    "IEEE 802.2 Ethernet/TR/TB.",
    "ARCnet.",
    "APPLEtalk.",
    "undefine",
    "undefine",
    "undefine",
    "undefine",
    "undefine",
    "undefine",
    "Frame Relay DLCI.",
    "undefine",
    "undefine",
    "undefine",
    "ATM.",
    "undefine",
    "undefine",
    "undefine",
    "Metricom STRIP (new IANA id)."
  };
  static char* op[]={
    "undefined",
    "ARP request.",
    "ARP reply.",
    "RARP request.",
    "RARP reply.",
    "undefined",
    "undefined",
    "undefined",
    "InARP request.",
    "InARP reply.",
    "(ATM)ARP NAK."
  };
  char	buf[80];

  DebugPrintf("arp-------------------------------------\n");
  DebugPrintf("arp_hrd=%u", ntohs(arp->arp_hrd));
  if(ntohs(arp->arp_hrd) <= 23){
    DebugPrintf("(%s),", hrd[ntohs(arp->arp_hrd)]);
  }
  else{
    DebugPrintf("(undefined),");
  }
  DebugPrintf("arp_pro=%u", ntohs(arp->arp_pro));
  switch(ntohs(arp->arp_pro)){
  case	ETHERTYPE_IP:
    DebugPrintf("(IP)\n");
    break;
  case	ETHERTYPE_ARP:
    DebugPrintf("(Address resolution)\n");
    break;
  case	ETHERTYPE_REVARP:
    DebugPrintf("(Reverse ARP)\n");
    break;
  case	ETHERTYPE_IPV6:
    DebugPrintf("(IPv6)\n");
    break;
  default:
    DebugPrintf("(unknown)\n");
    break;
  }
  DebugPrintf("arp_hln=%u,", arp->arp_hln);
  DebugPrintf("arp_pln=%u,", arp->arp_pln);
  DebugPrintf("arp_op=%u", ntohs(arp->arp_op));
  if(ntohs(arp->arp_op) <= 10){
    DebugPrintf("arpop : (%s)\n", op[ntohs(arp->arp_op)]);
  }
  else{
    DebugPrintf("(undefine)\n");
  }
  DebugPrintf("arp_sha=%s\n", mac2str(arp->arp_sha, buf, sizeof(buf)));
  DebugPrintf("arp_spa=%s\n", ipi82str(arp->arp_spa, buf, sizeof(buf)));
  DebugPrintf("arp_tha=%s\n", mac2str(arp->arp_tha, buf, sizeof(buf)));
  DebugPrintf("arp_tpa=%s\n", ipi82str(arp->arp_spa, buf, sizeof(buf)));
#endif
  
  return(0);
}
Beispiel #9
0
/*
 * This command lists the objects available, and their ID
 */
bool Ringworld2Debugger::Cmd_ListObjects(int argc, const char **argv) {
	if (argc != 1) {
		DebugPrintf("Usage: %s\n", argv[0]);
		return true;
	}

	DebugPrintf("Available objects for this game are:\n");
	DebugPrintf("1  - R2_OPTO_DISK\n");
	DebugPrintf("2  - R2_READER\n");
	DebugPrintf("3  - R2_NEGATOR_GUN\n");
	DebugPrintf("4  - R2_STEPPING_DISKS\n");
	DebugPrintf("5  - R2_ATTRACTOR_UNIT\n");
	DebugPrintf("6  - R2_SENSOR_PROBE\n");
	DebugPrintf("7  - R2_SONIC_STUNNER\n");
	DebugPrintf("8  - R2_CABLE_HARNESS\n");
	DebugPrintf("9  - R2_COM_SCANNER\n");
	DebugPrintf("10 - R2_SPENT_POWER_CAPSULE\n");
	DebugPrintf("11 - R2_CHARGED_POWER_CAPSULE\n");
	DebugPrintf("12 - R2_AEROSOL\n");
	DebugPrintf("13 - R2_REMOTE_CONTROL\n");
	DebugPrintf("14 - R2_OPTICAL_FIBRE\n");
	DebugPrintf("15 - R2_CLAMP\n");
	DebugPrintf("16 - R2_ATTRACTOR_CABLE_HARNESS\n");
	DebugPrintf("17 - R2_FUEL_CELL\n");
	DebugPrintf("18 - R2_GYROSCOPE\n");
	DebugPrintf("19 - R2_AIRBAG\n");
	DebugPrintf("20 - R2_REBREATHER_TANK\n");
	DebugPrintf("21 - R2_RESERVE_REBREATHER_TANK\n");
	DebugPrintf("22 - R2_GUIDANCE_MODULE\n");
	DebugPrintf("23 - R2_THRUSTER_VALVE\n");
	DebugPrintf("24 - R2_BALLOON_BACKPACK\n");
	DebugPrintf("25 - R2_RADAR_MECHANISM\n");
	DebugPrintf("26 - R2_JOYSTICK\n");
	DebugPrintf("27 - R2_IGNITOR\n");
	DebugPrintf("28 - R2_DIAGNOSTICS_DISPLAY\n");
	DebugPrintf("29 - R2_GLASS_DOME\n");
	DebugPrintf("30 - R2_WICK_LAMP\n");
	DebugPrintf("31 - R2_SCRITH_KEY\n");
	DebugPrintf("32 - R2_TANNER_MASK\n");
	DebugPrintf("33 - R2_PURE_GRAIN_ALCOHOL\n");
	DebugPrintf("34 - R2_SAPPHIRE_BLUE\n");
	DebugPrintf("35 - R2_ANCIENT_SCROLLS\n");
	DebugPrintf("36 - R2_FLUTE\n");
	DebugPrintf("37 - R2_GUNPOWDER\n");
	DebugPrintf("38 - R2_NONAME\n");
	DebugPrintf("39 - R2_COM_SCANNER_2\n");
	DebugPrintf("40 - R2_SUPERCONDUCTOR_WIRE\n");
	DebugPrintf("41 - R2_PILLOW\n");
	DebugPrintf("42 - R2_FOOD_TRAY\n");
	DebugPrintf("43 - R2_LASER_HACKSAW\n");
	DebugPrintf("44 - R2_PHOTON_STUNNER\n");
	DebugPrintf("45 - R2_BATTERY\n");
	DebugPrintf("46 - R2_SOAKED_FACEMASK\n");
	DebugPrintf("47 - R2_LIGHT_BULB\n");
	DebugPrintf("48 - R2_ALCOHOL_LAMP\n");
	DebugPrintf("49 - R2_ALCOHOL_LAMP_2\n");
	DebugPrintf("50 - R2_ALCOHOL_LAMP_3\n");
	DebugPrintf("51 - R2_BROKEN_DISPLAY\n");
	DebugPrintf("52 - R2_TOOLBOX\n");

	return true;
}
Beispiel #10
0
//
// This function is a helper function used to calculate cpHash and rpHash.
//
// NOTE:  for calculating cpHash, set responseCode to TPM_RC_NO_RESPONSE; this
// tells the function to leave it out of the calculation.
//
TPM_RC TpmCalcPHash( TSS2_SYS_CONTEXT *sysContext, TPM_HANDLE handle1, TPM_HANDLE handle2,
    TPMI_ALG_HASH authHash, TPM_RC responseCode, TPM2B_DIGEST *pHash )
{
    TPM_RC rval = TPM_RC_SUCCESS;
    UINT32 i;
    TPM2B_NAME name1;
    TPM2B_NAME name2;
    TPM2B_MAX_BUFFER hashInput; // Byte stream to be hashed to create pHash
    UINT8 *hashInputPtr;
    size_t parametersSize;
    const uint8_t *startParams;
    UINT8 cmdCode[4] = {0,0,0,0};
    UINT8 *cmdCodePtr = &cmdCode[0];
    
    name1.b.size = name2.b.size = 0;
    
    // Calculate pHash
    //

    // Only get names for commands
    if( responseCode == TPM_RC_NO_RESPONSE )
    {
        // Get names for the handles
        rval = TpmHandleToName( handle1, &name1 );
        if( rval != TPM_RC_SUCCESS )
            return rval;
    }

#ifdef DEBUG
    DebugPrintf( 0, "\n\nNAME1 = \n" );
    PrintSizedBuffer( &(name1.b) );
#endif
    
    // Only get names for commands
    if( responseCode == TPM_RC_NO_RESPONSE )
    {
        rval = Tss2_Sys_GetCpBuffer( sysContext, &parametersSize, &startParams);
        if( rval != TPM_RC_SUCCESS )
            return rval;

        rval = TpmHandleToName( handle2, &name2 );
        if( rval != TPM_RC_SUCCESS )
            return rval;
    }
    else
    {
        rval = Tss2_Sys_GetRpBuffer( sysContext, &parametersSize, &startParams);
        if( rval != TPM_RC_SUCCESS )
            return rval;
    }
    
#ifdef DEBUG
    DebugPrintf( 0, "\n\nNAME2 = \n" );
    PrintSizedBuffer( &(name2.b) );
#endif
    
    // Create pHash input byte stream:  first add response code, if any.
    hashInput.b.size = 0;
    if( responseCode != TPM_RC_NO_RESPONSE )
    {
        hashInputPtr = &( hashInput.t.buffer[hashInput.b.size] );
        *(UINT32 *)hashInputPtr = CHANGE_ENDIAN_DWORD( responseCode );
        hashInput.b.size += 4;
        hashInputPtr += 4;
    }

    // Create pHash input byte stream:  now add command code.
    rval = Tss2_Sys_GetCommandCode( sysContext, &cmdCode );
    if( rval != TPM_RC_SUCCESS )
        return rval;

    hashInputPtr = &( hashInput.t.buffer[hashInput.b.size] );    
    *(UINT32 *)hashInputPtr = CHANGE_ENDIAN_DWORD( *(UINT32 *)cmdCodePtr );
    hashInput.t.size += 4;

    // Create pHash input byte stream:  now add in names for the handles.
    rval = ConcatSizedByteBuffer( &hashInput, &( name1.b ) );
    if( rval != TPM_RC_SUCCESS )
        return rval;
    
    rval = ConcatSizedByteBuffer( &hashInput, &( name2.b ) );
    if( rval != TPM_RC_SUCCESS )
        return rval;

    if( ( hashInput.t.size + parametersSize ) <= sizeof( hashInput.t.buffer ) )
    {
        // Create pHash input byte stream:  now add in parameters byte stream
        for( i = 0; i < parametersSize; i++ )
            hashInput.t.buffer[hashInput.t.size + i ] = startParams[i];
        hashInput.t.size += (UINT16)parametersSize;
    }
    else
    {
        return( APPLICATION_ERROR( TSS2_BASE_RC_INSUFFICIENT_BUFFER ) );

    }
#ifdef DEBUG
    DebugPrintf( 0, "\n\nPHASH input bytes= \n" );
    PrintSizedBuffer( &(hashInput.b) );
#endif
    
    // Now hash the whole mess.
    if( hashInput.t.size > sizeof( hashInput.t.buffer ) )
    {
        rval = APPLICATION_ERROR( TSS2_BASE_RC_INSUFFICIENT_BUFFER );
    }
    else
    {
        rval = TpmHash( authHash, hashInput.t.size, &( hashInput.t.buffer[0] ), pHash );
        if( rval != TPM_RC_SUCCESS )
            return rval;
#ifdef DEBUG
        DebugPrintf( 0, "\n\nPHASH = " );
        PrintSizedBuffer( &(pHash->b) );
#endif
    }
    
    return rval;
 }
Beispiel #11
0
/*
 * This command lists the objects available, and their ID
 */
bool BlueForceDebugger::Cmd_ListObjects(int argc, const char **argv) {
	if (argc != 1) {
		DebugPrintf("Usage: %s\n", argv[0]);
		return true;
	}

	DebugPrintf("Available objects for this game are:\n");
	DebugPrintf("1  - INV_COLT45\n");
	DebugPrintf("2  - INV_AMMO_CLIP\n");
	DebugPrintf("3  - INV_SPARE_CLIP\n");
	DebugPrintf("4  - INV_HANDCUFFS\n");
	DebugPrintf("5  - INV_GREENS_GUN\n");
	DebugPrintf("6  - INV_TICKET_BOOK\n");
	DebugPrintf("7  - INV_MIRANDA_CARD\n");
	DebugPrintf("8  - INV_FOREST_RAP\n");
	DebugPrintf("9  - INV_GREEN_ID\n");
	DebugPrintf("10 - INV_BASEBALL_CARD\n");
	DebugPrintf("11 - INV_BOOKING_GREEN\n");
	DebugPrintf("12 - INV_FLARE\n");
	DebugPrintf("13 - INV_COBB_RAP\n");
	DebugPrintf("14 - INV_22_BULLET\n");
	DebugPrintf("15 - INV_AUTO_RIFLE\n");
	DebugPrintf("16 - INV_WIG\n");
	DebugPrintf("17 - INV_FRANKIE_ID\n");
	DebugPrintf("18 - INV_TYRONE_ID\n");
	DebugPrintf("19 - INV_22_SNUB\n");
	DebugPrintf("20 - INV_BOOKING_FRANKIE\n");
	DebugPrintf("21 - INV_BOOKING_GANG\n");
	DebugPrintf("22 - INV_FBI_TELETYPE\n");
	DebugPrintf("23 - INV_DA_NOTE\n");
	DebugPrintf("24 - INV_PRINT_OUT\n");
	DebugPrintf("25 - INV_WAREHOUSE_KEYS\n");
	DebugPrintf("26 - INV_CENTER_PUNCH\n");
	DebugPrintf("27 - INV_TRANQ_GUN\n");
	DebugPrintf("28 - INV_HOOK\n");
	DebugPrintf("29 - INV_RAGS\n");
	DebugPrintf("30 - INV_JAR\n");
	DebugPrintf("31 - INV_SCREWDRIVER\n");
	DebugPrintf("32 - INV_D_FLOPPY\n");
	DebugPrintf("33 - INV_BLANK_DISK\n");
	DebugPrintf("34 - INV_STICK\n");
	DebugPrintf("35 - INV_CRATE1\n");
	DebugPrintf("36 - INV_CRATE2\n");
	DebugPrintf("37 - INV_SHOEBOX\n");
	DebugPrintf("38 - INV_BADGE\n");
	DebugPrintf("39 - INV_RENTAL_COUPON\n");
	DebugPrintf("40 - INV_NICKEL\n");
	DebugPrintf("41 - INV_LYLE_CARD\n");
	DebugPrintf("42 - INV_CARTER_NOTE\n");
	DebugPrintf("43 - INV_MUG_SHOT\n");
	DebugPrintf("44 - INV_CLIPPING\n");
	DebugPrintf("45 - INV_MICROFILM \n");
	DebugPrintf("46 - INV_WAVE_KEYS\n");
	DebugPrintf("47 - INV_RENTAL_KEYS\n");
	DebugPrintf("48 - INV_NAPKIN\n");
	DebugPrintf("49 - INV_DMV_PRINTOUT\n");
	DebugPrintf("50 - INV_FISHING_NET\n");
	DebugPrintf("51 - INV_ID\n");
	DebugPrintf("52 - INV_9MM_BULLETS\n");
	DebugPrintf("53 - INV_SCHEDULE\n");
	DebugPrintf("54 - INV_GRENADES\n");
	DebugPrintf("55 - INV_YELLOW_CORD\n");
	DebugPrintf("56 - INV_HALF_YELLOW_CORD\n");
	DebugPrintf("57 - INV_BLACK_CORD\n");
	DebugPrintf("58 - INV_HALF_BLACK_CORD\n");
	DebugPrintf("59 - INV_WARRANT\n");
	DebugPrintf("60 - INV_JACKET\n");
	DebugPrintf("61 - INV_GREENS_KNIFE\n");
	DebugPrintf("62 - INV_DOG_WHISTLE\n");
	DebugPrintf("63 - INV_AMMO_BELT\n");
	DebugPrintf("64 - INV_CARAVAN_KEY\n");
	return true;
}
Beispiel #12
0
/*
 * This command gets an item, or move it to a room
 */
bool RingworldDebugger::Cmd_MoveObject(int argc, const char **argv) {
	// Check for a flag to clear
	if ((argc < 2) || (argc > 3)){
		DebugPrintf("Usage: %s <object number> [<scene number>]\n", argv[0]);
		DebugPrintf("If no scene is specified, the object will be added to inventory\n");
		return true;
	}

	int objNum = strToInt(argv[1]);
	int sceneNum = 1;
	if (argc == 3)
		sceneNum = strToInt(argv[2]);

	switch (objNum) {
	case OBJECT_STUNNER:
		RING_INVENTORY._stunner._sceneNumber = sceneNum;
		break;
	case OBJECT_SCANNER:
		RING_INVENTORY._scanner._sceneNumber = sceneNum;
		break;
	case OBJECT_STASIS_BOX:
		RING_INVENTORY._stasisBox._sceneNumber = sceneNum;
		break;
	case OBJECT_INFODISK:
		RING_INVENTORY._infoDisk._sceneNumber = sceneNum;
		break;
	case OBJECT_STASIS_NEGATOR:
		RING_INVENTORY._stasisNegator._sceneNumber = sceneNum;
		break;
	case OBJECT_KEY_DEVICE:
		RING_INVENTORY._keyDevice._sceneNumber = sceneNum;
		break;
	case OBJECT_MEDKIT:
		RING_INVENTORY._medkit._sceneNumber = sceneNum;
		break;
	case OBJECT_LADDER:
		RING_INVENTORY._ladder._sceneNumber = sceneNum;
		break;
	case OBJECT_ROPE:
		RING_INVENTORY._rope._sceneNumber = sceneNum;
		break;
	case OBJECT_KEY:
		RING_INVENTORY._key._sceneNumber = sceneNum;
		break;
	case OBJECT_TRANSLATOR:
		RING_INVENTORY._translator._sceneNumber = sceneNum;
		break;
	case OBJECT_ALE:
		RING_INVENTORY._ale._sceneNumber = sceneNum;
		break;
	case OBJECT_PAPER:
		RING_INVENTORY._paper._sceneNumber = sceneNum;
		break;
	case OBJECT_WALDOS:
		RING_INVENTORY._waldos._sceneNumber = sceneNum;
		break;
	case OBJECT_STASIS_BOX2:
		RING_INVENTORY._stasisBox2._sceneNumber = sceneNum;
		break;
	case OBJECT_RING:
		RING_INVENTORY._ring._sceneNumber = sceneNum;
		break;
	case OBJECT_CLOAK:
		RING_INVENTORY._cloak._sceneNumber = sceneNum;
		break;
	case OBJECT_TUNIC:
		RING_INVENTORY._tunic._sceneNumber = sceneNum;
		break;
	case OBJECT_CANDLE:
		RING_INVENTORY._candle._sceneNumber = sceneNum;
		break;
	case OBJECT_STRAW:
		RING_INVENTORY._straw._sceneNumber = sceneNum;
		break;
	case OBJECT_SCIMITAR:
		RING_INVENTORY._scimitar._sceneNumber = sceneNum;
		break;
	case OBJECT_SWORD:
		RING_INVENTORY._sword._sceneNumber = sceneNum;
		break;
	case OBJECT_HELMET:
		RING_INVENTORY._helmet._sceneNumber = sceneNum;
		break;
	case OBJECT_ITEMS:
		RING_INVENTORY._items._sceneNumber = sceneNum;
		break;
	case OBJECT_CONCENTRATOR:
		RING_INVENTORY._concentrator._sceneNumber = sceneNum;
		break;
	case OBJECT_NULLIFIER:
		RING_INVENTORY._nullifier._sceneNumber = sceneNum;
		break;
	case OBJECT_PEG:
		RING_INVENTORY._peg._sceneNumber = sceneNum;
		break;
	case OBJECT_VIAL:
		RING_INVENTORY._vial._sceneNumber = sceneNum;
		break;
	case OBJECT_JACKET:
		RING_INVENTORY._jacket._sceneNumber = sceneNum;
		break;
	case OBJECT_TUNIC2:
		RING_INVENTORY._tunic2._sceneNumber = sceneNum;
		break;
	case OBJECT_BONE:
		RING_INVENTORY._bone._sceneNumber = sceneNum;
		break;
	case OBJECT_EMPTY_JAR:
		RING_INVENTORY._emptyJar._sceneNumber = sceneNum;
		break;
	case OBJECT_JAR:
		RING_INVENTORY._jar._sceneNumber = sceneNum;
		break;
	default:
		DebugPrintf("Invalid object Id %s\n", argv[1]);
		break;
	}

	return true;
}
Beispiel #13
0
/*
 * This command lists the objects available, and their ID
 */
bool RingworldDebugger::Cmd_ListObjects(int argc, const char **argv) {
	if (argc != 1) {
		DebugPrintf("Usage: %s\n", argv[0]);
		return true;
	}

	DebugPrintf("Available objects for this game are:\n");
	DebugPrintf("0 - Stunner\n");
	DebugPrintf("1 - Scanner\n");
	DebugPrintf("2 - Stasis Box\n");
	DebugPrintf("3 - Info Disk\n");
	DebugPrintf("4 - Stasis Negator\n");
	DebugPrintf("5 - Key Device\n");
	DebugPrintf("6 - Medkit\n");
	DebugPrintf("7 - Ladder\n");
	DebugPrintf("8 - Rope\n");
	DebugPrintf("9 - Key\n");
	DebugPrintf("10 - Translator\n");
	DebugPrintf("11 - Ale\n");
	DebugPrintf("12 - Paper\n");
	DebugPrintf("13 - Waldos\n");
	DebugPrintf("14 - Stasis Box 2\n");
	DebugPrintf("15 - Ring\n");
	DebugPrintf("16 - Cloak\n");
	DebugPrintf("17 - Tunic\n");
	DebugPrintf("18 - Candle\n");
	DebugPrintf("19 - Straw\n");
	DebugPrintf("20 - Scimitar\n");
	DebugPrintf("21 - Sword\n");
	DebugPrintf("22 - Helmet\n");
	DebugPrintf("23 - Items\n");
	DebugPrintf("24 - Concentrator\n");
	DebugPrintf("25 - Nullifier\n");
	DebugPrintf("26 - Peg\n");
	DebugPrintf("27 - Vial\n");
	DebugPrintf("28 - Jacket\n");
	DebugPrintf("29 - Tunic 2\n");
	DebugPrintf("30 - Bone\n");
	DebugPrintf("31 - Empty Jar\n");
	DebugPrintf("32 - Jar\n");
	return true;
}
Beispiel #14
0
HRESULT UITouchButton::Draw(DK_IMAGE drawingImg)
{
	DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  Start");

    if (!m_bIsVisible)
    {
	    DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End: m_bIsVisible = false");
        return S_OK;
    }

    if (drawingImg.pbData == NULL)
    {
	    DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End: m_bIsVisible = false");
        return E_FAIL;
    }

    HRESULT hr(S_OK);
    DK_IMAGE imgSelf;
    DK_RECT rcSelf={m_iLeft, m_iTop, m_iLeft + m_iWidth, m_iTop + m_iHeight};
    RTN_HR_IF_FAILED(CropImage(
                            drawingImg,
                            rcSelf,
                            &imgSelf
                            ));

    CTpGraphics grf(imgSelf);


    if (m_bUsingBackgroundPicture)
    {
        // draw background picture if there is
        if (IsFocus() || IsPressed())
        {
            if (m_spFocusedBackground)
            {
                    HRESULT hr(S_OK);
	                DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  Draw background Image  in focus");
                    int startx = (m_iWidth - m_spFocusedBackground.Get()->GetWidth());

                    if (startx >0)
                        startx = startx / 2;
                    else
                        startx =0;

                    int starty = (m_iHeight - m_spFocusedBackground.Get()->GetHeight());

                    if (starty >0)
                        starty = starty / 2;
                    else
                        starty =0;

                    RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(),startx,starty,0,0,m_spFocusedBackground.Get()->GetWidth(), m_spFocusedBackground.Get()->GetHeight()));
                    //RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(), 0, 0));
            }
        }
        else
        {
            if (m_spBackground)
            {
	                DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  Draw background Image not in focus");

                    int startx = (m_iWidth - m_spBackground.Get()->GetWidth());

                    if (startx >0)
                        startx = startx / 2;
                    else
                        startx =0;

                    int starty = (m_iHeight - m_spBackground.Get()->GetHeight());

                    if (starty >0)
                        starty = starty / 2;
                    else
                        starty =0;

                    HRESULT hr(S_OK);
                    RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), startx, starty, 0, 0, m_spBackground.Get()->GetWidth(), m_spBackground.Get()->GetHeight()));
                    //RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), 0, 0));
            }
        }
    }
    else
    {
        // draw background in color
        if (!m_bBackTransparent)
        {
            if (IsFocus() || IsPressed())
            {
	            DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  Draw background with color in focus");
                RTN_HR_IF_FAILED(grf.FillRect(
                    0,
                    0,
                    m_iWidth,
                    m_iHeight,
                    m_focusedBackgroundColor));
            }
            else
            {
	            DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  Draw background with color not in focus");
                RTN_HR_IF_FAILED(grf.FillRect(
                    0,
                    0,
                    m_iWidth,
                    m_iHeight,
                    GetBackgroundColor()));
            }
        }
    }
    //draw string
    if (m_strText.Length() > 0)
    {
        m_ifontAttr.m_iFace=FONT_DEFAULT;
        
        ITpFont* pFont = NULL;

        if (IsFocus() || IsPressed())
        {
            pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, m_iFocusedFontColor);
        }
        else
        {
            pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, GetFontColor());
        }

        if(NULL == pFont)
        {
	        DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End: pFont = NULL");
            return E_FAIL;
        }

        int _iStringWidth = pFont->StringWidth(m_strText);
        int _iStringHeight = pFont->GetHeight();

        if (_iStringWidth > m_iWidth)
        {
	        DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End:_iStringWidth > m_iWidth");
            return E_FAIL;
        }

        int _H_offset = (m_iWidth - _iStringWidth) / 2;
        int _V_offset = (m_iHeight - _iStringHeight) / 2;

        grf.DrawStringUtf8(m_strText.GetBuffer(), _H_offset, _V_offset, pFont);
    }

    if (m_do2gray)
    {
        grf.Do2Gray(0,0,m_iWidth, m_iHeight, 80, FALSE, (IsEnable() ? 0xff : 0x66));
    }

    DebugPrintf(DLC_CHENM, "UITouchButton::Draw()  End.");
    return hr;
}
Beispiel #15
0
void HardDiskHandler::Initialize()
{
	char strKey[3];
	strKey[0] = 'H'; //HDD type ID
	strKey[1] = '0';   //First HDD
	strKey[2] = 0;   //Null Character
	//SetIDT(32+14,_HDDInterruptHandler);
	//SetIDT(32+15,_HDDInterruptHandler);

	HDDs.Initialize();
	for (BYTE DeviceController = 0; DeviceController < IDE_MAX_CONTROLLER; DeviceController++)
	{
		DoSoftwareReset(DeviceController);
		if (IsDeviceControllerBusy(DeviceController)) //if device controller is busy then skipping
		{			
			DebugPrintf("\nController Busy");
			continue;
		}
		OutPortByte(IDE_Con_IOBases[DeviceController][0] + IDE_CB_COMMAND, IDE_COM_EXECUTE_DEVICE_DIAGNOSTIC);
		if (IsDeviceControllerBusy(DeviceController, 6))
		{			
			DebugPrintf("\nController busy after EXE");
			continue;
		}

		
		BYTE Result = InPortByte(IDE_Con_IOBases[DeviceController][0] + IDE_CB_ERROR);
		for (BYTE Device = 0; Device < 2; Device++)         // loop for master and slave disks
		{
			UINT16 DeviceID_Data[512], j;
			if (Device == 0 && !(Result & 1))
				continue;
			if (Device == 1 && (Result & 0x80))
				continue;
			if (Device == 1)
				OutPortByte(IDE_Con_IOBases[DeviceController][0] + IDE_CB_DEVICE_HEAD, 0x10); //Setting 4th bit(count 5) to set device as 1
			else
				OutPortByte(IDE_Con_IOBases[DeviceController][0] + IDE_CB_DEVICE_HEAD, 0x0);
			
			sleep(50);
			OutPortByte(IDE_Con_IOBases[DeviceController][0] + IDE_CB_COMMAND, IDE_COM_IDENTIFY_DEVICE);
			if (!IsDeviceDataReady(DeviceController, 600, TRUE))
			{
				DebugPrintf("\nData not ready %d", DeviceController);
				continue;
			}							
			/*Reading 512 bytes of information from the Device*/
			for (j = 0; j < 256; j++)
				DeviceID_Data[j] = InPortWord(IDE_Con_IOBases[DeviceController][0] + IDE_CB_DATA);
			/* Creating new HDD node for the Collection HDDs */
			
			//struct __HDDInfo * newHDD;
			__HDDInfo * newHDD=(__HDDInfo *)kmalloc(sizeof(__HDDInfo));
			if (newHDD == NULL)
			{
				DebugPrintf("\nHDD Initialize :: Allocation failed");
				return;
			}
			newHDD->IORegisterIdx = DeviceController;
			memcpy(newHDD->DeviceID, DeviceID_Data, 512);
			newHDD->DeviceNumber = Device;
			newHDD->LastError = 0;

			newHDD->BytesPerSector = 512; //-------------Modify Code

			newHDD->CHSCylinderCount = DeviceID_Data[1];
			newHDD->CHSHeadCount = DeviceID_Data[3];
			newHDD->CHSSectorCount = DeviceID_Data[6];
			if (DeviceID_Data[10] == 0)
				strcpy(newHDD->SerialNumber, "N/A");
			else
			for (j = 0; j < 20; j += 2)
			{
				newHDD->SerialNumber[j] = DeviceID_Data[10 + (j / 2)] >> 8;
				newHDD->SerialNumber[j + 1] = (DeviceID_Data[10 + (j / 2)] << 8) >> 8;
			}
			if (DeviceID_Data[23] == 0)
				strcpy(newHDD->FirmwareRevision, "N/A");
			else
			for (j = 0; j < 8; j += 2)
			{
				newHDD->FirmwareRevision[j] = DeviceID_Data[23 + (j / 2)] >> 8;
				newHDD->FirmwareRevision[j + 1] = (DeviceID_Data[23 + (j / 2)] << 8) >> 8;
			}

			if (DeviceID_Data[27] == 0)
				strcpy(newHDD->ModelNumber, "N/A");
			else
			for (j = 0; j < 20; j += 2)
			{
				newHDD->ModelNumber[j] = DeviceID_Data[27 + (j / 2)] >> 8;
				newHDD->ModelNumber[j + 1] = (DeviceID_Data[27 + (j / 2)] << 8) >> 8;
			}
			newHDD->LBASupported = DeviceID_Data[49] & 0x200;
			newHDD->DMASupported = DeviceID_Data[49] & 0x100;

			UINT32 LBASectors = DeviceID_Data[61];
			LBASectors = LBASectors << 16;
			LBASectors |= DeviceID_Data[60];

			newHDD->LBACount = LBASectors;
			HDDs.Add(newHDD, strKey);
			strKey[1]++;
		}
	}
}
Beispiel #16
0
void BOTAI_FollowNodeNetwork( bool SlideOnly, bool FollowingTarget )
{
	VECTOR ThisTargetPos;
	VECTOR TempNodePos;
	int i;
	float dist;
	float shortest = BIGDISTANCE;

	// following a target find the node to move to
	if( FollowingTarget )	
	{
		CurrentNode = -1;
		// is there a node that both i and the target have a line of sight to? 
		for(i=0; i<SHIP_NUM_NODES; i++)
		{
			TempNodePos = BOTAI_NodeNetwork(i);
			if( BOTAI_ClearLOS( &Ships[WhoIAm].Object.Pos, Ships[WhoIAm].Object.Group, &TempNodePos ) )
			{
				if( BOTAI_ClearLOS(&FollowTargetPos, FollowTargetGroup, &TempNodePos) )
				{
					CurrentNode = i;
					DebugPrintf("found node both i and target can see: %d \n", CurrentNode);
					break;
				}
			}
		}

		// otherwise find the closest node to the target that i can see 
		// change this later to search the node paths - probably the A* algorithm
		if( CurrentNode < 0 )
		{
			for(i=0; i<SHIP_NUM_NODES; i++)
			{
				TempNodePos = BOTAI_NodeNetwork(i);
				if( BOTAI_ClearLOS( &Ships[WhoIAm].Object.Pos, Ships[WhoIAm].Object.Group, &TempNodePos ) )
				{
					dist = DistanceVector2Vector(&FollowTargetPos, &TempNodePos);
					if(dist < shortest)
					{
						shortest = dist;
						CurrentNode = i;
					}
				}
			}
			DebugPrintf("using closest node to target that i can see: %d\n", CurrentNode);
		}
	}

	// if we don't know where we're going, use the closest node 
	if( CurrentNode < 0 )
	{
		CurrentNode = BOTAI_GetNearestNode( &Ships[WhoIAm].Object );
		DebugPrintf("i don't know where i'm going, so moving to nearest node: %d\n", CurrentNode);
	}

	// get the node position
	ThisTargetPos = BOTAI_NodeNetwork( CurrentNode );

	if( FollowingTarget )
		DebugPrintf("following target to node %d\n", CurrentNode);
	else
		DebugPrintf("moving to node %d\n", CurrentNode);

	// try and get to the current node
	if( !SlideOnly )
	{
		// using normal movement
		if( !BOTAI_MoveToTarget( &ThisTargetPos ) )
			return;
	}
	// using slide only
	else if( !BOTAI_SlideToTarget( &ThisTargetPos ) )
		return;

	// -- reached current node now set the next node
	DebugPrintf("reached current node, looking for next...\n");

	// roaming without target
	if( !FollowingTarget )
		BOTAI_GetNextNode();
}
Beispiel #17
0
//
// This function calculates the session HMAC and updates session state.
//
UINT32 TpmComputeSessionHmac(
    TSS2_SYS_CONTEXT *sysContext,
    TPMS_AUTH_COMMAND *pSessionDataIn, // Pointer to session input struct
    TPM_HANDLE entityHandle,             // Used to determine if we're accessing a different
    // resource than the bound resoure.
    TPM_RC responseCode,                 // Response code for the command, 0xffff for "none" is
    // used to indicate that no response code is present
    // (used for calculating command HMACs vs response HMACs).
    TPM_HANDLE handle1,                  // First handle == 0xff000000 indicates no handle
    TPM_HANDLE handle2,                  // Second handle == 0xff000000 indicates no handle
    TPMA_SESSION sessionAttributes,      // Current session attributes
    TPM2B_DIGEST *result,                // Where the result hash is saved.
    TPM_RC sessionCmdRval
)
{
    TPM2B_MAX_BUFFER hmacKey;
    TPM2B *bufferList[7];
    TPM2B_DIGEST pHash;
    SESSION *pSession = 0;
    TPM2B_AUTH authValue;
    TPM2B sessionAttributesByteBuffer;
    UINT16 i;
    TPM_RC rval;
    UINT8 nvNameChanged = 0;
    ENTITY *nvEntity;
    UINT8 commandCode[4] = { 0, 0, 0, 0 };
    UINT32 *cmdCodePtr;
    UINT32 cmdCode;

    hmacKey.b.size = 0;

    rval = GetSessionStruct( pSessionDataIn->sessionHandle, &pSession );
    if( rval != TPM_RC_SUCCESS )
    {
        return rval;
    }

    INIT_SIMPLE_TPM2B_SIZE( pHash );
    rval = ( *CalcPHash )( sysContext, handle1, handle2, pSession->authHash,
                           responseCode, &pHash );
    if( rval != TPM_RC_SUCCESS )
        return rval;

    // Use entityHandle to get authValue, if any.
    if( ( pSession->bind == TPM_RH_NULL ) ||
            ( ( pSession->bind != TPM_RH_NULL ) && ( pSession->bind == entityHandle ) ) )
    {
        rval = GetEntityAuth( entityHandle, &authValue );
        if( rval != TPM_RC_SUCCESS )
            authValue.t.size = 0;
    }
    else
    {
        authValue.t.size = 0;
    }

    rval = Tss2_Sys_GetCommandCode( sysContext, &commandCode );
    if( rval != TPM_RC_SUCCESS )
        return rval;

    if( ( entityHandle >> HR_SHIFT ) == TPM_HT_NV_INDEX )
    {
        // If NV index, get status wrt to name change.  If name has changed,
        // we have to treat it as if its not the bound entity, even if it was
        // the bound entity.
        nvNameChanged = pSession->nvNameChanged;
    }

    rval = ConcatSizedByteBuffer( (TPM2B_MAX_BUFFER *)&hmacKey, &( pSession->sessionKey.b ) );

    if( ( pSession->bind == TPM_RH_NULL ) || ( pSession->bind != entityHandle )
            || nvNameChanged )
    {
        rval = ConcatSizedByteBuffer( (TPM2B_MAX_BUFFER *)&hmacKey, &( authValue.b ) );
    }

#ifdef  DEBUG
    DebugPrintf( 0, "\n\nhmacKey = " );
    PrintSizedBuffer( &(hmacKey.b) );
#endif

    // Create buffer list
    i = 0;
    bufferList[i++] = &pHash.b;
    bufferList[i++] = &( pSession->nonceNewer.b );
    bufferList[i++] = &( pSession->nonceOlder.b );
    bufferList[i++] = &( pSession->nonceTpmDecrypt.b );
    bufferList[i++] = &( pSession->nonceTpmEncrypt.b );
    sessionAttributesByteBuffer.size = 1;
    sessionAttributesByteBuffer.buffer[0] = *(UINT8 *)&sessionAttributes;
    bufferList[i++] = &( sessionAttributesByteBuffer );
    bufferList[i++] = 0;
    cmdCodePtr = (UINT32 *)&commandCode[0];
    cmdCode = *cmdCodePtr;

#ifdef  DEBUG
    for( i = 0; bufferList[i] != 0; i++ )
    {
        DebugPrintf( 0, "\n\nbufferlist[%d]:\n", i );
        PrintSizedBuffer( bufferList[i] );
    }
#endif

    rval = (*HmacFunctionPtr)( pSession->authHash, &hmacKey.b, &( bufferList[0] ), result );
    if( rval != TPM_RC_SUCCESS )
        return rval;

    if( ( responseCode != TPM_RC_NO_RESPONSE ) &&
            ( cmdCode == TPM_CC_NV_Write ||
              cmdCode == TPM_CC_NV_Increment ||
              cmdCode == TPM_CC_NV_SetBits )
      )
    {
        rval = GetEntity( entityHandle, &nvEntity );
        if( rval != TPM_RC_SUCCESS )
        {
            return rval;
        }
        else
        {
            // Only change session's nvNameChanged parameter when
            // the NV index's name changes due to a write.
            if( nvEntity->nvNameChanged == 0 )
            {
                pSession->nvNameChanged = 1;
                nvEntity->nvNameChanged = 1;
            }
        }
    }

    return rval;
}
Beispiel #18
0
int DbgPrintIp4Header(struct iphdr* iphdr)
{
#ifdef DEBUGPRINT
  int	i;
  char	buf[80];
  u_char* option;
  int optionLen;
  
  optionLen = iphdr->ihl * 4 - sizeof(struct iphdr);
  if(optionLen > 0){
    if(optionLen >= 1500){
      fprintf(stderr,"IP optionLen(%d):too big !!!\n\n\n",optionLen);
      return(-1);
    }
    option = (u_char*)iphdr + sizeof(struct iphdr);
  }else{
    option = 0;
    optionLen = 0;
  }

  DebugPrintf("ip--------------------------------------\n");
  DebugPrintf("version=%u,", iphdr->version);
  DebugPrintf("ihl=%u,", iphdr->ihl);
  DebugPrintf("tos=%x,", iphdr->tos);
  DebugPrintf("tot_len=%u,", ntohs(iphdr->tot_len));
  DebugPrintf("id=%u\n", ntohs(iphdr->id));
  DebugPrintf("frag_off=%x,%u,", (ntohs(iphdr->frag_off) >> 13) & 0x07, 
    ntohs(iphdr->frag_off) & 0x1FFF);
  DebugPrintf("ttl=%u,", iphdr->ttl);
  DebugPrintf("protocol=%u", iphdr->protocol);
  if(iphdr->protocol <= 17){
    DebugPrintf("(%s),", Proto[iphdr->protocol]);
  }
  else{
    DebugPrintf("(undefined),");
  }
  DebugPrintf("check=%x\n", iphdr->check);
  DebugPrintf("saddr=%s,", ip322str(iphdr->saddr, buf, sizeof(buf)));
  DebugPrintf("daddr=%s\n", ip322str(iphdr->daddr, buf, sizeof(buf)));
  if(optionLen > 0){
    DebugPrintf("option:");
    for(i = 0; i < optionLen; i++){
      if(i != 0){
	DebugPrintf(":%02x", option[i]);
      }
      else{
	DebugPrintf("%02x", option[i]);
      }
    }
  }
#endif
  
  return(0);
}
Beispiel #19
0
int matherr(struct exception * except)
#endif
{
	total_exceptions++;
	DebugPrintf( "matherr(#%d) %s( %lf, %lf ) = %lf %s\n",
		total_exceptions,
		except->name, except->arg1, except->arg2,
		except->retval, MathErrStrings[ except->type - 1 ] );
	if ( except->type > 0 && except->type <= MAX_EXCEPTION_TYPES )
		type_exceptions[ except->type - 1 ]++;
	else
		unknown_exceptions++;
	switch( except->type )
	{
#ifdef WIN32
		case _DOMAIN:
#else
		case DOMAIN:
#endif
			if( !strcasecmp( except->name, "acos" ) )
			{
				if( ( except->arg1 < -1.0 ) && ( except->arg1 > -1.0001 ) )
				{
					except->retval = PI;
					acos_exceptions++;
					return( 1 );
				}

				if( ( except->arg1 > 1.0 ) && ( except->arg1 < 1.0001 ) )
				{
					except->retval = 0;
					acos_exceptions++;
					return( 1 );
				}
			}
			else if ( !strcasecmp( except->name, "sqrt" ) )
			{
				if ( except->arg1 < 0.0 )
				{
					sqrt_exceptions++;
					return 0; // not handled, needs fixing...
				}
			}
	  		break;
#ifdef WIN32
		case _SING:
		case _OVERFLOW:
		case _PLOSS:
		case _TLOSS:
			break;
		case _UNDERFLOW:
#else
		case SING:
		case OVERFLOW:
		case PLOSS:
		case TLOSS:
			break;
		case UNDERFLOW:
#endif
			if ( !strcasecmp( except->name, "pow" ) )
			{
				if ( except->arg1 < 1.0 && except->arg2 > 0.0 )
				{
					pow_exceptions++;
					return 0; // not handled, but don't care
				}
			}
			break;

		default:
			break;
	}
	return 0;
}
Beispiel #20
0
int DbgDbgPrintIcmp6(struct icmp6_hdr* icmp6)
{
#ifdef DEBUGPRINT  
  DebugPrintf("icmp6-----------------------------------\n");
  
  DebugPrintf("icmp6_type=%u", icmp6->icmp6_type);
  if(icmp6->icmp6_type == 1){
    DebugPrintf("(Destination Unreachable),");
  }
  else if(icmp6->icmp6_type == 2){
    DebugPrintf("(Packet too Big),");
  }
  else if(icmp6->icmp6_type == 3){
    DebugPrintf("(Time Exceeded),");
  }
  else if(icmp6->icmp6_type == 4){
    DebugPrintf("(Parameter Problem),");
  }
  else if(icmp6->icmp6_type == 128){
    DebugPrintf("(Echo Request),");
  }
  else if(icmp6->icmp6_type == 129){
    DebugPrintf("(Echo Reply),");
  }
  else{
    DebugPrintf("(undefined),");
  }
  DebugPrintf("icmp6_code=%u,", icmp6->icmp6_code);
  DebugPrintf("icmp6_cksum=%u\n", ntohs(icmp6->icmp6_cksum));
  
  if((icmp6->icmp6_type == 128) || (icmp6->icmp6_type == 129)){
    DebugPrintf("icmp6_id=%u,", ntohs(icmp6->icmp6_id));
    DebugPrintf("icmp6_seq=%u\n", ntohs(icmp6->icmp6_seq));
  }
#endif

  return(0);
}
Beispiel #21
0
/**
 * Activate internal debugger, when available
 */
bool Debugger::Cmd_SetDebug(int argc, const char **argv) {
	DebugPrintf("Not available in this game\n");
	return true;
}