本文整理汇总了C++中ReadMem函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadMem函数的具体用法?C++ ReadMem怎么用?C++ ReadMem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadMem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bstr_as_string
bool
bstr_as_string(DEBUGHELPER *pH, DWORDLONG addr, std::string *ret )
{
if( addr == 0)
{
*ret = "@\"\"";
}
else
{
long len;
if(!ReadMem(pH, addr - sizeof(len), &len) ) return false;
std::ostringstream os;
os << '\"';
if(len >0 )
{
char *val = new char[len+2];
if(!ReadMem(pH, addr, len, val) ) return false;
// Null terminate
val[len]='\0'; val[len+1]='\0';
//
wchar_t *wval = reinterpret_cast<wchar_t *>(val);
std::string sret;
if (!string_as_string( wval, wval+(len/2), &sret ) ) return false;
delete [] val;
os << sret;
}
os << '\"';
*ret = os.str();
}
return true;
}
示例2: CheckIsModuleWin32App
/*
* CheckIsModuleWin32App - check if a given module handle is a win32 app
*/
bool CheckIsModuleWin32App( HMODULE hmod, WORD *win32ds, WORD *win32cs,
DWORD *win32initialeip )
{
GLOBALENTRY ge;
winext_data wedata;
int segnum;
*win32cs = *win32ds = 0;
ge.dwSize = sizeof( GLOBALENTRY );
if( !GlobalEntryModule( &ge, hmod, 1 ) ) {
return( false );
}
ReadMem( (WORD)ge.hBlock, 0, (LPVOID) &wedata, sizeof( wedata ) );
if( memcmp( wedata.sig, win386Sig, sizeof( win386Sig) ) == 0 ||
memcmp( wedata.sig, win386Sig2, sizeof( win386Sig2) ) == 0 ) {
if( memcmp( wedata.new_sig, win386Sig, sizeof( win386Sig ) ) == 0 ) {
segnum = 2;
} else {
segnum = 3;
}
if( !GlobalEntryModule( &ge, hmod, segnum ) ) {
return( false );
}
ReadMem( (WORD)ge.hBlock, wedata.dataseg_off, (LPVOID)win32ds, sizeof( WORD ) );
ReadMem( (WORD)ge.hBlock, wedata.stacksize_off, (LPVOID)win32initialeip,
sizeof( DWORD ) );
ReadMem( (WORD)ge.hBlock, wedata.codeinfo_off + 4, (LPVOID)win32cs,
sizeof( WORD ) );
return( true );
}
return( false );
} /* CheckIsModuleWin32App */
示例3: DISPPARAMS_Eval
HRESULT WINAPI DISPPARAMS_Eval( DWORD addr, DEBUGHELPER *pH, int nBase, BOOL bUniStrings, char *pResult, size_t maxlen, DWORD reserved )
{
DISPPARAMS dparam;
DWORDLONG llAddr =GetAddress(pH,addr);
if(!ReadMem(pH, llAddr, &dparam) ) return E_FAIL;
std::ostringstream os;
if( dparam.cArgs == 0 )
{
os << "()";
}
else if( dparam.cArgs > 20)
{
os << "(.." << dparam.cArgs << "..)";
}
else
{
VARIANT *vars= new VARIANT[dparam.cArgs];
try
{
if(!ReadMem(pH, reinterpret_cast<DWORDLONG>( dparam.rgvarg ) , sizeof(VARIANT) * dparam.cArgs, vars ) )
{
delete [] vars;
return E_FAIL;
}
bool first = true;
os << '(';
for( long i = dparam.cArgs-1; i>= 0 ; --i)
{
std::string ret;
if(! variant_as_string(pH, vars[i], &ret) )
{
delete [] vars; return false;
}
if(!first) os << ',' ; first = false;
os << ret;
}
os << ')';
} catch (...){}
delete [] vars;
}
strncpy(pResult, os.str().c_str(), maxlen);
pResult[maxlen-1] ='\0';
return S_OK;
}
示例4: SoftwareDisableImc
/**
* SoftwareDisableImc - Software disable IMC strap
*
*
* @param[in] FchDataPtr Fch configuration structure pointer.
*
*/
VOID
SoftwareDisableImc (
IN VOID *FchDataPtr
)
{
UINT8 ValueByte;
UINT8 PortStatusByte;
UINT32 AbValue;
UINT32 ABStrapOverrideReg;
AMD_CONFIG_PARAMS *StdHeader;
StdHeader = ((FCH_DATA_BLOCK *) FchDataPtr)->StdHeader;
GetChipSysMode (&PortStatusByte, StdHeader);
RwPci ((LPC_BUS_DEV_FUN << 16) + FCH_LPC_REGC8 + 3, AccessWidth8, 0x7F, BIT7, StdHeader);
ReadPmio (FCH_PMIOA_REGBF, AccessWidth8, &ValueByte, StdHeader);
ReadMem ((ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG80), AccessWidth32, &AbValue);
ABStrapOverrideReg = AbValue;
ABStrapOverrideReg &= ~BIT2; // bit2=0 EcEnableStrap
WriteMem ((ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG84), AccessWidth32, &ABStrapOverrideReg);
ReadPmio (FCH_PMIOA_REGD7, AccessWidth8, &ValueByte, StdHeader);
ValueByte |= BIT1; // Set GenImcClkEn to 1
WritePmio (FCH_PMIOA_REGD7, AccessWidth8, &ValueByte, StdHeader);
ValueByte = 06;
LibAmdIoWrite (AccessWidth8, 0xcf9, &ValueByte, StdHeader);
FchStall (0xffffffff, StdHeader);
}
示例5: ProcessMark
/* Handle profiler marks (hardcoded breakpoints with a string) */
static bool ProcessMark( pid_t pid, user_regs_struct *regs )
{
if( (regs->edx & 0xffff) != 0 ) { /* this is a mark */
char buff[BUFF_SIZE];
int len = 0;
seg_offset where;
/* read the mark string char by char */
for( ;; ) {
if( len >= (BUFF_SIZE - 1) )
break;
ReadMem( pid, buff + len, regs->eax + len, 1 );
if( buff[len] == '\0' )
break;
++len;
}
buff[len] = '\0';
where.segment = FlatSeg;
where.offset = regs->eip;
WriteMark( buff, where );
return( true );
} else {
dbg_printf( "hardcoded breakpoint was not a mark!\n" );
return( false );
}
}
示例6: DateTime_Evaluate
//extern "C" {
HRESULT WINAPI DateTime_Evaluate( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t maxlen, DWORD reserved )
{
DATE Time;
DWORDLONG address = GetAddress( pHelper, dwAddress);
if( !ReadMem( pHelper, address, &Time) )
return E_FAIL;
if(Time == 0.)
{
strcpy(pResult, "zero");
return S_OK;
}
if(Time == ( 65535. * 2147483647. ) || Time == (2147483647.))
{
strcpy(pResult, "invalid");
return S_OK;
}
if(Time == ( 65535. * 2147483648. ) || Time == (2147483648.))
{
strcpy(pResult, "null");
return S_OK;
}
CComBSTR strDate ;
HRESULT hr = VarBstrFromDate(Time, LOCALE_USER_DEFAULT, 0, &strDate);
if (FAILED(hr)) return hr;
if(strDate != 0)
WideCharToMultiByte(CP_ACP, 0, strDate, strDate.Length(), pResult, maxlen , NULL, NULL);
return S_OK;
}
示例7: while
void *aes128_init(void *key)
{
int i = 0;
uint32_t *RK;
uint8_t b0,b1,b2,b3;
RK = (uint32_t *)malloc(176);
RK[0] = *((uint32_t*)key);
RK[1] = *((uint32_t*)key + 1);
RK[2] = *((uint32_t*)key + 2);
RK[3] = *((uint32_t*)key + 3);
while(1)
{
b3 = (uint8_t)(RK[3] & 0xff);
b2 = (uint8_t)((RK[3] >> 8)& 0xff);
b1 = (uint8_t)((RK[3] >> 16)& 0xff);
b0 = (uint8_t)((RK[3] >> 24)& 0xff);
b3 = ReadMem( SBox[(b3>>4) & 0xf][b3 & 0xf]);
b2 = ReadMem(SBox[(b2>>4) & 0xf][b2 & 0xf]) ^ ReadMem(RCon[i]);
b1 = ReadMem(SBox[(b1>>4) & 0xf][b1 & 0xf]);
b0 = ReadMem(SBox[(b0>>4) & 0xf][b0 & 0xf]);
RK[4] = ((uint32_t)b3 << 24) ^ ((uint32_t)b0 << 16) ^ ((uint32_t)b1 << 8) ^ (uint32_t)b2 ^ RK[0] ;
RK[5] = RK[1] ^ RK[4];
RK[6] = RK[2] ^ RK[5];
RK[7] = RK[3] ^ RK[6];
if (++i==10)
return (RK-36);
RK+=4;
}
}
示例8: MemWndGetNextByte
/*
* MemWndGetNextByte
*/
int_16 MemWndGetNextByte( void )
{
char buf;
ReadMem( Sel, _Offset, &buf, 1 );
return( buf );
} /* MemWndGetNextByte */
示例9: accessSegment
/*
* accessSegment:
*
* Access a segment to cause the windows loader to load it. We find
* the segment by looking through the module entry (which is a lot like
* an NE header, except that where segment numbers would be, the selector
* value is). We then have the app we are debugging execute an instruction that
* references the seqment in question.
*/
static void accessSegment( GLOBALHANDLE gh, WORD segment )
{
WORD i;
WORD sel;
WORD offset;
ReadMem( (WORD)gh, 0x22, &offset, sizeof( offset ) );
i = 0;
while( i < segment ) {
ReadMem( (WORD)gh, offset+8, &sel, sizeof( sel ) );
offset += 10;
i++;
}
SegmentToAccess = sel;
DebuggerWaitForMessage( RUNNING_DEBUGEE, TaskAtFault, ACCESS_SEGMENT );
} /* accessSegment */
示例10: GcpuRelatedSetting
/**
* GcpuRelatedSetting - Program Gcpu C related function
*
*
*
* @param[in] FchDataPtr Fch configuration structure pointer.
*
*/
VOID
GcpuRelatedSetting (
IN VOID *FchDataPtr
)
{
UINT8 FchAcDcMsg;
UINT8 FchTimerTickTrack;
UINT8 FchClockInterruptTag;
UINT8 FchOhciTrafficHanding;
UINT8 FchEhciTrafficHanding;
UINT8 FchGcpuMsgCMultiCore;
UINT8 FchGcpuMsgCStage;
UINT32 Value;
FCH_DATA_BLOCK *LocalCfgPtr;
LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr;
FchAcDcMsg = (UINT8) LocalCfgPtr->Gcpu.AcDcMsg;
FchTimerTickTrack = (UINT8) LocalCfgPtr->Gcpu.TimerTickTrack;
FchClockInterruptTag = (UINT8) LocalCfgPtr->Gcpu.ClockInterruptTag;
FchOhciTrafficHanding = (UINT8) LocalCfgPtr->Gcpu.OhciTrafficHanding;
FchEhciTrafficHanding = (UINT8) LocalCfgPtr->Gcpu.EhciTrafficHanding;
FchGcpuMsgCMultiCore = (UINT8) LocalCfgPtr->Gcpu.GcpuMsgCMultiCore;
FchGcpuMsgCStage = (UINT8) LocalCfgPtr->Gcpu.GcpuMsgCStage;
ReadMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REGA0, AccessWidth32, &Value);
Value = Value & 0xC07F00A0;
if ( FchAcDcMsg ) {
Value = Value | BIT0;
}
if ( FchTimerTickTrack ) {
Value = Value | BIT1;
}
if ( FchClockInterruptTag ) {
Value = Value | BIT10;
}
if ( FchOhciTrafficHanding ) {
Value = Value | BIT13;
}
if ( FchEhciTrafficHanding ) {
Value = Value | BIT15;
}
if ( FchGcpuMsgCMultiCore ) {
Value = Value | BIT23;
}
if ( FchGcpuMsgCMultiCore ) {
Value = (Value | (BIT6 + BIT4 + BIT3 + BIT2));
}
WriteMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REGA0, AccessWidth32, &Value);
}
示例11: MemWndGetDataLong
/*
* MemWndGetDataLong
*/
long MemWndGetDataLong( void )
{
long buf;
ReadMem( Sel, _Offset, (char *)&buf, sizeof( long ) );
_Offset += sizeof( long );
return( buf );
} /* MemWndGetDataLong */
示例12: MemWndGetDataLong
/*
* MemWndGetDataLong
*/
int_32 MemWndGetDataLong( void )
{
int_32 buf;
ReadMem( Sel, _Offset, (char *)&buf, sizeof( buf ) );
_Offset += sizeof( buf );
return( buf );
} /* MemWndGetDataLong */
示例13: IsExternalClockMode
/**
* IsExternalClockMode - Is External Clock Mode?
*
*
* @retval TRUE or FALSE
*
*/
BOOLEAN
IsExternalClockMode (
IN VOID *FchDataPtr
)
{
UINT8 MISC80;
ReadMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG80 + 2, AccessWidth8, &MISC80);
return ( (BOOLEAN) ((MISC80 & BIT1) == 0) );
}
示例14: MemWndGetDataByte
/*
* MemWndGetDataByte
*/
int_16 MemWndGetDataByte( void )
{
char buf;
ReadMem( Sel, _Offset, &buf, 1 );
_Offset++;
return( buf );
} /* GetDataByte */
示例15: MemWndGetDataWord
/*
* MemWndGetDataWord
*/
int_16 MemWndGetDataWord( void )
{
int_16 buf;
ReadMem( Sel, _Offset, (char *)&buf, sizeof( int_16 ) );
_Offset += sizeof( int_16 );
return( buf );
} /* GetDataWord */