MCPcopy Create free account
hub / github.com/ammaarreshi/Generals-Mac-iOS-iPad / main

Function main

Core/Tools/PATCHGET/CHATAPI.cpp:683–785  ·  view source on GitHub ↗

Check for patches

Source from the content-addressed store, hash-verified

681// Check for patches
682//
683int main(int argc, char *argv[])
684{
685 InitCommonControls();
686
687 /*
688 g_PrimaryWindow=CreatePrimaryWin(); // Create the main window
689 DispatchEvents(); // process some win messages
690 */
691
692/*
693 // Check if they've registered before, if not ask them if they want to
694 bool have_registered=false;
695 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,REGISTER_REG_KEY,0,KEY_READ,&rKey)==ERROR_SUCCESS)
696 {
697 char username[64];
698 valuesize=sizeof(username);
699 if (RegQueryValueEx(rKey,"UserName",nullptr,&type,(uint8 *)username,&valuesize)==ERROR_SUCCESS)
700 have_registered=true;
701 RegCloseKey(rKey);
702 }
703 if (!have_registered)
704 {
705 if (RegOpenKeyEx(HKEY_CLASSES_ROOT,NICK_REG_KEY,0,KEY_READ,&rKey)==ERROR_SUCCESS)
706 {
707 have_registered=true;
708 RegCloseKey(rKey);
709 }
710 }
711
712 if (!have_registered)
713 {
714 if (MessageBox(nullptr,Fetch_String(TXT_REGNOW),Fetch_String(TXT_TITLE),MB_YESNO)==IDNO)
715 have_registered=true; // pretend they've alredy registered
716 }
717
718 if (!have_registered)
719 {
720 // figure out where the registration app is installed & launch it, continue
721 // after it exits.
722 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,REGISTER_REG_APP,0,KEY_READ,&rKey)==ERROR_SUCCESS)
723 {
724 char regapp[300];
725 valuesize=sizeof(regapp);
726 if ((RegQueryValueEx(rKey,"InstallPath",nullptr,&type,(uint8 *)regapp,&valuesize)==ERROR_SUCCESS)&&
727 (strlen(regapp) > 8))
728 {
729 // Launch the process
730 SHELLEXECUTEINFO info;
731 memset(&info,0,sizeof(info));
732 info.cbSize=sizeof(info);
733 info.fMask=SEE_MASK_NOCLOSEPROCESS;
734 info.hwnd=g_PrimaryWindow;
735 info.lpVerb=nullptr;
736 info.lpFile=regapp;
737 info.lpParameters=nullptr;
738 info.lpDirectory=".";
739 info.nShow=SW_SHOW;
740 ShellExecuteEx(&info);

Callers 1

WinMainFunction · 0.70

Calls 9

MessageBoxFunction · 0.85
Fetch_StringFunction · 0.85
DispatchEventsFunction · 0.85
ShowWindowFunction · 0.85
Startup_ChatFunction · 0.85
Update_If_RequiredFunction · 0.85
Shutdown_ChatFunction · 0.85
CreatePrimaryWinFunction · 0.70

Tested by

no test coverage detected