Beispiel #1
0
bool psCharAppearance::ChangeMaterial(const char* part, const char* materialName)
{
    if (!part || !materialName)
        return false;

    csString materialNameParsed = ParseStrings(part, materialName);

    bool failed = false;
    csRef<iMaterialWrapper> material = psengine->GetLoader()->LoadMaterial(materialNameParsed, &failed);
    if(!failed)
    {
        if(!material.IsValid())
        {
            Attachment attach(false);
            attach.materialName = materialNameParsed;
            attach.partName = part;
            if(delayedAttach.IsEmpty())
            {
                psengine->RegisterDelayedLoader(this);
            }
            delayedAttach.PushBack(attach);

            return true;
        }

        ProcessAttach(material, materialName, part);
        return true;
    }

    // The material isn't available to load.
    csReport(psengine->GetObjectRegistry(), CS_REPORTER_SEVERITY_NOTIFY,
        "planeshift.character.appearance", "Attempted to change to material %s and failed; material not found.",
        materialNameParsed.GetData());
    return false;
}
Beispiel #2
0
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    g_hModule = (HMODULE)hModule;

    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        ProcessAttach();

        AddMenu();

        ::MessageBox(NULL, "我来了", NULL, MB_OK);
    }
    else if (ul_reason_for_call == DLL_PROCESS_DETACH)
    {
        ProcessDetach();

        assert(g_hMenu != NULL);
        BOOL bRet = DeleteMenu(g_hMenu, g_nMenus - 1, MF_BYPOSITION);
        if (!bRet)
        {
            MessageBox(NULL, "DeleteMenu Failed!!", NULL, MB_OK);
        }

        ::MessageBox(NULL, "我走了", NULL, MB_OK);
    }

    return TRUE;
}
Beispiel #3
0
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
{
    (void)hModule;
    (void)lpReserved;
    BOOL ret;

    if (DetourIsHelperProcess()) {
        return TRUE;
    }

    switch (dwReason) {
      case DLL_PROCESS_ATTACH:
        DetourRestoreAfterWith();
        OutputDebugString("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
                          " DllMain DLL_PROCESS_ATTACH\n");
        return ProcessAttach(hModule);
      case DLL_PROCESS_DETACH:
        ret = ProcessDetach(hModule);
        OutputDebugString("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
                          " DllMain DLL_PROCESS_DETACH\n");
        return ret;
      case DLL_THREAD_ATTACH:
        OutputDebugString("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
                          " DllMain DLL_THREAD_ATTACH\n");
        return ThreadAttach(hModule);
      case DLL_THREAD_DETACH:
        OutputDebugString("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
                          " DllMain DLL_THREAD_DETACH\n");
        return ThreadDetach(hModule);
    }
    return TRUE;
}
Beispiel #4
0
bool psCharAppearance::CheckLoadStatus()
{
    if(!delayedAttach.IsEmpty())
    {
        Attachment attach = delayedAttach.Front();

        if(attach.factory)
        {
            csRef<iMeshFactoryWrapper> factory = psengine->GetLoader()->LoadFactory(attach.factName);

            if(factory.IsValid())
            {
                if(!attach.materialName.IsEmpty())
                {
                    csRef<iMaterialWrapper> material = psengine->GetLoader()->LoadMaterial(attach.materialName);
                    if(material.IsValid())
                    {
                        ProcessAttach(factory, material, attach.factName, attach.socket);
                        delayedAttach.PopFront();
                    }
                }
                else
                {
                    ProcessAttach(factory, NULL, attach.factName, attach.socket);
                    delayedAttach.PopFront();
                }
            }
        }
        else
        {
            csRef<iMaterialWrapper> material = psengine->GetLoader()->LoadMaterial(attach.materialName);
            if(material.IsValid())
            {
                ProcessAttach(material, attach.materialName, attach.partName);
                delayedAttach.PopFront();
            }
        }

        return true;
    }
    else
    {
        psengine->UnregisterDelayedLoader(this);
        return false;
    }
}
Beispiel #5
0
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
    /*
    char Path[255];
    GetModuleFileName(NULL, Path, 255);    
    
    char *ptr = strrchr(Path, '\\');

    CString FileName = ptr + 1;

    FileName.MakeLower();
    if (FileName == "ida.exe")
    {
        HMODULE hHandle = GetModuleHandle("ida.wll");
        if (hHandle == NULL) return TRUE;
        // FreeLibraryAndExitThread((HINSTANCE)hModule, 1);
    }
    */

    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
            DisableThreadLibraryCalls((HINSTANCE)hModule);
