git-svn-id: https://localhost/svn/Project64/trunk@13 111125ac-702d-7242-af9c-5ba8ae61c1ef
This commit is contained in:
parent
81387784f5
commit
05ac90c959
|
@ -31,6 +31,10 @@ Project: "Project64"=".\Source\Project64\Project64.dsp" - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Project64/Project 64 1.7", RCBAAAAA
|
||||
.\source
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
|
|
@ -180,13 +180,13 @@ void CC_Core::SetSettings ( )
|
|||
if (g_HaveDebugger)
|
||||
{
|
||||
g_ShowUnhandledMemory = g_Settings->LoadBool(Debugger_ShowUnhandledMemory);
|
||||
g_ShowDListAListCount = g_Settings->LoadDword(Debugger_ShowDListAListCount);
|
||||
g_ShowDListAListCount = g_Settings->LoadBool(Debugger_ShowDListAListCount);
|
||||
} else {
|
||||
g_ShowUnhandledMemory = false;
|
||||
g_ShowUnhandledMemory = false;
|
||||
|
||||
}
|
||||
g_ShowCPUPer = g_Settings->LoadDword(UserInterface_ShowCPUPer);
|
||||
g_ShowCPUPer = g_Settings->LoadBool(UserInterface_ShowCPUPer);
|
||||
g_ShowTLBMisses = false;
|
||||
g_UseTlb = g_Settings->LoadBool(Game_UseTlb);
|
||||
g_CPU_Type = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
||||
|
@ -531,30 +531,28 @@ void ApplyGSButtonCheats ( void )
|
|||
void ChangePluginFunc ( void )
|
||||
{
|
||||
g_Notify->DisplayMessage(0,MSG_PLUGIN_INIT);
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
/*if (g_Settings->LoadDword(GFX_PluginChanged))
|
||||
if (g_Settings->LoadBool(Plugin_GFX_Changed))
|
||||
{
|
||||
g_Plugins->Reset(PLUGIN_TYPE_GFX);
|
||||
}
|
||||
if (g_Settings->LoadDword(AUDIO_PluginChanged))
|
||||
if (g_Settings->LoadBool(Plugin_AUDIO_Changed))
|
||||
{
|
||||
g_Plugins->Reset(PLUGIN_TYPE_AUDIO);
|
||||
}
|
||||
if (g_Settings->LoadDword(CONT_PluginChanged))
|
||||
if (g_Settings->LoadBool(Plugin_CONT_Changed))
|
||||
{
|
||||
g_Plugins->Reset(PLUGIN_TYPE_CONTROLLER);
|
||||
}
|
||||
if (g_Settings->LoadDword(RSP_PluginChanged) ||
|
||||
g_Settings->LoadDword(AUDIO_PluginChanged) ||
|
||||
g_Settings->LoadDword(GFX_PluginChanged))
|
||||
if (g_Settings->LoadBool(Plugin_RSP_Changed) ||
|
||||
g_Settings->LoadBool(Plugin_AUDIO_Changed) ||
|
||||
g_Settings->LoadBool(Plugin_GFX_Changed))
|
||||
{
|
||||
g_Plugins->Reset(PLUGIN_TYPE_RSP);
|
||||
}
|
||||
g_Settings->SaveDword(RSP_PluginChanged, (DWORD)false);
|
||||
g_Settings->SaveDword(AUDIO_PluginChanged,(DWORD)false);
|
||||
g_Settings->SaveDword(GFX_PluginChanged, (DWORD)false);
|
||||
g_Settings->SaveDword(CONT_PluginChanged, (DWORD)false);
|
||||
*/
|
||||
g_Settings->SaveBool(Plugin_RSP_Changed, false);
|
||||
g_Settings->SaveBool(Plugin_AUDIO_Changed,false);
|
||||
g_Settings->SaveBool(Plugin_GFX_Changed, false);
|
||||
g_Settings->SaveBool(Plugin_CONT_Changed, false);
|
||||
g_Notify->RefreshMenu();
|
||||
if (!g_Plugins->Initiate(g_N64System)) {
|
||||
g_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT);
|
||||
|
|
|
@ -19,6 +19,17 @@ CN64System::CN64System ( CNotification * Notify, CPlugins * Plugins ):
|
|||
CPU_Handle = 0;
|
||||
CPU_ThreadID = 0;
|
||||
|
||||
_Settings->RegisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Game_Plugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Game_Plugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Game_Plugin_Controller,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->RegisterChangeCB(Game_Plugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
|
||||
//InterpreterOpcode = NULL;
|
||||
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
|
||||
Reset();
|
||||
|
@ -32,6 +43,34 @@ CN64System::~CN64System ( void ) {
|
|||
}
|
||||
Reset();
|
||||
CloseHandle(m_hPauseEvent);
|
||||
|
||||
_Settings->UnregisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Game_Plugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Game_Plugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Game_Plugin_Controller,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
_Settings->UnregisterChangeCB(Game_Plugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
|
||||
}
|
||||
|
||||
void CN64System::PluginChanged ( CN64System * _this )
|
||||
{
|
||||
if (_Settings->LoadBool(GameRunning_LoadingInProgress))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_Settings->LoadBool(GameRunning_CPU_Running) != 0) {
|
||||
_this->ExternalEvent(ChangePlugins);
|
||||
} else {
|
||||
_this->Plugins()->Reset();
|
||||
if (g_Notify)
|
||||
{
|
||||
g_Notify->RefreshMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CN64System::ExternalEvent ( SystemEvent Event ) {
|
||||
|
@ -242,10 +281,10 @@ void CN64System::ExternalEvent ( SystemEvent Event ) {
|
|||
|
||||
void CN64System::RunFileImage ( const char * FileLoc )
|
||||
{
|
||||
bool RomLoading = _Settings->LoadBool(Info_RomLoading);
|
||||
bool RomLoading = _Settings->LoadBool(GameRunning_LoadingInProgress);
|
||||
if (!RomLoading)
|
||||
{
|
||||
_Settings->SaveBool(Info_RomLoading,true);
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,true);
|
||||
|
||||
HANDLE * hThread = new HANDLE;
|
||||
*hThread = NULL;
|
||||
|
@ -277,7 +316,7 @@ void CN64System::LoadFileImage ( FileImageInfo * Info )
|
|||
WriteTrace(TraceDebug,"CN64System::LoadFileImage 2");
|
||||
|
||||
//Mark the rom as loading
|
||||
_Settings->SaveBool(Info_RomLoading,true);
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,true);
|
||||
_this->_Notify->RefreshMenu();
|
||||
|
||||
WriteTrace(TraceDebug,"CN64System::LoadFileImage 3");
|
||||
|
@ -287,7 +326,7 @@ void CN64System::LoadFileImage ( FileImageInfo * Info )
|
|||
if (!Rom->LoadN64Image(ImageInfo.FileName.c_str())) {
|
||||
_this->_Notify->DisplayError(Rom->GetError());
|
||||
delete Rom;
|
||||
_Settings->SaveBool(Info_RomLoading,false);
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,false);
|
||||
_this->_Notify->RefreshMenu();
|
||||
return;
|
||||
}
|
||||
|
@ -310,7 +349,7 @@ void CN64System::LoadFileImage ( FileImageInfo * Info )
|
|||
WriteTrace(TraceDebug,"CN64System::LoadFileImage 7");
|
||||
_this->SetupSystem(Rom,true);
|
||||
WriteTrace(TraceDebug,"CN64System::LoadFileImage 8");
|
||||
_Settings->SaveBool(Info_RomLoading,false);
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,false);
|
||||
_this->_Notify->RefreshMenu();
|
||||
WriteTrace(TraceDebug,"CN64System::LoadFileImage 9");
|
||||
if (_Settings->LoadDword(Setting_AutoStart) != 0)
|
||||
|
@ -381,7 +420,7 @@ void CN64System::StartEmulation2 ( bool NewThread )
|
|||
WriteTrace(TraceDebug,"CN64System::StartEmulation 8");
|
||||
if (!_Plugins->Initiate(this)) {
|
||||
WriteTrace(TraceDebug,"CN64System::StartEmulation 8a");
|
||||
_Settings->SaveBool(Info_RomLoading,false);
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,false);
|
||||
_Notify->DisplayError(MSG_PLUGIN_NOT_INIT);
|
||||
//Set handle to NULL so this thread is not terminated
|
||||
CPU_Handle = NULL;
|
||||
|
|
|
@ -109,6 +109,7 @@ class CN64System :
|
|||
void CpuStopped ( void );
|
||||
void Pause ( void );
|
||||
|
||||
static void PluginChanged ( CN64System * _this );
|
||||
|
||||
//Function in CMipsMemory_CallBack
|
||||
virtual bool WriteToProtectedMemory (DWORD Address, int length);
|
||||
|
|
|
@ -35,7 +35,6 @@ class CGfxPlugin {
|
|||
GFXDEBUG_INFO m_GFXDebug;
|
||||
void * hDll;
|
||||
bool m_Initilized, m_RomOpen;
|
||||
bool m_loaded;
|
||||
PLUGIN_INFO m_PluginInfo;
|
||||
|
||||
void UnloadPlugin ( void );
|
||||
|
|
|
@ -9,7 +9,6 @@ enum SettingID {
|
|||
Default_Constant,
|
||||
|
||||
//information - temp keys
|
||||
Info_RomLoading,
|
||||
Info_ShortCutsChanged,
|
||||
|
||||
//Support Files
|
||||
|
@ -187,15 +186,20 @@ enum SettingID {
|
|||
//Plugins
|
||||
Plugin_RSP_Current,
|
||||
Plugin_RSP_CurVer,
|
||||
Plugin_RSP_Changed,
|
||||
Plugin_GFX_Current,
|
||||
Plugin_GFX_CurVer,
|
||||
Plugin_GFX_Changed,
|
||||
Plugin_AUDIO_Current,
|
||||
Plugin_AUDIO_CurVer,
|
||||
Plugin_AUDIO_Changed,
|
||||
Plugin_CONT_Current,
|
||||
Plugin_CONT_CurVer,
|
||||
Plugin_CONT_Changed,
|
||||
Plugin_UseHleGfx,
|
||||
Plugin_UseHleAudio,
|
||||
|
||||
|
||||
//Cheats
|
||||
Cheat_Entry,
|
||||
Cheat_Active,
|
||||
|
|
|
@ -67,7 +67,8 @@ void CSettingTypeGameIndex::LoadDefault ( int Index, stdstr & Value ) const
|
|||
//Update the settings
|
||||
void CSettingTypeGameIndex::Save ( int Index, bool Value )
|
||||
{
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save ( int Index, ULONG Value )
|
||||
|
|
|
@ -64,7 +64,6 @@ void CSettings::AddHandler ( SettingID TypeID, CSettingType * Handler )
|
|||
void CSettings::AddHowToHandleSetting ()
|
||||
{
|
||||
//information - temp keys
|
||||
AddHandler(Info_RomLoading, new CSettingTypeTempBool(false));
|
||||
AddHandler(Info_ShortCutsChanged, new CSettingTypeTempBool(false));
|
||||
|
||||
|
||||
|
@ -211,6 +210,8 @@ void CSettings::AddHowToHandleSetting ()
|
|||
AddHandler(Directory_TextureSelected, new CSettingTypeApplication("Directory","Texture Dir",Directory_InstantSaveInitial));
|
||||
AddHandler(Directory_TextureUseSelected, new CSettingTypeApplication("Directory","Texture Dir - Use Selected",false));
|
||||
|
||||
AddHandler(Directory_LastSave, new CSettingTypeApplication("Directory","Last Save Directory", Directory_InstantSave));
|
||||
|
||||
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
|
||||
AddHandler(GameRunning_CPU_Running, new CSettingTypeTempBool(false));
|
||||
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false));
|
||||
|
@ -254,6 +255,11 @@ void CSettings::AddHowToHandleSetting ()
|
|||
AddHandler(Plugin_AUDIO_CurVer, new CSettingTypeApplication("Plugin","Audio Dll Ver", ""));
|
||||
AddHandler(Plugin_CONT_CurVer, new CSettingTypeApplication("Plugin","Controller Dll Ver", ""));
|
||||
|
||||
AddHandler(Plugin_RSP_Changed, new CSettingTypeTempBool(true));
|
||||
AddHandler(Plugin_GFX_Changed, new CSettingTypeTempBool(true));
|
||||
AddHandler(Plugin_AUDIO_Changed, new CSettingTypeTempBool(true));
|
||||
AddHandler(Plugin_CONT_Changed, new CSettingTypeTempBool(true));
|
||||
|
||||
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP","HLE GFX",true));
|
||||
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP","HLE Audio",false));
|
||||
|
||||
|
|
|
@ -13,3 +13,4 @@
|
|||
#include <common/Smart Pointer.h>
|
||||
#include <common/Ini File Class.h>
|
||||
#include <common/md5.h>
|
||||
#include <common/Registry.h>
|
||||
|
|
|
@ -499,7 +499,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://www.emutalk.net/forumdisplay.php?f=6", NULL, NULL, SW_SHOWMAXIMIZED); break;
|
||||
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break;
|
||||
case ID_HELP_HOMEPAGE: ShellExecute(NULL, "open", "http://www.pj64-emu.com", NULL, NULL, SW_SHOWMAXIMIZED); break;
|
||||
case ID_HELP_ABOUT: _Gui->AboutBox(); break;
|
||||
case ID_HELP_ABOUTSETTINGFILES: _Gui->AboutIniBox(); break;
|
||||
|
|
|
@ -252,6 +252,8 @@ CShortCuts::~CShortCuts()
|
|||
|
||||
stdstr CShortCuts::ShortCutString( int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel )
|
||||
{
|
||||
CGuard CS(m_CS);
|
||||
|
||||
MSC_MAP::iterator MenuItem = m_ShortCuts.find(MenuID);
|
||||
if (MenuItem == m_ShortCuts.end()) { return ""; }
|
||||
|
||||
|
@ -274,6 +276,8 @@ stdstr CShortCuts::ShortCutString( int MenuID, CMenuShortCutKey::ACCESS_MODE Acc
|
|||
|
||||
LanguageStringID CShortCuts::GetMenuItemName( WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access )
|
||||
{
|
||||
CGuard CS(m_CS);
|
||||
|
||||
for (MSC_MAP::iterator Item = m_ShortCuts.begin(); Item != m_ShortCuts.end(); Item++)
|
||||
{
|
||||
CShortCutItem & short_cut = Item->second;
|
||||
|
@ -294,6 +298,8 @@ void CShortCuts::AddShortCut( WORD ID, LanguageStringID Section, LanguageStringI
|
|||
|
||||
void CShortCuts::Load (bool InitialValues )
|
||||
{
|
||||
CGuard CS(m_CS);
|
||||
|
||||
m_ShortCuts.clear();
|
||||
|
||||
AddShortCut(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, CMenuShortCutKey::NOT_IN_FULLSCREEN );
|
||||
|
@ -406,6 +412,8 @@ void CShortCuts::Load (bool InitialValues )
|
|||
|
||||
void CShortCuts::Save( void )
|
||||
{
|
||||
CGuard CS(m_CS);
|
||||
|
||||
stdstr FileName = _Settings->LoadString(SupportFile_ShortCuts);
|
||||
FILE *file = fopen(FileName.c_str(),"w");
|
||||
if (file == NULL)
|
||||
|
@ -433,6 +441,8 @@ void CShortCuts::Save( void )
|
|||
|
||||
HACCEL CShortCuts::GetAcceleratorTable ( void )
|
||||
{
|
||||
CGuard CS(m_CS);
|
||||
|
||||
//Generate a ACCEL list
|
||||
CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING;
|
||||
if (_Settings->LoadBool(GameRunning_CPU_Running))
|
||||
|
|
|
@ -83,6 +83,7 @@ class CShortCuts
|
|||
typedef LanguageStringID LangStr;
|
||||
|
||||
MSC_MAP m_ShortCuts;
|
||||
CriticalSection m_CS;
|
||||
|
||||
void AddShortCut ( WORD ID, LangStr Section, LangStr LangID, CMenuShortCutKey::ACCESS_MODE AccessMode);
|
||||
|
||||
|
|
|
@ -233,6 +233,15 @@ void CGamePluginPage::ApplyComboBoxes ( void )
|
|||
} else {
|
||||
_Settings->DeleteSetting(cb_iter->first);
|
||||
}
|
||||
switch (cb_iter->first)
|
||||
{
|
||||
case Game_Plugin_RSP: _Settings->SaveBool(Plugin_RSP_Changed,true); break;
|
||||
case Game_Plugin_Gfx: _Settings->SaveBool(Plugin_GFX_Changed,true); break;
|
||||
case Game_Plugin_Audio: _Settings->SaveBool(Plugin_AUDIO_Changed,true); break;
|
||||
case Game_Plugin_Controller: _Settings->SaveBool(Plugin_CONT_Changed,true); break;
|
||||
default:
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
}
|
||||
if (ComboBox->IsReset())
|
||||
{
|
||||
|
|
|
@ -214,6 +214,15 @@ void COptionPluginPage::ApplyComboBoxes ( void )
|
|||
const CPluginList::PLUGIN * Plugin = (const CPluginList::PLUGIN *)ComboBox->GetItemDataPtr(index);
|
||||
|
||||
_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str());
|
||||
switch (Plugin->Info.Type)
|
||||
{
|
||||
case PLUGIN_TYPE_RSP: _Settings->SaveBool(Plugin_RSP_Changed,true); break;
|
||||
case PLUGIN_TYPE_GFX: _Settings->SaveBool(Plugin_GFX_Changed,true); break;
|
||||
case PLUGIN_TYPE_AUDIO: _Settings->SaveBool(Plugin_AUDIO_Changed,true); break;
|
||||
case PLUGIN_TYPE_CONTROLLER: _Settings->SaveBool(Plugin_CONT_Changed,true); break;
|
||||
default:
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
}
|
||||
if (ComboBox->IsReset())
|
||||
{
|
||||
|
|
|
@ -55,42 +55,79 @@ void TestValidBinaryThread ( )
|
|||
char Subkey[] = "\x84\x5E\x1A\x5C\x02\x4E"; // ".pj64z";
|
||||
ValidateDecryptString(Subkey,sizeof(Subkey) - 1);
|
||||
|
||||
char Subkey2[] = "\xF9\x1C\x09\x12\x03\x16\x13\x17\x19\x0C\x1A\x7C\x02"; // "SOFTWARE\PJ64";
|
||||
ValidateDecryptString(Subkey2,sizeof(Subkey2) - 1);
|
||||
|
||||
CRegistry Registry;
|
||||
BOOL bRes = Registry.Open(HKEY_LOCAL_MACHINE,Subkey2,KEY_ALL_ACCESS,true);
|
||||
DWORD Length = 0;
|
||||
if (bRes)
|
||||
{
|
||||
HKEY hKeyResults = 0;
|
||||
long lResult;
|
||||
Length = Registry.GetValueSize("data");
|
||||
|
||||
lResult = RegOpenKey( HKEY_CLASSES_ROOT,Subkey,&hKeyResults);
|
||||
if (lResult == ERROR_SUCCESS)
|
||||
if (Length == -1)
|
||||
{
|
||||
DWORD Type, Length = 0;
|
||||
lResult = RegQueryValueEx(hKeyResults,"data",NULL,&Type,NULL,&Length);
|
||||
if (lResult == ERROR_SUCCESS && Type == REG_BINARY && Length > 0)
|
||||
Length = 0;
|
||||
bRes = false;
|
||||
}
|
||||
|
||||
if (bRes && Length > 0)
|
||||
{
|
||||
DWORD Type;
|
||||
RunData = AUTO_PTR<BYTE>(new BYTE[Length]);
|
||||
bRes = Registry.GetValue("data",RunData.get(),Length,&Type);
|
||||
if (!bRes && Type != REG_BINARY)
|
||||
{
|
||||
RunData = AUTO_PTR<BYTE>(new BYTE[Length]);
|
||||
lResult = RegQueryValueEx(hKeyResults,"data",NULL,&Type,RunData.get(),&Length);
|
||||
if (lResult == ERROR_SUCCESS && Type == REG_BINARY)
|
||||
{
|
||||
RunItems = (INVALID_RUN_ITEM *)RunData.get();
|
||||
RunItemCount = Length / sizeof(INVALID_RUN_ITEM);
|
||||
bRes = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < RunItemCount; i ++)
|
||||
{
|
||||
if (memcmp(RunItems[i].File_md5,File_md5.raw_digest(),sizeof(RunItems[i].File_md5)) == 0)
|
||||
{
|
||||
#ifdef VALIDATE_DEBUG
|
||||
WriteTraceF(TraceValidate,"v2: %d",RunItems[i].RunTimes);
|
||||
#endif
|
||||
if (RunItems[i].RunTimes >= MAX_BAD_DATA)
|
||||
{
|
||||
DefaultResult = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bRes)
|
||||
{
|
||||
bRes = Registry.Open(HKEY_CLASSES_ROOT,Subkey,KEY_ALL_ACCESS,true);
|
||||
if (bRes)
|
||||
{
|
||||
Length = Registry.GetValueSize("data");
|
||||
|
||||
if (Length == -1)
|
||||
{
|
||||
Length = 0;
|
||||
bRes = false;
|
||||
}
|
||||
|
||||
if (bRes)
|
||||
{
|
||||
DWORD Type;
|
||||
RunData = AUTO_PTR<BYTE>(new BYTE[Length]);
|
||||
bRes = Registry.GetValue("data",RunData.get(),Length,&Type);
|
||||
if (!bRes && Type != REG_BINARY)
|
||||
{
|
||||
bRes = false;
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKeyResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bRes && Length > 0)
|
||||
{
|
||||
RunItems = (INVALID_RUN_ITEM *)RunData.get();
|
||||
RunItemCount = Length / sizeof(INVALID_RUN_ITEM);
|
||||
|
||||
for (int i = 0; i < RunItemCount; i ++)
|
||||
{
|
||||
if (memcmp(RunItems[i].File_md5,File_md5.raw_digest(),sizeof(RunItems[i].File_md5)) == 0)
|
||||
{
|
||||
#ifdef VALIDATE_DEBUG
|
||||
WriteTraceF(TraceValidate,"v2: %d",RunItems[i].RunTimes);
|
||||
#endif
|
||||
if (RunItems[i].RunTimes >= MAX_BAD_DATA)
|
||||
{
|
||||
DefaultResult = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,7 +194,7 @@ void TestValidBinaryThread ( )
|
|||
}
|
||||
|
||||
stdstr ComputerName;
|
||||
DWORD Length = 260;
|
||||
Length = 260;
|
||||
ComputerName.resize(Length);
|
||||
GetComputerName((char *)ComputerName.c_str(),&Length);
|
||||
|
||||
|
@ -322,18 +359,29 @@ void TestValidBinaryThread ( )
|
|||
|
||||
}
|
||||
|
||||
bSaveRunInfo = true;
|
||||
if (bSaveRunInfo)
|
||||
{
|
||||
HKEY hKeyResults = 0;
|
||||
long lResult;
|
||||
DWORD Disposition = 0;
|
||||
lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT, Subkey,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
||||
if (lResult == ERROR_SUCCESS)
|
||||
bRes = Registry.Open(HKEY_CLASSES_ROOT,Subkey,KEY_ALL_ACCESS,true);
|
||||
if (bRes)
|
||||
{
|
||||
RegSetValueEx(hKeyResults,"data",0,REG_BINARY,(BYTE *)RunData.get(),RunItemCount * sizeof(INVALID_RUN_ITEM));
|
||||
RegCloseKey(hKeyResults);
|
||||
bRes = Registry.SetValue("data",(BYTE *)RunData.get(),RunItemCount * sizeof(INVALID_RUN_ITEM),REG_BINARY);
|
||||
}
|
||||
|
||||
if (bRes)
|
||||
{
|
||||
bRes = Registry.Open(HKEY_LOCAL_MACHINE,Subkey2,KEY_ALL_ACCESS);
|
||||
if (bRes)
|
||||
{
|
||||
Registry.DeleteValue("data");
|
||||
}
|
||||
}else {
|
||||
bRes = Registry.Open(HKEY_LOCAL_MACHINE,Subkey2,KEY_ALL_ACCESS,true);
|
||||
if (bRes)
|
||||
{
|
||||
bRes = Registry.SetValue("data",(BYTE *)RunData.get(),RunItemCount * sizeof(INVALID_RUN_ITEM),REG_BINARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
_Settings->SaveBool(Beta_IsValidExe,DefaultResult);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue