Exemple #1
0
//note: unhook it's not used in this version...
void unhook(void){
	unlockAccess(_getpid());
#if HOOK_ENABLED
	RestoreHook("LoadLibraryA"); 
//	RestoreHook("GetProcAddress");  
	RestoreHook("RegQueryValueExW");  
	RestoreHook("RegQueryValueExA");  
	RestoreHook("RegOpenKeyExW");  
	RestoreHook("RegOpenKeyExA");  
	RestoreHook("ShellExecuteExW");  
//	RestoreHook("VirtualAlloc");  
	RestoreHook("Sleep");  
	RestoreHook("DeleteFileA");  
	RestoreHook("DeleteFileW");  
	RestoreHook("CreateFileW");  
	RestoreHook("ResumeThread");
	RestoreHook("CreateRemoteThread");
	RestoreHook("WriteProcessMemory");
	RestoreHook("CreateProcessW");
	RestoreHook("CreateProcessA");
	RestoreHook("OpenProcess");
#endif
	printf("[hooker] Unhooked\n");
}
Exemple #2
0
void BasicSubmarine::UI::updateUI(double dt, SubWindow& subWindow)
{
    auto vessel = mVessel.lock();
    if (vessel)
    {
        auto vesselPosition = vessel->getState().getLocation();

        double lat = vesselPosition.getLatitude();
        double lng = vesselPosition.getLongitude();
        double alt = vesselPosition.getAltitude();

        std::stringstream locationText;
        locationText << "Position and depth: " << std::endl;
        locationText << std::setprecision(6) << std::fixed << lat << " deg" << std::endl << std::setprecision(6) << std::fixed << lng << " deg" << std::endl;
        locationText << "Depth: " << std::setprecision(2) << alt << " m";

        mLocation->SetText(locationText.str());

        auto ocean = Ocean::getOcean();
        ocean->lockAccess();

        vessel->setHeading(mHeading->GetValue());
        vessel->setPitch(mPitch->GetValue());
        vessel->setVelocity(mVelocity->GetValue() * 0.514444444); //Convert to m/s.

        ocean->unlockAccess();

        BroadbandState state(0.3f, 0.3f, 5.0f);

        std::shared_ptr<GameManager> gameManager = GameManager::getCurrent().lock();
        BOOST_ASSERT_MSG(gameManager, "GameManager null");
        auto eigenrayMap = gameManager->getUsmlManager()->getEigenrayMap();

        //Iterate through all contacts we can hear.
        for (auto& contactKV : eigenrayMap)
        {
            //If the azimuth angle is NaN, that means that there were no eigenrays for this contact.
            if (!isnan(contactKV.second.source_az))
            {
                //Average the intensities across all frequencies.
                //TODO: don't weight them all the same, and figure out what the numbers USML gives us even mean.
                double intensitySum = 0;
                for (auto intensity : contactKV.second.intensity)
                {
                    if (intensity > 299.9999f)
                        continue; //TODO: What causes this?
                    intensitySum += intensity;
                }
                double intensityAverage = intensitySum / contactKV.second.intensity.size();

                float adjustedIntensity = (float)(intensityAverage / 300);

                state.pushContact(BroadbandState::BroadbandContact((float)contactKV.second.source_az, adjustedIntensity, 5.0f));
            }
        }

        mWaterfall->SetState(state);
    }
    else
    {
        subWindow.switchToScreen<MainMenu>();
    }
}