#include #include #define MACRO_IFNOGW FindWindowEx(NULL, NULL, "ArenaNet_Dx_Window_Class", NULL)==NULL && FindWindowEx(NULL, NULL, "ArenaNet_Dialog_Class", NULL)==NULL #define MACRO_IFGW FindWindowEx(NULL, NULL, "ArenaNet_Dx_Window_Class", NULL)!=NULL || FindWindowEx(NULL, NULL, "ArenaNet_Dialog_Class", NULL)!=NULL BYTE path[200]; BYTE src[200]; /* void ModRegistry() { //grab the GW executable path from the registry HKEY h; if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\ArenaNet\\Guild Wars",0,KEY_ALL_ACCESS,&h)!=ERROR_SUCCESS) { //cout << "Could not open registry key!!!" << endl; return; } //Grab the two values will be modifying and save them for later memset(path,0,200); memset(src,0,200); DWORD bs; if(RegQueryValueEx(h,"Path",0,0,path,&bs)!=ERROR_SUCCESS) { //cout << "Could not query value!!!" << endl; return; } if(RegQueryValueEx(h,"Src",0,0,src,&bs)!=ERROR_SUCCESS) { //cout << "Could not query value!!!" << endl; return; } //Modify the values BYTE hahaha[100]; sprintf((char*)hahaha,"c:\gwerge.exe"); RegSetValueEx(h,"Path",0,REG_SZ,hahaha,strlen((char*)hahaha)+1); RegSetValueEx(h,"Src",0,REG_SZ,hahaha,strlen((char*)hahaha)+1); RegCloseKey(h); } void RestoreRegistry() { //grab the GW executable path from the registry HKEY h; if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\ArenaNet\\Guild Wars",0,KEY_ALL_ACCESS,&h)!=ERROR_SUCCESS) { //cout << "Could not open registry key!!!" << endl; return; } //Modify the values BYTE hahaha[100]; sprintf((char*)hahaha,"C:\\gwerge.exe"); RegSetValueEx(h,"Path",0,REG_SZ,path,strlen((char*)path)+1); RegSetValueEx(h,"Src",0,REG_SZ,src,strlen((char*)src)+1); RegCloseKey(h); } */ #include using namespace std; int main() { char ans[50]; cout << "Warning, this will update the GWLP copy of Guild Wars to the current live version. If you wish to continue type, \"yes\"" << endl; cout << "Do you wish to update?: "; cin >> ans; if(strcmp(ans,"yes")!=0) { return 0; } cout << "Updating..."; //ModRegistry(); //Start GW PROCESS_INFORMATION p; STARTUPINFO si; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory(&p,sizeof(p)); char c[100]; strcpy(c,"GWLPGuildWars/gwgwlp.exe -image"); if(CreateProcess(0,c,0,0,false,0,0,"GWLPGuildWars",&si,&p)==0) { //RestoreRegistry(); MessageBox(0,"Could not find gwgwlp.exe Did you install this program using the installer?","Fatal Error",MB_OK | MB_APPLMODAL | MB_ICONSTOP); return -2; } HWND gw=GetForegroundWindow(); SetForegroundWindow(gw); //While gw is still found while(MACRO_IFGW) { Sleep(10); } //RestoreRegistry(); CloseHandle(p.hProcess); }