wxIcon wxGxDiscConnectionUI::GetLargeImage(void)
{
	if(CheckReadable())
		return m_Conn48;
	else
		return m_ConnDsbld48;
}
wxIcon wxGxDiscConnectionUI::GetSmallImage(void)
{
	if(CheckReadable())
		return m_Conn16;
	else
		return m_ConnDsbld16;
}
예제 #3
0
PHSafeObject HSafeObject::Convert( LPVOID h,size_t sz,DWORD id )
  {
 return ( !h                                   ||
          !CheckReadable(h,sz)                 ||
          ((PHSafeObject)h)->Allocated != TRUE ||
          ((PHSafeObject)h)->SMID      != id
        )?NULL:((PHSafeObject)h);
}
예제 #4
0
BOOL HSafeObject::Use( PHSafeObject p )
  {
    if ( !p                                    ||
         !CheckReadable(p,sizeof(HSafeObject)) ||
         p->Allocated != TRUE
       ) return FALSE;

    p->Usage++;
 return TRUE;
}
예제 #5
0
BOOL HSafeObject::Release( PHSafeObject p )
  {
    if ( !p                                    ||
         !CheckReadable(p,sizeof(HSafeObject)) ||
         p->Allocated != TRUE
       ) return FALSE;

    if (p->Usage) p->Usage--;
    if (!p->Usage) {
      p->Destroy();
      delete p;
    }
 return TRUE;
}
예제 #6
0
BOOL MYRTLEXP InitHook_Proc( PProcHookInfo si,void *RTLProc,void *UserProc )
  {  static BYTE jmpCode[ 2 ]  = { 0xFF, 0x25 }; // jmp  [dword ptr]
     static BYTE callCode[ 2 ] = { 0xFF, 0x15 }; // call [dword ptr]

     BOOL   isRestore = RTLProc == NULL;
     void  *Prev;

     if ( !si ||
          (RTLProc!=NULL) != (UserProc!=NULL) )
       return FALSE;

     if (!RTLProc)  RTLProc = si->OldProc;
     if (!UserProc) UserProc = (void*)si->CallSpace;

//Find addr
     do{
       //Check valid`n`writable
       if ( !RTLProc ||
            !CheckReadable(RTLProc,sizeof(DWORD)*2 ) ||
            !MakeAddrWritable(RTLProc) )
         return FALSE;

       Prev = RTLProc;
       //JMP [] | CALL []
       if ( memcmp( RTLProc, jmpCode,  sizeof(jmpCode)/sizeof(jmpCode[0]) ) == 0 ||
            memcmp( RTLProc, callCode, sizeof(callCode)/sizeof(callCode[0]) ) == 0 ) {
         RTLProc = (void*)**((LPDWORD*)(((LPBYTE)RTLProc)+2));

         //Allready ptched
         if ( RTLProc == UserProc )
           break;

       } else
         break;
     }while( 1 );

//Restore old
     if ( RTLProc == UserProc ) {
       if ( isRestore ) {
         ((LPDWORD)Prev)[0] = si->SubstCode[0];
         ((LPDWORD)Prev)[1] = si->SubstCode[1];
       }
       return TRUE;
     }

//Code patch
  return Subst_Function( (LPBYTE)RTLProc,UserProc,si );
}
예제 #7
0
bool Stream::ReadToStream(Environment &env, Stream &streamDst,
			size_t bytesUnit, bool finalizeFlag, const Function *pFuncFilter)
{
	Signal &sig = env.GetSignal();
	if (!CheckReadable(sig) || !streamDst.CheckWritable(sig)) return false;
	Attribute attr;
	bool validAttrFlag = false;
	if (finalizeFlag) {
		validAttrFlag = GetAttribute(attr);
	}
	AutoPtr<Memory> pMemory(new MemoryHeap(bytesUnit));
	char *buff = reinterpret_cast<char *>(pMemory->GetPointer());
	for (;;) {
		size_t bytesRead = Read(sig, buff, bytesUnit);
		if (bytesRead == 0) break;
		if (pFuncFilter != nullptr) {
			Value value(new Object_binary(env, buff, bytesUnit, false));
			AutoPtr<Argument> pArgSub(new Argument(pFuncFilter));
			if (!pArgSub->StoreValue(env, value)) return false;
			Value rtn = pFuncFilter->Eval(env, *pArgSub);
			if (sig.IsSignalled()) return false;
			if (rtn.Is_binary()) {
				const Binary &buffRtn = rtn.GetBinary();
				streamDst.Write(sig, buffRtn.data(), buffRtn.size());
				if (sig.IsSignalled()) return false;
				continue;
			}
		}
		streamDst.Write(sig, buff, bytesRead);
		if (sig.IsSignalled()) return false;
	}
	if (sig.IsSignalled()) return false;
	if (finalizeFlag) {
		streamDst.Close();
		if (sig.IsSignalled()) return false;
		if (validAttrFlag) streamDst.SetAttribute(attr);
		return true;
	}
	if (!streamDst.Flush(sig)) return false;
	return true;
}
예제 #8
0
bool Stream::Compare(Signal &sig, Stream &stream)
{
	if (!CheckReadable(sig) || !stream.CheckReadable(sig)) return false;
	const size_t bytesBuff = 1024 * 16;
	AutoPtr<Memory> pMemory(new MemoryHeap(bytesBuff * 2));
	void *buff1 = pMemory->GetPointer(0);
	void *buff2 = pMemory->GetPointer(bytesBuff);
	bool sameFlag = false;
	for (;;) {
		size_t bytesRead1 = Read(sig, buff1, bytesBuff);
		if (sig.IsSignalled()) return false;
		size_t bytesRead2 = stream.Read(sig, buff2, bytesBuff);
		if (sig.IsSignalled()) return false;
		if (bytesRead1 != bytesRead2) {
			break;
		} else if (bytesRead1 == 0) {
			sameFlag = true;
			break;
		} else if (::memcmp(buff1, buff2, bytesRead1) != 0) {
			break;
		}
	}
	return sameFlag;
}