#ifdef _DEBUG
            OutputDebugString(""[+][IMATINIB] DLL_PROCESS_ATTACH\n");
#endif
            fflush(stdout);
            Sleep(50);
            Sleep(50);
            DetourRestoreAfterWith();
            ProcessAttach((HINSTANCE)hModule);
            break;

        case DLL_PROCESS_DETACH:
#ifdef _DEBUG
            OutputDebugString(""[+][IMATINIB] DLL_PROCESS_DETACH\n");
#endif
            ProcessDetach((HINSTANCE)hModule);
            break;

        case DLL_THREAD_ATTACH:
#ifdef _DEBUG
            OutputDebugString(""[+][IMATINIB] DLL_THREAD_ATTACH\n");
#endif
            ThreadAttach((HINSTANCE)hModule);
            break;

        case DLL_THREAD_DETACH:
#ifdef _DEBUG
            OutputDebugString(""[+][IMATINIB] DLL_THREAD_DETACH\n");
#endif
            ThreadDetach((HINSTANCE)hModule);
            break;
    }

    return TRUE;
}
Beispiel #6
0
DWORD main(int argc, char **argv)
{
    (void)argc;
    (void)argv;

    printf("testapi: Starting\n");
    ProcessAttach(NULL);
    Sleep(100);
    ProcessDetach(NULL);

    return 0;
}
Beispiel #7
0
bool psCharAppearance::Attach(const char* socketName, const char* meshFactName, const char* materialName)
{
    if (!socketName || !meshFactName || !state.IsValid())
    {
        return false;
    }
    CS_ASSERT(state.IsValid());

    csRef<iSpriteCal3DSocket> socket = state->FindSocket( socketName );
    if ( !socket )
    {
        Notify2(LOG_CHARACTER, "Socket %s not found.", socketName);
        return false;
    }

    bool failed = false;
    csRef<iMeshFactoryWrapper> factory = psengine->GetLoader()->LoadFactory(meshFactName, &failed);
    if(failed)
    {
        Notify2(LOG_CHARACTER, "Mesh factory %s not found.", meshFactName );
        return false;
    }

    csRef<iMaterialWrapper> material;
    if(materialName != NULL)
    {
        psengine->GetLoader()->LoadMaterial(materialName, &failed);
        if(failed)
        {
            Notify2(LOG_CHARACTER, "Material %s not found.", materialName);
            return false;
        }
    }

    if(!factory.IsValid() || (materialName != NULL && !material.IsValid()))
    {
        Attachment attach(true);
        attach.factName = meshFactName;
        attach.materialName = materialName;
        attach.socket = socket;
        if(delayedAttach.IsEmpty())
        {
            psengine->RegisterDelayedLoader(this);
        }
        delayedAttach.PushBack(attach);
    }
    else
    {
        ProcessAttach(factory, material, meshFactName, socket);
    }

    return true;
}
Beispiel #8
0
void psCharAppearance::ProcessAttach(iMeshFactoryWrapper* factory, iMaterialWrapper* material, const char* meshFactName, csRef<iSpriteCal3DSocket> socket)
{
     csRef<iMeshWrapper> meshWrap = engine->CreateMeshWrapper( factory, meshFactName );

     if(material != NULL)
     {
         meshWrap->GetMeshObject()->SetMaterialWrapper(material);
     }

    ProcessAttach(meshWrap, socket);

    psengine->GetCelClient()->HandleItemEffect(factory->QueryObject()->GetName(), socket->GetMeshWrapper(), false, socket->GetName(), &effectids, &lightids);
}
Beispiel #9
0
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
{
	switch (dwReason) {
	  case DLL_PROCESS_ATTACH:
		return ProcessAttach(hModule);
	  case DLL_PROCESS_DETACH:
		return ProcessDetach(hModule);
	  case DLL_THREAD_ATTACH:
		return ThreadAttach(hModule);
	  case DLL_THREAD_DETACH:
		return ThreadDetach(hModule);
	}
	return TRUE;
}
Beispiel #10
0
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
    gModule = hModule;
    if (DLL_PROCESS_ATTACH == dwReason)
        return ProcessAttach();
    if (DLL_PROCESS_DETACH == dwReason)
        return ProcessDetach();
    if (DLL_THREAD_ATTACH == dwReason)
        return ThreadAttach();
    if (DLL_THREAD_DETACH == dwReason)
        return ThreadDetach();

    return TRUE;
}
Beispiel #11
0
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
	switch(fdwReason)
	{
	case DLL_PROCESS_ATTACH:
		return ProcessAttach(hinstDLL, fdwReason, lpvReserved);
	case DLL_PROCESS_DETACH:
		return ProcessDetach(hinstDLL, fdwReason, lpvReserved);
	case DLL_THREAD_ATTACH:
		return ThreadAttach(hinstDLL, fdwReason, lpvReserved);
	case DLL_THREAD_DETACH:
		return ThreadDetach(hinstDLL, fdwReason, lpvReserved);
	}
	return true;
}
Beispiel #12
0
int main( void )
{
    int i = 0;
	int j, k = 1;
	dFILE *df;
        bHEAD *bh;
	dFIELD *field[2];
	char   buff[4096];
	long   l, ll;

	HANDLE hsem;
	TS_COM_PROPS tscp1;

	strncpy(buff, "abcdefg", 10);
	strncpy(buff, "abcdefg", 3);

/*	ProcessAttach();
        field[0] = "BH";
        field[1] = NULL;
        bh = IndexBuild("lz0.dbf", field, "lz0", BTREE_FOR_CLOSEDBF);
        IndexClose(bh);
	ProcessDetach();
        return  0;

	ProcessAttach();
	df = dAwake("e:\\wmtasql\\ls.dbf", DOPENPARA);
	ProcessDetach();
	return  0;

	get1rec(df);
        dbtFromFile(df, 1, "e:\\wmtasql\\debug\\a1");
	put_fld(df, 0, "1");
	putrec(df);

	get1rec(df);
	dbtFromFile(df, 1, "e:\\wmtasql\\debug\\a2");
	put_fld(df, 0, "2");
	putrec(df);

	get1rec(df);
	dbtFromFile(df, 1, "e:\\wmtasql\\debug\\a3");
	put_fld(df, 0, "3");
	putrec(df);

	dseek(df, 0, dSEEK_SET);
	get1rec(df);
	dbtFromFile(df, 1, "e:\\wmtasql\\debug\\aa.c");
	put_fld(df, 0, "2");
	put1rec(df);
	dbtToFile(df, 1, "e:\\wmtasql\\debug\\bb.c");
	dclose(df);
	return  2;*/

	/*strcpy(field[0].field,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	field[0].fieldtype = 'C';
	field[0].fieldlen = 10;
	field[0].fielddec = 0;
	field[1].field[0] = '\0';

	hBuildCodeLib( "d:\\code\\code.dbf" );
	//return 0;
*/
/*	ProcessAttach();
	df = dopen("e:\\wmtasql\\ls.dbf", DOPENPARA);
	dseek(df, 10, dSEEK_SET);
	RecDelete(df);
	dseek(df, 18, dSEEK_SET);
	RecDelete(df);
	dpack(df);
	dclose(df);
	ProcessDetach();
	return  0;

*/

	tscp1.packetType = 'Q';
	tscp1.msgType = 'Q';
	tscp1.len = strlen("lz0.dbf");
	tscp1.lp = cmTS_OPEN_DBF;

	memcpy(buff, &tscp1, sizeof(TS_COM_PROPS));
	memcpy(buff+sizeof(TS_COM_PROPS), "lz0.dbf", 8);

	justRunASQL(buff, buff, 4096);

	ll = l = ((TS_COM_PROPS *)buff)->lp;

	tscp1.packetType = 'Q';
	tscp1.msgType = 'Q';
	tscp1.len = 8;
	tscp1.lp = cmTS_REC_FETCH;
	memcpy(buff, &tscp1, sizeof(TS_COM_PROPS));
	memcpy(buff+sizeof(TS_COM_PROPS), &l, 4);
	l = 1;
	memcpy(buff+sizeof(TS_COM_PROPS)+4, &l, 4);

	justRunASQL(buff, buff, 4096);

	tscp1.packetType = 'Q';
	tscp1.msgType = 'Q';
	tscp1.len = 8;
	tscp1.lp = cmTS_CLOSE_DBF;
	memcpy(buff, &tscp1, sizeof(TS_COM_PROPS));
	memcpy(buff+sizeof(TS_COM_PROPS), &ll, 4);
	justRunASQL(buff, buff, 4096);

	return  0;
	buf[0] = "thread0 ";
	buf[1] = "thread1 ";
	buf[2] = "thread2 ";
	buf[3] = "thread3 ";
	buf[4] = "thread4 ";
	buf[5] = "thread5 ";
	buf[6] = "thread6 ";


	ProcessAttach();
	printf("init success\n");

	hsem = CreateSemaphore(NULL, 1, 1, NULL);
	j = wmtAskQS(1234, "Tgask", AsqlExprInFile|Asql_USEENV, &asqlEnv, NULL, NULL, buff, 255, hsem);
	if( j >= asqlTaskThreadNum )
		printf("no thread to service\n");
	else
		printf("thread %d is servicing\n", j);
	

    {
	MSG msg1;

	while( 1 ) {
	    GetMessage(&msg1, NULL, 0, 65535);
	    printf("message received: %d\n", msg1.message);
	    if( msg1.message == ASQL_ENDTASK_MSG ) {
		break;
	    }
	}
	ReleaseSemaphore(hsem, 1, NULL);
    }
    CloseHandle(hsem);

	printf("asql finish. return value %s", buff);
	
	ProcessDetach();
	return  0;

}