//////////////////////////////////////////// // YAFUWin by Edwin C. Hall // // for use with YAFU by Benjamin Buhrow // // // // Built to compile using Dev-C++ 4.9.9.2 // // Now compiled with CodeBlocks // // All sources contained within this file // // Provided "As-Is" with no warranty // // Compile and Use at own risk // //////////////////////////////////////////// #include #include #include #include char* wName="YAFUWin by Edwin C. Hall version .20160302a"; using namespace std; //defines added here to make source self-contained #define IDC_STATIC 1000 #define IDR_YAFUMENU 4000 #define ID_FILE_OPENYI 4002 #define ID_FILE_OPENFL 4003 #define ID_FILE_OPENSL 4004 #define ID_FILE_OPENRM 4005 #define ID_FILE_TUNE 4006 #define ID_FILE_EXIT 4007 #define ID_HELP_HELP 4008 #define ID_HELP_HELP2 4009 #define ID_HELP_HELP3 4033 #define ID_HELP_ABOUT 4010 #define IDD_ABOUT 4011 #define ID_MESSAGES 4029 #define ID_TIMER 4030 #define ID_TIMER2 4031 #define ID_HELP_ABOUTYAFU 4035 #define ID_YAFU_RUN 4037 #define ID_YAFU_IDLE 4038 #define ID_YAFU_EXPRESS 4039 #define ID_YAFU_FUNNONE 4140 #define ID_YAFU_FUNFAC 4141 #define ID_YAFU_FUNSIQS 4142 #define ID_YAFU_FUNSMPQS 4143 #define ID_YAFU_FUNNFS 4144 #define ID_YAFU_FUNSQUFOF 4145 #define ID_YAFU_FUNPM1 4146 #define ID_YAFU_FUNPP1 4147 #define ID_YAFU_FUNRHO 4148 #define ID_YAFU_FUNTRIAL 4149 #define ID_YAFU_FUNECM 4150 #define ID_YAFU_FUNFERMAT 4151 #define ID_YAFU_FUNRSA 4152 #define ID_YAFU_FUNSIZE 4153 #define ID_YAFU_FUNPRIMES 4154 #define ID_YAFU_FUNNPRIME 4155 #define ID_YAFU_FUNRAND 4156 #define ID_YAFU_FUNRANDB 4157 #define ID_YAFU_FUNISPRIME 4158 #define ID_YAFU_FUNISPOW 4159 #define ID_YAFU_FUNISSQUARE 4160 #define ID_YAFU_FUNSRANGE 4161 #define ID_YAFU_FUNTRANGE 4162 #define ID_YAFU_FUNSHIFT 4163 #define ID_YAFU_FUNNROOT 4164 #define ID_YAFU_FUNMODEXP 4165 #define ID_YAFU_FUNSQRT 4166 #define ID_YAFU_FUNLG2 4167 #define ID_YAFU_FUNLOG 4168 #define ID_YAFU_FUNLN 4169 #define ID_YAFU_FUNGCD 4170 #define ID_YAFU_FUNJACOBI 4171 #define ID_YAFU_FUNMODINV 4172 #define ID_YAFU_FUNFIB 4173 #define ID_YAFU_FUNLUC 4174 #define ID_YAFU_FUNLLT 4175 #define ID_YAFU_SHOWCMD 4176 #define ID_YAFU_EXIT 4177 #define ID_YAFU_FLAG1 4178 #define ID_YAFU_FLAG1P1 4179 #define ID_YAFU_FLAG2 4180 #define ID_YAFU_FLAG2P1 4181 #define ID_YAFU_FLAG3 4182 #define ID_YAFU_FLAG3P1 4183 #define ID_YAFU_FLAG4 4184 #define ID_YAFU_FLAG4P1 4185 #define ID_YAFU_FLAG5 4186 #define ID_YAFU_FLAG5P1 4187 #define ID_YAFU_FLAG6 4188 #define ID_YAFU_FLAG6P1 4189 #define ID_YAFU_FLAG7 4190 #define ID_YAFU_FLAG7P1 4191 #define ID_YAFU_FLAG8 4192 #define ID_YAFU_FLAG8P1 4193 #define ID_YAFU_FLAG9 4194 #define ID_YAFU_FLAG9P1 4195 #define ID_YAFU_FLAG10 4196 #define ID_YAFU_FLAG10P1 4197 #define ID_YAFU_FLAG11 4198 #define ID_YAFU_FLAG11P1 4199 #define ID_YAFU_FLAG12 4200 #define ID_YAFU_FLAG12P1 4201 #define ID_YAFU_FLAG13 4202 #define ID_YAFU_FLAG14 4203 #define ID_YAFU_FLAG15 4204 #define ID_YAFU_FLAG16 4205 #define ID_YAFU_FLAG17 4206 #define ID_YAFU_FLAG18 4207 #define ID_YAFU_SILENT 4208 #define ID_YAFU_V1 4209 #define ID_YAFU_V2 4210 #define ID_YAFU_V3 4211 #define ID_YAFU_VPROC 4212 #define ID_YAFU_NOEXPR 4213 #define ID_YAFU_LOGFILE 4214 #define ID_YAFU_LOGFILEP 4215 #define ID_YAFU_SEED 4216 #define ID_YAFU_SEEDP 4217 #define ID_YAFU_SESSION 4218 #define ID_YAFU_SESSIONP 4219 #define ID_YAFU_BATCHFILE 4220 #define ID_YAFU_BATCHFILEP 4221 #define ID_YAFU_BIT32 4222 #define ID_YAFU_BIT64 4223 //startup and process info for all the createprocess procedures STARTUPINFO info={sizeof(info)}; PROCESS_INFORMATION processInfo; //variable definitions const char g_szClassName[] = "YAFUWin"; HWND YAFUHwnd, yafuWinHwnd; char YAFUfunction[16] = "", flag1[16] = "", flag1p1[2048] = "", flag2[16] = "", flag2p1[2048] = ""; char flag3[16] = "", flag3p1[2048] = "", flag4[16] = "", flag4p1[2048] = "", flag5[16] = "", flag5p1[2048] = ""; char flag6[16] = "", flag6p1[2048] = "", flag7[16] = "", flag7p1[2048] = "", flag8[16] = "", flag8p1[2048] = ""; char flag9[16] = "", flag9p1[2048] = "", flag10[16] = "", flag10p1[2048] = "", flag11[16] = "", flag11p1[2048] = ""; char flag12[16] = "", flag12p1[16] = "", flag13[16] = "", flag14[2048] = "", flag15[16] = ""; char flag16[16] = "", flag17[2048] = "", flag18[16] = ""; char logfile[2048] = "", logfilep[2048] = "", seed[2048] = "", seedp[2048] = "", session[2048] = "", sessionp[2048] = ""; char batchfile[2048] = "", batchfilep[2048] = ""; string YAFUCall, txtCall = "\"Notepad.exe\""; int yn, termyn, termynS=0, timerDelay2 = 1000*60*60*4, timerDelay = 1000; UINT YAFUTimer, YAFUTimer2; BOOL bYAFURunning; // structure for options - this was created to make a file save easy //currently the only one restored is bAcceptance struct switches{ BOOL bAcceptance, bIdlePri, bfNone, bFlag1, bFlag2, bFlag3, bFlag4, bFlag5, bFlag6, bFlag7, bFlag8, bFlag9, bFlag10; BOOL bFlag11, bFlag12, bFlag13, bFlag14, bFlag15, bFlag16, bFlag17, bFlag18, bSilent, bV1, bV2, bV3; BOOL bVproc, bNoexpr, bLogfile, bSeed, bSession, bBatchfile, bit64; } sw; //Help Information is displayed in MessageBoxes //The text is included here to keep source fully self-contained char* helpTextPage1 = "YAFU Help Page 1 \ \r\r\ Would you like to review page 2?\ "; char* helpTextPage2 = "YAFU Help Page 2\ \r\r\ Would you like to review page 3?\ "; char* helpTextPage3 = "YAFU Help Page 3\ \r\r\ "; //function declarations void loadSwitches(); void saveSwitches(); void makeYAFUString(HWND hwnd); void startYAFU(HWND hwnd); void stopYAFU(HWND hwnd); void clearRbuttons(HWND hwnd); void buildYAFUcmd(HWND hwnd); // kept for test (261673^19-1)/(261673-1) //this concatenates the function and flags //for the YAFU call void buildYAFUcmd(HWND hwnd){ char buf[2048]; YAFUCall.assign(""); if (sw.bit64) YAFUCall.append("yafu-x64 \""); else YAFUCall.append("yafu-win32 \""); YAFUCall.append(YAFUfunction); if (!sw.bfNone) YAFUCall.append("("); GetDlgItemText(hwnd, ID_YAFU_EXPRESS, buf, 2047); YAFUCall.append(buf); if (!sw.bfNone) YAFUCall.append(")"); YAFUCall.append("\""); if (sw.bIdlePri) YAFUCall.append(" -p"); if (sw.bSilent) YAFUCall.append(" -silent"); if (sw.bV1) YAFUCall.append(" -v"); if (sw.bV2) YAFUCall.append(" -v"); if (sw.bV3) YAFUCall.append(" -v"); if (sw.bVproc) YAFUCall.append(" -vproc"); if (sw.bNoexpr) YAFUCall.append(" -no_expr"); if (sw.bFlag1){ YAFUCall.append(flag1); GetDlgItemText(hwnd, ID_YAFU_FLAG1P1, flag1p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag1p1); } if (sw.bFlag2){ YAFUCall.append(flag2); GetDlgItemText(hwnd, ID_YAFU_FLAG2P1, flag2p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag2p1); } if (sw.bFlag3){ YAFUCall.append(flag3); GetDlgItemText(hwnd, ID_YAFU_FLAG3P1, flag3p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag3p1); } if (sw.bFlag4){ YAFUCall.append(flag4); GetDlgItemText(hwnd, ID_YAFU_FLAG4P1, flag4p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag4p1); } if (sw.bFlag5){ YAFUCall.append(flag5); GetDlgItemText(hwnd, ID_YAFU_FLAG5P1, flag5p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag5p1); } if (sw.bFlag6){ YAFUCall.append(flag6); GetDlgItemText(hwnd, ID_YAFU_FLAG6P1, flag6p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag6p1); } if (sw.bFlag7){ YAFUCall.append(flag7); GetDlgItemText(hwnd, ID_YAFU_FLAG7P1, flag7p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag7p1); } if (sw.bFlag8){ YAFUCall.append(flag8); GetDlgItemText(hwnd, ID_YAFU_FLAG8P1, flag8p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag8p1); } if (sw.bFlag9){ YAFUCall.append(flag9); GetDlgItemText(hwnd, ID_YAFU_FLAG9P1, flag9p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag9p1); } if (sw.bFlag10){ YAFUCall.append(flag10); GetDlgItemText(hwnd, ID_YAFU_FLAG10P1, flag10p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag10p1); } if (sw.bFlag11){ YAFUCall.append(flag11); GetDlgItemText(hwnd, ID_YAFU_FLAG11P1, flag11p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag11p1); } if (sw.bFlag12){ YAFUCall.append(flag12); GetDlgItemText(hwnd, ID_YAFU_FLAG12P1, flag12p1, 2047); YAFUCall.append(" "); YAFUCall.append(flag12p1); } if (sw.bFlag13){ YAFUCall.append(flag13); } if (sw.bFlag14){ YAFUCall.append(flag14); } if (sw.bFlag15){ YAFUCall.append(flag15); } if (sw.bFlag16){ YAFUCall.append(flag16); } if (sw.bFlag17){ YAFUCall.append(flag17); } if (sw.bFlag18){ YAFUCall.append(flag18); } if (sw.bLogfile){ YAFUCall.append(" -logfile "); GetDlgItemText(hwnd, ID_YAFU_LOGFILEP, logfilep, 2047); YAFUCall.append(logfilep); } if (sw.bSeed){ YAFUCall.append(" -seed "); GetDlgItemText(hwnd, ID_YAFU_SEEDP, seedp, 2047); YAFUCall.append(seedp); } if (sw.bSession){ YAFUCall.append(" -session "); GetDlgItemText(hwnd, ID_YAFU_SESSIONP, sessionp, 2047); YAFUCall.append(sessionp); } if (sw.bBatchfile){ YAFUCall.append(" -batchfile "); GetDlgItemText(hwnd, ID_YAFU_BATCHFILEP, batchfilep, 2047); YAFUCall.append(batchfilep); } YAFUCall.append("\0"); } //this is used to clear all the function buttons void clearRbuttons(HWND hwnd){ sw.bfNone = 0; strcpy(flag1, ""); sw.bFlag1 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG1, ""); strcpy(flag2, ""); sw.bFlag2 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG2, ""); strcpy(flag3, ""); sw.bFlag3 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG3, ""); strcpy(flag4, ""); sw.bFlag4 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG4, ""); strcpy(flag5, ""); sw.bFlag5 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG5, ""); strcpy(flag6, ""); sw.bFlag6 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG6, ""); strcpy(flag7, ""); sw.bFlag7 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG7, ""); strcpy(flag8, ""); sw.bFlag8 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG8, ""); strcpy(flag9, ""); sw.bFlag9 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG9, ""); strcpy(flag10, ""); sw.bFlag10 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG10, ""); strcpy(flag11, ""); sw.bFlag11 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG11, ""); strcpy(flag12, ""); sw.bFlag12 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG12, ""); strcpy(flag13, ""); sw.bFlag13 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG13, ""); strcpy(flag14, ""); sw.bFlag14 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG14, ""); strcpy(flag15, ""); sw.bFlag15 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG15, ""); strcpy(flag16, ""); sw.bFlag16 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG16, ""); strcpy(flag17, ""); sw.bFlag17 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG17, ""); strcpy(flag18, ""); sw.bFlag18 = 0; SetDlgItemText(hwnd, ID_YAFU_FLAG18, ""); CheckDlgButton(hwnd, ID_YAFU_FUNRSA, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSIZE, 0); CheckDlgButton(hwnd, ID_YAFU_FUNPRIMES, 0); CheckDlgButton(hwnd, ID_YAFU_FUNNPRIME, 0); CheckDlgButton(hwnd, ID_YAFU_FUNRAND, 0); CheckDlgButton(hwnd, ID_YAFU_FUNRANDB, 0); CheckDlgButton(hwnd, ID_YAFU_FUNISPRIME, 0); CheckDlgButton(hwnd, ID_YAFU_FUNISPOW, 0); CheckDlgButton(hwnd, ID_YAFU_FUNISSQUARE, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSRANGE, 0); CheckDlgButton(hwnd, ID_YAFU_FUNTRANGE, 0); CheckDlgButton(hwnd, ID_YAFU_FUNNONE, 0); CheckDlgButton(hwnd, ID_YAFU_FUNFAC, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSIQS, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSMPQS, 0); CheckDlgButton(hwnd, ID_YAFU_FUNNFS, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSQUFOF, 0); CheckDlgButton(hwnd, ID_YAFU_FUNPM1, 0); CheckDlgButton(hwnd, ID_YAFU_FUNPP1, 0); CheckDlgButton(hwnd, ID_YAFU_FUNRHO, 0); CheckDlgButton(hwnd, ID_YAFU_FUNTRIAL, 0); CheckDlgButton(hwnd, ID_YAFU_FUNECM, 0); CheckDlgButton(hwnd, ID_YAFU_FUNFERMAT, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSHIFT, 0); CheckDlgButton(hwnd, ID_YAFU_FUNNROOT, 0); CheckDlgButton(hwnd, ID_YAFU_FUNMODEXP, 0); CheckDlgButton(hwnd, ID_YAFU_FUNSQRT, 0); CheckDlgButton(hwnd, ID_YAFU_FUNLG2, 0); CheckDlgButton(hwnd, ID_YAFU_FUNLOG, 0); CheckDlgButton(hwnd, ID_YAFU_FUNLN, 0); CheckDlgButton(hwnd, ID_YAFU_FUNGCD, 0); CheckDlgButton(hwnd, ID_YAFU_FUNJACOBI, 0); CheckDlgButton(hwnd, ID_YAFU_FUNMODINV, 0); CheckDlgButton(hwnd, ID_YAFU_FUNFIB, 0); CheckDlgButton(hwnd, ID_YAFU_FUNLUC, 0); CheckDlgButton(hwnd, ID_YAFU_FUNLLT, 0); } //this is used to initiate the YAFU process //it opens a console window void startYAFU(HWND hwnd){ buildYAFUcmd(hwnd); char *cstr = new char [YAFUCall.length()+1]; strcpy(cstr, YAFUCall.c_str()); // MessageBox(hwnd, cstr, "Tracking/Tracing Message", MB_OK); if (!bYAFURunning){ ZeroMemory( &info, sizeof(info) ); info.cb = sizeof(info); info.dwX = 100; info.dwY = 205; info.dwFlags = STARTF_USEPOSITION; // | STARTF_USESTDHANDLES; // | STARTF_USESHOWWINDOW; YAFUTimer = SetTimer(hwnd, ID_TIMER, timerDelay, NULL); YAFUTimer2 = SetTimer(hwnd, ID_TIMER2, timerDelay2, NULL); CreateProcess(NULL, cstr, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); bYAFURunning = 1; SetDlgItemText(hwnd, ID_YAFU_RUN, "Stop YAFU"); } } //this is used to stop the running instance of YAFU //it closes the console window void stopYAFU(HWND hwnd){ // MessageBox(hwnd, "stopYAFU routine called!", "Tracking/Tracing Message", MB_OK); if (bYAFURunning){ KillTimer(hwnd, YAFUTimer); char YAFULocation[512]; GetCurrentDirectory(512, YAFULocation); strcat(YAFULocation, "\\yafu.exe"); YAFUHwnd = FindWindow(NULL, YAFULocation); if (YAFUHwnd){ SendMessage(YAFUHwnd, WM_CLOSE, 0, 0); } TerminateProcess(processInfo.hProcess, 0); bYAFURunning = 0; SetDlgItemText(hwnd, ID_YAFU_RUN, "Run YAFU"); } } //this saves the settings of the various options when YAFUWin is closed //currently the only one restored is bAcceptance void saveSwitches() { sw.bfNone = 1; ofstream file; file.open("YAFUWin.cfg", ios::binary); if (file) file.write((char *)(&sw), sizeof(sw)); file.close(); } //this loads the last settings of the options when YAFUWin starts //currently the only one restored is bAcceptance void loadSwitches() { ifstream file; file.open("YAFUWin.cfg", ios::binary); if (file) while (!file.eof()) file.read((char *)(&sw), sizeof(sw)); file.close(); } /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "YAFUGUI"; /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_CREATE:{ //menu included to make source self-contained HMENU hMenu, hSubMenu; hMenu = CreateMenu(); hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, ID_FILE_OPENFL, "Open &factor.log"); AppendMenu(hSubMenu, MF_STRING, ID_FILE_OPENSL, "Open &session.log"); AppendMenu(hSubMenu, MF_STRING, ID_FILE_OPENRM, "Open README"); AppendMenu(hSubMenu, MF_STRING, ID_FILE_OPENYI, "Open &YAFU.ini"); AppendMenu(hSubMenu, MF_STRING, ID_FILE_TUNE, "Run &tune"); AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit"); AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File"); hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, ID_HELP_HELP, "Help Message &1"); AppendMenu(hSubMenu, MF_STRING, ID_HELP_HELP2, "Help Message &2"); AppendMenu(hSubMenu, MF_STRING, ID_HELP_HELP3, "Help Message &3"); AppendMenu(hSubMenu, MF_STRING, ID_HELP_ABOUT, "&About YAFUWin"); AppendMenu(hSubMenu, MF_STRING, ID_HELP_ABOUTYAFU, "&About YAFU"); AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Help"); SetMenu(hwnd, hMenu); loadSwitches(); if (sw.bAcceptance) termynS = IDYES; else{ termynS = MessageBox(hwnd, "YAFUWin is provided \"As-Is\"\r\rDo you accept personal responsibility for its use?", "As-Is Acceptance Query", MB_YESNO); if (termynS == IDYES) sw.bAcceptance = 1; else PostMessage(hwnd, WM_CLOSE, 0, 0); } sw.bIdlePri = 0; sw.bSilent = 0; sw.bV1 = 0; sw.bV2 = 0; sw.bV3 = 0; sw.bVproc = 0; sw.bNoexpr = 0; sw.bLogfile = 0; sw.bSeed = 0; sw.bSession = 0; sw.bBatchfile = 0; HWND bGround = CreateWindow( "STATIC", "", WS_VISIBLE | WS_CHILD | WS_BORDER, 0, 0, 800, 600, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND expLine = CreateWindow( "STATIC", "Expression to evaluate:", WS_VISIBLE | WS_CHILD, 10, 5, 250, 25, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLine = CreateWindow( "STATIC", " Function to use:", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 70, 370, 385, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funU = CreateWindow( "STATIC", "Utility", WS_VISIBLE | WS_CHILD, 30, 100, 100, 25, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funF = CreateWindow( "STATIC", "Factoring", WS_VISIBLE | WS_CHILD, 150, 100, 100, 25, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funA = CreateWindow( "STATIC", "Arithmetic", WS_VISIBLE | WS_CHILD, 270, 100, 100, 25, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND flagLine = CreateWindow( "STATIC", " Additional flags to use:", WS_VISIBLE | WS_CHILD | WS_BORDER, 390, 10, 390, 520, hwnd, (HMENU) IDC_STATIC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND idlepri = CreateWindow( "BUTTON", "-idle priority", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 320, 97, 25, hwnd, (HMENU) ID_YAFU_IDLE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND silent = CreateWindow( "BUTTON", "-silent", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 295, 97, 25, hwnd, (HMENU) ID_YAFU_SILENT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND v1 = CreateWindow( "BUTTON", "v", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 270, 30, 25, hwnd, (HMENU) ID_YAFU_V1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND v2 = CreateWindow( "BUTTON", "v", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 705, 270, 30, 25, hwnd, (HMENU) ID_YAFU_V2, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND v3 = CreateWindow( "BUTTON", "v", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 735, 270, 30, 25, hwnd, (HMENU) ID_YAFU_V3, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND vproc = CreateWindow( "BUTTON", "-vproc", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 245, 97, 25, hwnd, (HMENU) ID_YAFU_VPROC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND noexpr = CreateWindow( "BUTTON", "-no_expr", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 220, 97, 25, hwnd, (HMENU) ID_YAFU_NOEXPR, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag1 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 40, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag1p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 40, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG1P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag2 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 80, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG2, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag2p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 80, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG2P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag3 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 120, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG3, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag3p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 120, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG3P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag4 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 160, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG4, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag4p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 160, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG4P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag5 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 200, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG5, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag5p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 200, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG5P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag6 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 240, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG6, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag6p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 240, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG6P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag7 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 280, 100, 25, hwnd, (HMENU) ID_YAFU_FLAG7, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag7p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 280, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG7P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag8 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 320, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG8, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag8p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 500, 320, 150, 40, hwnd, (HMENU) ID_YAFU_FLAG8P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag9 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 360, 50, 25, hwnd, (HMENU) ID_YAFU_FLAG9, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag9p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 450, 360, 110, 40, hwnd, (HMENU) ID_YAFU_FLAG9P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag10 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 600, 360, 50, 25, hwnd, (HMENU) ID_YAFU_FLAG10, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag10p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 650, 360, 110, 40, hwnd, (HMENU) ID_YAFU_FLAG10P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag11 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 400, 50, 25, hwnd, (HMENU) ID_YAFU_FLAG11, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag11p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 450, 400, 110, 40, hwnd, (HMENU) ID_YAFU_FLAG11P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag12 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 600, 400, 50, 25, hwnd, (HMENU) ID_YAFU_FLAG12, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag12p1 = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 650, 400, 110, 40, hwnd, (HMENU) ID_YAFU_FLAG12P1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag13 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 40, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG13, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag14 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 65, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG14, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag15 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 90, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG15, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag16 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 115, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG16, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag17 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 140, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG17, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Flag18 = CreateWindow( "BUTTON", "", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 675, 165, 95, 25, hwnd, (HMENU) ID_YAFU_FLAG18, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Logfile = CreateWindow( "BUTTON", "-logfile", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 440, 75, 25, hwnd, (HMENU) ID_YAFU_LOGFILE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Logfilep = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 475, 440, 85, 40, hwnd, (HMENU) ID_YAFU_LOGFILEP, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Batchfile = CreateWindow( "BUTTON", "-batchfile", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 590, 480, 85, 25, hwnd, (HMENU) ID_YAFU_BATCHFILE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Batchfilep = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 675, 480, 85, 40, hwnd, (HMENU) ID_YAFU_BATCHFILEP, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Session = CreateWindow( "BUTTON", "-session", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 590, 440, 85, 25, hwnd, (HMENU) ID_YAFU_SESSION, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Sessionp = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 675, 440, 85, 40, hwnd, (HMENU) ID_YAFU_SESSIONP, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Seed = CreateWindow( "BUTTON", "-seed", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, 400, 480, 75, 25, hwnd, (HMENU) ID_YAFU_SEED, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND Seedp = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 475, 480, 85, 40, hwnd, (HMENU) ID_YAFU_SEEDP, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); //Function - Utility buttons HWND funRsa = CreateWindow( "BUTTON", "rsa", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 125, 100, 25, hwnd, (HMENU) ID_YAFU_FUNRSA, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSize = CreateWindow( "BUTTON", "size", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 150, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSIZE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funPrimes = CreateWindow( "BUTTON", "primes", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 175, 100, 25, hwnd, (HMENU) ID_YAFU_FUNPRIMES, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funNprime = CreateWindow( "BUTTON", "nextprime", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 200, 100, 25, hwnd, (HMENU) ID_YAFU_FUNNPRIME, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funRand = CreateWindow( "BUTTON", "rand", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 225, 100, 25, hwnd, (HMENU) ID_YAFU_FUNRAND, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funRandb = CreateWindow( "BUTTON", "randb", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 250, 100, 25, hwnd, (HMENU) ID_YAFU_FUNRANDB, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funIsprime = CreateWindow( "BUTTON", "isprime", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 275, 100, 25, hwnd, (HMENU) ID_YAFU_FUNISPRIME, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funIspow = CreateWindow( "BUTTON", "ispow", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 300, 100, 25, hwnd, (HMENU) ID_YAFU_FUNISPOW, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funIssquare = CreateWindow( "BUTTON", "issquare", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 325, 100, 25, hwnd, (HMENU) ID_YAFU_FUNISSQUARE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSrange = CreateWindow( "BUTTON", "sieverange", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 350, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSRANGE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funTrange = CreateWindow( "BUTTON", "testrange", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 375, 100, 25, hwnd, (HMENU) ID_YAFU_FUNTRANGE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); //Function - Factoring buttons HWND funNone = CreateWindow( "BUTTON", "none", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 200, 75, 100, 25, hwnd, (HMENU) ID_YAFU_FUNNONE, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funFactor = CreateWindow( "BUTTON", "factor", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 125, 100, 25, hwnd, (HMENU) ID_YAFU_FUNFAC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSiqs = CreateWindow( "BUTTON", "siqs", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 150, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSIQS, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSmpqs = CreateWindow( "BUTTON", "smallmpqs", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 175, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSMPQS, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funNfs = CreateWindow( "BUTTON", "nfs", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 200, 100, 25, hwnd, (HMENU) ID_YAFU_FUNNFS, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSqufof = CreateWindow( "BUTTON", "squfof", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 225, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSQUFOF, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funPm1 = CreateWindow( "BUTTON", "p-1", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 250, 100, 25, hwnd, (HMENU) ID_YAFU_FUNPM1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funPp1 = CreateWindow( "BUTTON", "p+1", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 275, 100, 25, hwnd, (HMENU) ID_YAFU_FUNPP1, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funRho = CreateWindow( "BUTTON", "rho", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 300, 100, 25, hwnd, (HMENU) ID_YAFU_FUNRHO, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funTrial = CreateWindow( "BUTTON", "trial", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 325, 100, 25, hwnd, (HMENU) ID_YAFU_FUNTRIAL, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funEcm = CreateWindow( "BUTTON", "ECM", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 350, 100, 25, hwnd, (HMENU) ID_YAFU_FUNECM, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funFermat = CreateWindow( "BUTTON", "fermat", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 150, 375, 100, 25, hwnd, (HMENU) ID_YAFU_FUNFERMAT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); //Function - Arithmetic buttons HWND funShift = CreateWindow( "BUTTON", "shift", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 125, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSHIFT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funNroot = CreateWindow( "BUTTON", "nroot", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 150, 100, 25, hwnd, (HMENU) ID_YAFU_FUNNROOT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funModexp = CreateWindow( "BUTTON", "modexp", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 175, 100, 25, hwnd, (HMENU) ID_YAFU_FUNMODEXP, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funSqrt = CreateWindow( "BUTTON", "sqrt", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 200, 100, 25, hwnd, (HMENU) ID_YAFU_FUNSQRT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLg2 = CreateWindow( "BUTTON", "lg2", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 225, 100, 25, hwnd, (HMENU) ID_YAFU_FUNLG2, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLog = CreateWindow( "BUTTON", "log", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 250, 100, 25, hwnd, (HMENU) ID_YAFU_FUNLOG, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLn = CreateWindow( "BUTTON", "ln", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 275, 100, 25, hwnd, (HMENU) ID_YAFU_FUNLN, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funGcd = CreateWindow( "BUTTON", "gcd", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 300, 100, 25, hwnd, (HMENU) ID_YAFU_FUNGCD, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funacobi = CreateWindow( "BUTTON", "jacobi", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 325, 100, 25, hwnd, (HMENU) ID_YAFU_FUNJACOBI, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funModinv = CreateWindow( "BUTTON", "modinv", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 350, 100, 25, hwnd, (HMENU) ID_YAFU_FUNMODINV, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funFib = CreateWindow( "BUTTON", "fib", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 375, 100, 25, hwnd, (HMENU) ID_YAFU_FUNFIB, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLuc = CreateWindow( "BUTTON", "luc", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 400, 100, 25, hwnd, (HMENU) ID_YAFU_FUNLUC, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND funLlt = CreateWindow( "BUTTON", "llt", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 270, 425, 100, 25, hwnd, (HMENU) ID_YAFU_FUNLLT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND bit32button = CreateWindow( "BUTTON", "32 bit YAFU", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 475, 100, 25, hwnd, (HMENU) ID_YAFU_BIT32, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND bit64button = CreateWindow( "BUTTON", "64 bit YAFU", WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, 30, 500, 100, 25, hwnd, (HMENU) ID_YAFU_BIT64, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND showCmd = CreateWindow( "BUTTON", "Show Command Line", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 230, 465, 150, 25, hwnd, (HMENU) ID_YAFU_SHOWCMD, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND yafurun = CreateWindow( "BUTTON", "Run YAFU", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 230, 505, 90, 25, hwnd, (HMENU) ID_YAFU_RUN, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND yafuExit = CreateWindow( "BUTTON", "Exit", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 330, 505, 50, 25, hwnd, (HMENU) ID_YAFU_EXIT, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); HWND expression = CreateWindow( "edit", "", WS_VISIBLE | WS_CHILD | WS_BORDER | WS_HSCROLL | ES_WANTRETURN | ES_MULTILINE , 10, 25, 370, 40, hwnd, (HMENU) ID_YAFU_EXPRESS, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL); CheckDlgButton(hwnd, ID_YAFU_FUNNONE, sw.bfNone); if (sw.bit64) CheckDlgButton(hwnd, ID_YAFU_BIT64, 1); else CheckDlgButton(hwnd, ID_YAFU_BIT32, 1); break; } case WM_TIMER: switch(wParam) { case ID_TIMER:{ // used to check for running instance of YAFU char yafuLocation[512]; GetCurrentDirectory(512, yafuLocation); strcat(yafuLocation, "\\yafu.exe"); yafuWinHwnd = FindWindow(NULL, yafuLocation); if (!yafuWinHwnd){ SendMessage(yafuWinHwnd, WM_CLOSE, 0, 0); TerminateProcess(processInfo.hProcess, 0); bYAFURunning = 0; SetDlgItemText(hwnd, ID_YAFU_RUN, "Run YAFU"); } } break; /* case ID_TIMER2:{ // currently unused } } break; */ } case WM_COMMAND: switch(LOWORD(wParam)){ case ID_FILE_EXIT: PostMessage(hwnd, WM_CLOSE, 0, 0); break; case ID_HELP_HELP:{ termyn = MessageBox(hwnd, helpTextPage1, "YAFUWin Help - page 1", MB_YESNO); if (termyn != IDYES) break; } case ID_HELP_HELP2:{ termyn = MessageBox(hwnd, helpTextPage2, "YAFUWin Help - page 2", MB_YESNO); if (termyn != IDYES) break; } case ID_HELP_HELP3:{ MessageBox(hwnd, helpTextPage3, "YAFUWin Help - page 3", MB_OK); } break; case ID_HELP_ABOUT:{ char about[1024]; strcpy(about, wName); strcat(about, "\ra Windows GUI for YAFU by Benjamin Buhrow\r\rThis program was built to further automate YAFU,\rwhich factors large numbers.\r\rFor more information, visit the Mersenne-YAFU forum:\r\rhttp://www.mersenneforum.org/forumdisplay.php?f=96"); MessageBox(hwnd, about, "About YAFUWin", MB_ICONINFORMATION | MB_OK); } break; case ID_HELP_ABOUTYAFU:{ char docfileOpen[2048]; strcpy(docfileOpen, txtCall.c_str()); strcat(docfileOpen, " docfile.txt"); CreateProcess(NULL, docfileOpen, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); } break; case ID_YAFU_IDLE:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_IDLE)) CheckDlgButton(hwnd, ID_YAFU_IDLE, 0); else CheckDlgButton(hwnd, ID_YAFU_IDLE, 1); sw.bIdlePri = IsDlgButtonChecked(hwnd, ID_YAFU_IDLE); } break; case ID_YAFU_SILENT:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_SILENT)) CheckDlgButton(hwnd, ID_YAFU_SILENT, 0); else CheckDlgButton(hwnd, ID_YAFU_SILENT, 1); sw.bSilent = IsDlgButtonChecked(hwnd, ID_YAFU_SILENT); } break; case ID_YAFU_V1:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_V1)) CheckDlgButton(hwnd, ID_YAFU_V1, 0); else CheckDlgButton(hwnd, ID_YAFU_V1, 1); sw.bV1 = IsDlgButtonChecked(hwnd, ID_YAFU_V1); } break; case ID_YAFU_V2:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_V2)) CheckDlgButton(hwnd, ID_YAFU_V2, 0); else CheckDlgButton(hwnd, ID_YAFU_V2, 1); sw.bV2 = IsDlgButtonChecked(hwnd, ID_YAFU_V2); } break; case ID_YAFU_V3:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_V3)) CheckDlgButton(hwnd, ID_YAFU_V3, 0); else CheckDlgButton(hwnd, ID_YAFU_V3, 1); sw.bV3 = IsDlgButtonChecked(hwnd, ID_YAFU_V3); } break; case ID_YAFU_VPROC:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_VPROC)) CheckDlgButton(hwnd, ID_YAFU_VPROC, 0); else CheckDlgButton(hwnd, ID_YAFU_VPROC, 1); sw.bVproc = IsDlgButtonChecked(hwnd, ID_YAFU_VPROC); } break; case ID_YAFU_NOEXPR:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_NOEXPR)) CheckDlgButton(hwnd, ID_YAFU_NOEXPR, 0); else CheckDlgButton(hwnd, ID_YAFU_NOEXPR, 1); sw.bNoexpr = IsDlgButtonChecked(hwnd, ID_YAFU_NOEXPR); } break; case ID_YAFU_LOGFILE:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_LOGFILE)) CheckDlgButton(hwnd, ID_YAFU_LOGFILE, 0); else CheckDlgButton(hwnd, ID_YAFU_LOGFILE, 1); sw.bLogfile = IsDlgButtonChecked(hwnd, ID_YAFU_LOGFILE); } break; case ID_YAFU_SEED:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_SEED)) CheckDlgButton(hwnd, ID_YAFU_SEED, 0); else CheckDlgButton(hwnd, ID_YAFU_SEED, 1); sw.bSeed = IsDlgButtonChecked(hwnd, ID_YAFU_SEED); } break; case ID_YAFU_SESSION:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_SESSION)) CheckDlgButton(hwnd, ID_YAFU_SESSION, 0); else CheckDlgButton(hwnd, ID_YAFU_SESSION, 1); sw.bSession = IsDlgButtonChecked(hwnd, ID_YAFU_SESSION); } break; case ID_YAFU_BATCHFILE:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_BATCHFILE)) CheckDlgButton(hwnd, ID_YAFU_BATCHFILE, 0); else CheckDlgButton(hwnd, ID_YAFU_BATCHFILE, 1); sw.bBatchfile = IsDlgButtonChecked(hwnd, ID_YAFU_BATCHFILE); } break; case ID_YAFU_FUNNONE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNNONE, 1); strcpy(YAFUfunction, ""); sw.bfNone = 1; } break; //Function button routines - Utility case ID_YAFU_FUNRSA:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNRSA, 1); strcpy(YAFUfunction, "rsa"); } break; case ID_YAFU_FUNSIZE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSIZE, 1); strcpy(YAFUfunction, "size"); } break; case ID_YAFU_FUNPRIMES:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNPRIMES, 1); strcpy(YAFUfunction, "primes"); SetDlgItemText(hwnd, ID_YAFU_FLAG13, "-pfile"); CheckDlgButton(hwnd, ID_YAFU_FLAG13, 0); strcpy(flag13, " -pfile"); SetDlgItemText(hwnd, ID_YAFU_FLAG14, "-pscreen"); CheckDlgButton(hwnd, ID_YAFU_FLAG14, 0); strcpy(flag14, " -pscreen"); } break; case ID_YAFU_FUNNPRIME:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNNPRIME, 1); strcpy(YAFUfunction, "nprime"); } break; case ID_YAFU_FUNRAND:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNRAND, 1); strcpy(YAFUfunction, "rand"); } break; case ID_YAFU_FUNRANDB:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNRANDB, 1); strcpy(YAFUfunction, "randb"); } break; case ID_YAFU_FUNISPRIME:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNISPRIME, 1); strcpy(YAFUfunction, "isprime"); } break; case ID_YAFU_FUNISPOW:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNISPOW, 1); strcpy(YAFUfunction, "ispow"); } break; case ID_YAFU_FUNISSQUARE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNISSQUARE, 1); strcpy(YAFUfunction, "issquare"); } break; case ID_YAFU_FUNSRANGE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSRANGE, 1); strcpy(YAFUfunction, "sieverange"); } break; case ID_YAFU_FUNTRANGE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNTRANGE, 1); strcpy(YAFUfunction, "testrange"); } break; //Function button routines - Factoring case ID_YAFU_FUNFAC:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNFAC, 1); strcpy(YAFUfunction, "factor"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-op"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -op"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-of"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -of"); SetDlgItemText(hwnd, ID_YAFU_FLAG3, "-pretest"); CheckDlgButton(hwnd, ID_YAFU_FLAG3, 0); strcpy(flag3, " -pretest"); SetDlgItemText(hwnd, ID_YAFU_FLAG4, "-plan"); CheckDlgButton(hwnd, ID_YAFU_FLAG4, 0); strcpy(flag4, " -plan"); SetDlgItemText(hwnd, ID_YAFU_FLAG5, "-work"); CheckDlgButton(hwnd, ID_YAFU_FLAG5, 0); strcpy(flag5, " -work"); SetDlgItemText(hwnd, ID_YAFU_FLAG6, "-ggnfs_dir"); CheckDlgButton(hwnd, ID_YAFU_FLAG6, 0); strcpy(flag6, " -ggnfs_dir"); SetDlgItemText(hwnd, ID_YAFU_FLAG7, "pretest_ratio"); CheckDlgButton(hwnd, ID_YAFU_FLAG7, 0); strcpy(flag7, " -pretest_ratio"); SetDlgItemText(hwnd, ID_YAFU_FLAG8, "-xover"); CheckDlgButton(hwnd, ID_YAFU_FLAG8, 0); strcpy(flag8, " -xover"); SetDlgItemText(hwnd, ID_YAFU_FLAG9, "-ou"); CheckDlgButton(hwnd, ID_YAFU_FLAG9, 0); strcpy(flag9, " -ou"); SetDlgItemText(hwnd, ID_YAFU_FLAG13, "-one"); CheckDlgButton(hwnd, ID_YAFU_FLAG13, 0); strcpy(flag13, " -one"); SetDlgItemText(hwnd, ID_YAFU_FLAG14, "-noecm"); CheckDlgButton(hwnd, ID_YAFU_FLAG14, 0); strcpy(flag14, " -noecm"); } break; case ID_YAFU_FUNSIQS:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSIQS, 1); strcpy(YAFUfunction, "siqs"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-qssave"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -qssave"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-siqsR"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -siqsR"); SetDlgItemText(hwnd, ID_YAFU_FLAG3, "-siqsT"); CheckDlgButton(hwnd, ID_YAFU_FLAG3, 0); strcpy(flag3, " -siqsT"); SetDlgItemText(hwnd, ID_YAFU_FLAG4, "-threads"); CheckDlgButton(hwnd, ID_YAFU_FLAG4, 0); strcpy(flag4, " -threads"); SetDlgItemText(hwnd, ID_YAFU_FLAG13, "-forceDLP"); CheckDlgButton(hwnd, ID_YAFU_FLAG13, 0); strcpy(flag13, " -forceDLP"); SetDlgItemText(hwnd, ID_YAFU_FLAG14, "-noopt"); CheckDlgButton(hwnd, ID_YAFU_FLAG14, 0); strcpy(flag14, " -noopt"); } break; case ID_YAFU_FUNSMPQS:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSMPQS, 1); strcpy(YAFUfunction, "smallmpqs"); } break; case ID_YAFU_FUNNFS:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNNFS, 1); strcpy(YAFUfunction, "nfs"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-siever"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -siever"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-ext_ECM"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -ext_ecm"); SetDlgItemText(hwnd, ID_YAFU_FLAG3, "-ecm_path"); CheckDlgButton(hwnd, ID_YAFU_FLAG3, 0); strcpy(flag3, " -ecm_path"); SetDlgItemText(hwnd, ID_YAFU_FLAG4, "-nprp"); CheckDlgButton(hwnd, ID_YAFU_FLAG4, 0); strcpy(flag4, " -nprp"); SetDlgItemText(hwnd, ID_YAFU_FLAG5, "-lathreads"); CheckDlgButton(hwnd, ID_YAFU_FLAG5, 0); strcpy(flag5, " -lathreads"); SetDlgItemText(hwnd, ID_YAFU_FLAG6, "-ggnfsT"); CheckDlgButton(hwnd, ID_YAFU_FLAG6, 0); strcpy(flag6, " -ggnfsT"); SetDlgItemText(hwnd, ID_YAFU_FLAG7, "-psearch"); CheckDlgButton(hwnd, ID_YAFU_FLAG7, 0); strcpy(flag7, " -psearch"); SetDlgItemText(hwnd, ID_YAFU_FLAG8, "-pbatch"); CheckDlgButton(hwnd, ID_YAFU_FLAG8, 0); strcpy(flag8, " -pbatch"); SetDlgItemText(hwnd, ID_YAFU_FLAG9, "-np"); CheckDlgButton(hwnd, ID_YAFU_FLAG9, 0); strcpy(flag9, " -np"); SetDlgItemText(hwnd, ID_YAFU_FLAG10, "-job"); CheckDlgButton(hwnd, ID_YAFU_FLAG10, 0); strcpy(flag10, " -job"); SetDlgItemText(hwnd, ID_YAFU_FLAG11, "-ns"); CheckDlgButton(hwnd, ID_YAFU_FLAG11, 0); strcpy(flag11, " -ns"); SetDlgItemText(hwnd, ID_YAFU_FLAG12, "-o"); CheckDlgButton(hwnd, ID_YAFU_FLAG12, 0); strcpy(flag12, " -o"); SetDlgItemText(hwnd, ID_YAFU_FLAG13, "-nc"); CheckDlgButton(hwnd, ID_YAFU_FLAG13, 0); strcpy(flag13, " -nc"); SetDlgItemText(hwnd, ID_YAFU_FLAG14, "-nc2"); CheckDlgButton(hwnd, ID_YAFU_FLAG14, 0); strcpy(flag14, " -nc2"); SetDlgItemText(hwnd, ID_YAFU_FLAG15, "-nc3"); CheckDlgButton(hwnd, ID_YAFU_FLAG15, 0); strcpy(flag15, " -nc3"); SetDlgItemText(hwnd, ID_YAFU_FLAG16, "-a"); CheckDlgButton(hwnd, ID_YAFU_FLAG16, 0); strcpy(flag16, " -a"); SetDlgItemText(hwnd, ID_YAFU_FLAG17, "-r"); CheckDlgButton(hwnd, ID_YAFU_FLAG17, 0); strcpy(flag17, " -r"); SetDlgItemText(hwnd, ID_YAFU_FLAG18, "-Restart"); CheckDlgButton(hwnd, ID_YAFU_FLAG18, 0); strcpy(flag18, " -R"); } break; case ID_YAFU_FUNSQUFOF:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSQUFOF, 1); strcpy(YAFUfunction, "squfof"); } break; case ID_YAFU_FUNPM1:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNPM1, 1); strcpy(YAFUfunction, "pm1"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-B1pm1"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -B1pm1"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-B2pm1"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -B2pm1"); } break; case ID_YAFU_FUNPP1:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNPP1, 1); strcpy(YAFUfunction, "pp1"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-B1pp1"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -B1pp1"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-B2pp1"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -B2pp1"); } break; case ID_YAFU_FUNRHO:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNRHO, 1); strcpy(YAFUfunction, "rho"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-rhomax"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -rhomax"); } break; case ID_YAFU_FUNTRIAL:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNTRIAL, 1); strcpy(YAFUfunction, "trial"); } break; case ID_YAFU_FUNECM:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNECM, 1); strcpy(YAFUfunction, "ecm"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-B1ecm"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -B1ecm"); SetDlgItemText(hwnd, ID_YAFU_FLAG2, "-B2ecm"); CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); strcpy(flag2, " -B2ecm"); SetDlgItemText(hwnd, ID_YAFU_FLAG3, "-sigma"); CheckDlgButton(hwnd, ID_YAFU_FLAG3, 0); strcpy(flag3, " -sigma"); SetDlgItemText(hwnd, ID_YAFU_FLAG4, "-threads"); CheckDlgButton(hwnd, ID_YAFU_FLAG4, 0); strcpy(flag4, " -threads"); } break; case ID_YAFU_FUNFERMAT:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNFERMAT, 1); strcpy(YAFUfunction, "fermat"); SetDlgItemText(hwnd, ID_YAFU_FLAG1, "-fmtmax"); CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); strcpy(flag1, " -fmtmax"); } break; //Function button routines - Arithmetic case ID_YAFU_FUNSHIFT:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSHIFT, 1); strcpy(YAFUfunction, "shift"); } break; case ID_YAFU_FUNNROOT:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNNROOT, 1); strcpy(YAFUfunction, "nroot"); } break; case ID_YAFU_FUNMODEXP:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNMODEXP, 1); strcpy(YAFUfunction, "modexp"); } break; case ID_YAFU_FUNSQRT:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNSQRT, 1); strcpy(YAFUfunction, "sqrt"); } break; case ID_YAFU_FUNLG2:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNLG2, 1); strcpy(YAFUfunction, "lg2"); } break; case ID_YAFU_FUNLOG:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNLOG, 1); strcpy(YAFUfunction, "log"); } break; case ID_YAFU_FUNLN:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNLN, 1); strcpy(YAFUfunction, "ln"); } break; case ID_YAFU_FUNGCD:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNGCD, 1); strcpy(YAFUfunction, "gcd"); } break; case ID_YAFU_FUNJACOBI:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNJACOBI, 1); strcpy(YAFUfunction, "jacobi"); } break; case ID_YAFU_FUNMODINV:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNMODINV, 1); strcpy(YAFUfunction, "modinv"); } break; case ID_YAFU_FUNFIB:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNFIB, 1); strcpy(YAFUfunction, "fib"); } break; case ID_YAFU_FUNLUC:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNLUC, 1); strcpy(YAFUfunction, "luc"); } break; case ID_YAFU_FUNLLT:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNLLT, 1); strcpy(YAFUfunction, "llt"); } break; case ID_YAFU_FLAG1:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG1)) CheckDlgButton(hwnd, ID_YAFU_FLAG1, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG1, 1); sw.bFlag1 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG1); } break; case ID_YAFU_FLAG2:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG2)) CheckDlgButton(hwnd, ID_YAFU_FLAG2, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG2, 1); sw.bFlag2 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG2); } break; case ID_YAFU_FLAG3:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG3)) CheckDlgButton(hwnd, ID_YAFU_FLAG3, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG3, 1); sw.bFlag3 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG3); } break; case ID_YAFU_FLAG4:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG4)) CheckDlgButton(hwnd, ID_YAFU_FLAG4, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG4, 1); sw.bFlag4 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG4); } break; case ID_YAFU_FLAG5:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG5)) CheckDlgButton(hwnd, ID_YAFU_FLAG5, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG5, 1); sw.bFlag5 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG5); } break; case ID_YAFU_FLAG6:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG6)) CheckDlgButton(hwnd, ID_YAFU_FLAG6, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG6, 1); sw.bFlag6 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG6); } break; case ID_YAFU_FLAG7:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG7)) CheckDlgButton(hwnd, ID_YAFU_FLAG7, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG7, 1); sw.bFlag7 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG7); } break; case ID_YAFU_FLAG8:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG8)) CheckDlgButton(hwnd, ID_YAFU_FLAG8, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG8, 1); sw.bFlag8 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG8); } break; case ID_YAFU_FLAG9:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG9)) CheckDlgButton(hwnd, ID_YAFU_FLAG9, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG9, 1); sw.bFlag9 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG9); } break; case ID_YAFU_FLAG10:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG10)) CheckDlgButton(hwnd, ID_YAFU_FLAG10, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG10, 1); sw.bFlag10 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG10); } break; case ID_YAFU_FLAG11:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG11)) CheckDlgButton(hwnd, ID_YAFU_FLAG11, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG11, 1); sw.bFlag11 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG11); } break; case ID_YAFU_FLAG12:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG12)) CheckDlgButton(hwnd, ID_YAFU_FLAG12, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG12, 1); sw.bFlag12 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG12); } break; case ID_YAFU_FLAG13:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG13)) CheckDlgButton(hwnd, ID_YAFU_FLAG13, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG13, 1); sw.bFlag13 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG13); } break; case ID_YAFU_FLAG14:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG14)) CheckDlgButton(hwnd, ID_YAFU_FLAG14, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG14, 1); sw.bFlag14 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG14); } break; case ID_YAFU_FLAG15:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG15)) CheckDlgButton(hwnd, ID_YAFU_FLAG15, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG15, 1); sw.bFlag15 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG15); } break; case ID_YAFU_FLAG16:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG16)) CheckDlgButton(hwnd, ID_YAFU_FLAG16, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG16, 1); sw.bFlag16 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG16); } break; case ID_YAFU_FLAG17:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG17)) CheckDlgButton(hwnd, ID_YAFU_FLAG17, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG17, 1); sw.bFlag17 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG17); } break; case ID_YAFU_FLAG18:{ if (IsDlgButtonChecked(hwnd, ID_YAFU_FLAG18)) CheckDlgButton(hwnd, ID_YAFU_FLAG18, 0); else CheckDlgButton(hwnd, ID_YAFU_FLAG18, 1); sw.bFlag18 = IsDlgButtonChecked(hwnd, ID_YAFU_FLAG18); } break; case ID_YAFU_SHOWCMD:{ buildYAFUcmd(hwnd); MessageBox(hwnd, YAFUCall.c_str(), "Command Line for YAFU Run", MB_OK); } break; case ID_FILE_OPENFL:{ char docfileOpen[2048]; strcpy(docfileOpen, txtCall.c_str()); strcat(docfileOpen, " factor.log"); CreateProcess(NULL, docfileOpen, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); } break; case ID_FILE_OPENSL:{ char docfileOpen[2048]; strcpy(docfileOpen, txtCall.c_str()); strcat(docfileOpen, " session.log"); CreateProcess(NULL, docfileOpen, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); } break; case ID_FILE_OPENRM:{ char docfileOpen[2048]; strcpy(docfileOpen, txtCall.c_str()); strcat(docfileOpen, " README"); CreateProcess(NULL, docfileOpen, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); } break; case ID_FILE_OPENYI:{ char docfileOpen[2048]; strcpy(docfileOpen, txtCall.c_str()); strcat(docfileOpen, " yafu.ini"); CreateProcess(NULL, docfileOpen, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo); } break; case ID_FILE_TUNE:{ clearRbuttons(hwnd); CheckDlgButton(hwnd, ID_YAFU_FUNNONE, 1); sw.bfNone = 1; strcpy(YAFUfunction, "tune()"); if (!bYAFURunning) startYAFU(hwnd); } break; case ID_YAFU_BIT32:{ CheckDlgButton(hwnd, ID_YAFU_BIT32, 1); CheckDlgButton(hwnd, ID_YAFU_BIT64, 0); sw.bit64 = 0; } break; case ID_YAFU_BIT64:{ CheckDlgButton(hwnd, ID_YAFU_BIT64, 1); CheckDlgButton(hwnd, ID_YAFU_BIT32, 0); sw.bit64 = 1; } break; case ID_YAFU_RUN:{ if (!bYAFURunning) startYAFU(hwnd); else{ stopYAFU(hwnd); } } break; case ID_YAFU_EXIT:{ if(bYAFURunning){ yn = MessageBox(hwnd, "A YAFU command is shown\ras still running. Exiting will close it.\r\rClose YAFUWin anyway?", "Exit YAFUWin?", MB_YESNO | MB_ICONEXCLAMATION); if (yn == IDYES){ stopYAFU(hwnd); PostMessage(hwnd, WM_CLOSE, 0, 0); } } else PostMessage(hwnd, WM_CLOSE, 0, 0); } break; } break; case WM_CLOSE:{ if (!sw.bAcceptance) DestroyWindow(hwnd); else{ saveSwitches(); DestroyWindow(hwnd); } } break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = MAKEINTRESOURCE(IDR_YAFUMENU); wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&wc)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } HMENU hmenu = CreateMenu(); hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, wName, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX, 0, 0, 800, 600, NULL, hmenu, hInstance, NULL); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; }