char RetrieveKeyInfo(int level_input, const char* name_, unsigned long hardwareID, const char* origkey_, struct KeyInformation* keyinfo, HWND hwndDlg, UINT control_id) { unsigned short keydatecreated=0, keyotherinfo[5]= {0,0,0,0,0}; unsigned long keytemplateID=0; HWND log=(HWND)0; char log_msg[1024]=""; char name[1024]=""; char serial[1024]=""; char* origkey=serial; strcpy(origkey, origkey_); strcpy(name, name_); bool firstlog=true; bool keystring=false; char keystring_text[256]=""; struct CipherKeyStruct *cipherkey; char cooked[512]=""; int x, v3=0, shortv3=0; int level=level_input; if(hwndDlg && control_id) log=GetDlgItem(hwndDlg, control_id); if(level>=14) { shortv3=1; level=level-13; //ShortV3 keys can have signature levels 1 through 10 now if(level<1 || level>10) return 0; } else if(level>=5) { v3=1; //TODO: remove? level=level-4; //V3 keys can now have signature levels 1 through 9 if(level<1 || level>9) return 0; } else if(level!=0) { //V2 keys can only have signature levels 1 through 4 if(level<1 || level>4) return 0; } bool key_appears_nameless=false; const char* nameless_check=origkey; while(*nameless_check=='0' || *nameless_check=='-') nameless_check++; if(*nameless_check=='2' && shortv3) key_appears_nameless=true; if(!name[0] || key_appears_nameless) //nameless key? { if(!shortv3) { AddLogMessage(log, "Only ShortV3 Keys can be nameless...", true); return 0; } //remove prepended zero bytes while(*origkey=='0' || *origkey=='-') origkey++; //check for the nameless identifier if(*origkey!='2') { AddLogMessage(log, "Key does not appear to be nameless...", true); return 0; } //retrieve the name int count1=0,count2=0; for(; count2<6; count1++) if(origkey[count1]!='-') { name[count2]=origkey[count1]; count2++; } origkey+=count1; sprintf(log_msg, "Nameless Key:\r\nName=%s, Key=%s", name, origkey); AddLogMessage(log, log_msg, true); firstlog=false; } if(level==0) ///Analyse unsigned keys { unsigned long k[2]= {0}; const char *c=origkey; int digits=0; char cc; while(digits<8 && *c) { cc=hexdigit(*c++); if(cc>=0) { digits++; k[0]=(k[0]<<4)|cc; } } while(digits<16 && *c) { cc=hexdigit(*c++); if(cc>=0) { digits++; k[1]=(k[1]<<4)|cc; } } if(log) { ByteArray2String((unsigned char*)k, log_msg, sizeof(unsigned long)*2, 20); AddLogMessage(log, "Enciphered KeyBytes (Len: 8):", true); AddLogMessage(log, log_msg, false); } CookText(cooked, name); cipherkey=CreateCipherKey(cooked, strlen(cooked)); Decipher(cipherkey, (char*)k, sizeof(unsigned long)*2); if(log) { ByteArray2String((unsigned char*)k, log_msg, sizeof(unsigned long)*2, 20); AddLogMessage(log, "Deciphered KeyBytes:", false); AddLogMessage(log, log_msg, false); } ReleaseCipherKey(cipherkey); keytemplateID=k[0]; keydatecreated=(unsigned short)(k[1]>>16); keyotherinfo[0]=(unsigned short)(k[1]&0xFFFF); }
BOOL CALLBACK DlgAnalysis(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { SetLevelList(hwndDlg); SetDlgItemTextA(hwndDlg, IDC_EDT_HWID, "0000-0000"); keyinfo_level=0; } return TRUE; case WM_CLOSE: { EndDialog(hwndDlg, 0); } return TRUE; case WM_HELP: { char id[10]=""; sprintf(id, "%d", IDS_HELPANALYZE); SetEnvironmentVariableA("HELPID", id); SetEnvironmentVariableA("HELPTITLE", "Analysis Help"); DialogBox(hInst, MAKEINTRESOURCE(DLG_HELP), hwndDlg, DlgHelp); } return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_BTN_ANALYZE: { NoFocus(); char keyinfo_name[1024]=""; char keyinfo_hwid[10]=""; char keyinfo_key[1024]=""; unsigned hwid=0; GetDlgItemTextA(hwndDlg, IDC_EDT_NAME, keyinfo_name, 1024); if(!GetDlgItemTextA(hwndDlg, IDC_EDT_SERIAL, keyinfo_key, 1024)) { SetDlgItemTextA(hwndDlg, IDC_EDT_ADVLOG, "You need to enter a serial!"); return TRUE; } int len=GetDlgItemTextA(hwndDlg, IDC_EDT_HWID, keyinfo_hwid, 10); if(len) { FormatHex(keyinfo_hwid); sscanf(keyinfo_hwid, "%X", &hwid); } KeyInformation info= {0}; if(RetrieveKeyInfo(keyinfo_level, keyinfo_name, hwid, keyinfo_key, &info, hwndDlg, IDC_EDT_ADVLOG)) { char temp[100]=""; HWND log=GetDlgItem(hwndDlg, IDC_EDT_ADVLOG); bool xorsym=false; if(hwid) { if(!xorsym) { xorsym=true; AddLogMessage(log, "Symmetric key changes:", false); } sprintf(temp, "%.8X^%.8X=%.8X (keytemplateID^hwid=sym)", (unsigned int)info.symkey^hwid, (unsigned int)hwid, (unsigned int)info.symkey); AddLogMessage(log, temp, false); } if(sym_xorval) { if(!xorsym) { xorsym=true; //TODO: remove? AddLogMessage(log, "Symmetric key changes:", false); } sprintf(temp, "%.8X^%.8X=%.8X (sym^xorval=newsym)", (unsigned int)info.symkey, (unsigned int)sym_xorval, (unsigned int)info.symkey^sym_xorval); AddLogMessage(log, temp, false); } sprintf(temp, "%.8X", (unsigned int)info.symkey^sym_xorval); SetDlgItemTextA(hwndDlg, IDC_EDT_SYM, temp); sprintf(temp, "%.4d-%.2d-%.2d", info.createdyear, info.createdmonth, info.createdday); SetDlgItemTextA(hwndDlg, IDC_EDT_DATE, temp); sprintf(temp, "%d", info.otherinfo[0]); SetDlgItemTextA(hwndDlg, IDC_EDT_OTHER0, temp); sprintf(temp, "%d", info.otherinfo[1]); SetDlgItemTextA(hwndDlg, IDC_EDT_OTHER1, temp); sprintf(temp, "%d", info.otherinfo[2]); SetDlgItemTextA(hwndDlg, IDC_EDT_OTHER2, temp); sprintf(temp, "%d", info.otherinfo[3]); SetDlgItemTextA(hwndDlg, IDC_EDT_OTHER3, temp); sprintf(temp, "%d", info.otherinfo[4]); SetDlgItemTextA(hwndDlg, IDC_EDT_OTHER4, temp); sprintf(temp, "%.8X", (unsigned int)info.uninstallcode); SetDlgItemTextA(hwndDlg, IDC_EDT_UNINSTALLCODE, temp); if(info.keystring_length) SetDlgItemTextA(hwndDlg, IDC_EDT_KEYSTRING, info.keystring); else SetDlgItemTextA(hwndDlg, IDC_EDT_KEYSTRING, "No KeyString embedded in this key..."); sprintf(temp, "%d", info.keystring_length); SetDlgItemTextA(hwndDlg, IDC_EDT_KEYSTRING_LENGTH, temp); SendMessageA(log, WM_VSCROLL, SB_BOTTOM, 0); } } return TRUE; case IDC_CHK_DIGITALRIVER: ///Digital River checkbox. { NoFocus(); if(IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) { CheckDlgButton(hwndDlg, IDC_CHK_ESELLERATE, BST_UNCHECKED); sym_xorval=0x91827364; ///Official XOR value of DigitalRiver tagged keys... } else sym_xorval=0; } return TRUE; case IDC_CHK_ESELLERATE: ///eSellerate checkbox. { NoFocus(); if(IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) { CheckDlgButton(hwndDlg, IDC_CHK_DIGITALRIVER, BST_UNCHECKED); sym_xorval=0x19283746; ///Official XOR value of eSellerate tagged keys... } else sym_xorval=0; } return TRUE; case IDC_COMBO_LEVEL: { switch(HIWORD(wParam)) { case CBN_SELCHANGE: { bool isNoSeperator=true; keyinfo_level=SendDlgItemMessageA(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0); if(keyinfo_level==1 or keyinfo_level==6 or keyinfo_level==16) isNoSeperator=false; bool en=isNoSeperator; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_NAME), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_SERIAL), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_HWID), en); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ANALYZE), en); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DIGITALRIVER), en); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ESELLERATE), en); if(keyinfo_level>1 and keyinfo_level<6) keyinfo_level--; else if(keyinfo_level>6 and keyinfo_level<16) keyinfo_level-=2; else if(keyinfo_level>16) keyinfo_level-=3; } return TRUE; } } return TRUE; } } return TRUE; } return FALSE; }
BOOL CALLBACK KG_DlgKeyGenerate(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { SetLevelList(hwndDlg); SetDlgItemTextA(hwndDlg, IDC_EDT_HWID, "0000-0000"); bool en = false; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER1), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER2), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER3), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER4), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_KEYSTRING), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_PVT), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_Y), en); ShowWindow(GetDlgItem(hwndDlg, IDC_CHK_BABOON), 0); keygenerate_level = -1; SYSTEMTIME systime = {0}; GetSystemTime(&systime); char temp[20] = ""; sprintf(temp, "%d", MakeDate(systime.wYear, systime.wMonth, systime.wDay)); SetDlgItemTextA(hwndDlg, IDC_EDT_DATE, temp); sprintf(temp, "%.4d-%.2d-%.2d", systime.wYear, systime.wMonth, systime.wDay); SetDlgItemTextA(hwndDlg, IDC_EDT_DATEYMD, temp); SendDlgItemMessageA(hwndDlg, IDC_EDT_KEYSTRING, EM_SETLIMITTEXT, 255, 0); } return TRUE; case WM_CONTEXTMENU: { if(GetDlgCtrlID((HWND)wParam) == IDC_EDT_SERIAL) { char serial[2048] = ""; int len = GetDlgItemTextA(hwndDlg, IDC_EDT_SERIAL, serial, 2048); if(!len) return TRUE; HMENU myMenu = 0; myMenu = CreatePopupMenu(); AppendMenu(myMenu, MF_STRING, 1, "Copy Serial"); POINT cursorPos; GetCursorPos(&cursorPos); SetForegroundWindow(hwndDlg); UINT MenuItemClicked = TrackPopupMenu(myMenu, TPM_RETURNCMD | TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0); SendMessage(hwndDlg, WM_NULL, 0, 0); if(MenuItemClicked == 1) { CopyToClipboard(serial); MessageBeep(MB_ICONINFORMATION); } } } return TRUE; case WM_HELP: { char id[10] = ""; sprintf(id, "%d", IDS_HELPKEYGEN); SetEnvironmentVariableA("HELPID", id); SetEnvironmentVariableA("HELPTITLE", "KeyGen Help"); DialogBox(hInst, MAKEINTRESOURCE(DLG_HELP), hwndDlg, DlgHelp); } return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_BTN_GENERATE: { NoFocus(); char name[512] = ""; char keystring[512] = ""; char pvt[512] = ""; char y[512] = ""; char hwid[10] = ""; char sym[10] = ""; char templ[512] = ""; unsigned int sy = 0, hw = 0; GetDlgItemTextA(hwndDlg, IDC_EDT_NAME, name, 512); GetDlgItemTextA(hwndDlg, IDC_EDT_KEYSTRING, keystring, 256); GetDlgItemTextA(hwndDlg, IDC_EDT_HWID, hwid, 10); GetDlgItemTextA(hwndDlg, IDC_EDT_SYM, sym, 10); FormatHex(hwid); FormatHex(sym); sscanf(hwid, "%X", &hw); sscanf(sym, "%X", &sy); sprintf(sym, "%.8X", sy); SetDlgItemTextA(hwndDlg, IDC_EDT_SYM, sym); GetDlgItemTextA(hwndDlg, IDC_EDT_PVT, pvt, 512); int len = GetDlgItemTextA(hwndDlg, IDC_EDT_Y, y, 512); int comma_count = 0; for(int i = 0; i < len; i++) if(y[i] == ',') comma_count++; bool baboon = !!IsDlgButtonChecked(hwndDlg, IDC_CHK_BABOON); if(keygenerate_level == 29 and comma_count != 2 and !baboon) { AddLogMessage(GetDlgItem(hwndDlg, IDC_EDT_ADVLOG), "Invalid ECDSA Public format...\nUse: ", true); return TRUE; } if(((!*pvt) or (!*y)) and keygenerate_level != -1 and !baboon) { if(GetDlgItemTextA(hwndDlg, IDC_EDT_TEMPLATE, templ, 512)) { KG_GeneratePvtY(keygenerate_level, templ, pvt, y); SetDlgItemTextA(hwndDlg, IDC_EDT_PVT, pvt); SetDlgItemTextA(hwndDlg, IDC_EDT_Y, y); } else { AddLogMessage(GetDlgItem(hwndDlg, IDC_EDT_ADVLOG), "You should enter the values for the key signing...", true); return TRUE; } } int date = GetDlgItemInt(hwndDlg, IDC_EDT_DATE, 0, 0); int other0 = GetDlgItemInt(hwndDlg, IDC_EDT_OTHER0, 0, 0) & 65535; int other1 = GetDlgItemInt(hwndDlg, IDC_EDT_OTHER1, 0, 0) & 65535; int other2 = GetDlgItemInt(hwndDlg, IDC_EDT_OTHER2, 0, 0) & 65535; int other3 = GetDlgItemInt(hwndDlg, IDC_EDT_OTHER3, 0, 0) & 65535; int other4 = GetDlgItemInt(hwndDlg, IDC_EDT_OTHER4, 0, 0) & 65535; SetDlgItemInt(hwndDlg, IDC_EDT_DATE, date, 1); if(IsDlgButtonChecked(hwndDlg, IDC_CHK_MODKEY)) date = 65344; SetDlgItemInt(hwndDlg, IDC_EDT_OTHER0, other0, 0); if(keygenerate_level != -1) { SetDlgItemInt(hwndDlg, IDC_EDT_OTHER1, other1, 0); SetDlgItemInt(hwndDlg, IDC_EDT_OTHER2, other2, 0); SetDlgItemInt(hwndDlg, IDC_EDT_OTHER3, other3, 0); SetDlgItemInt(hwndDlg, IDC_EDT_OTHER4, other4, 0); } SetDlgItemTextA(hwndDlg, IDC_EDT_SERIAL, CreateSignedKey(keygenerate_level, sy, keygenerate_sym_xorval, pvt, y, keystring, date, name, hw, other0, other1, other2, other3, other4, baboon, GetDlgItem(hwndDlg, IDC_EDT_ADVLOG))); SendMessageA(GetDlgItem(hwndDlg, IDC_EDT_ADVLOG), WM_VSCROLL, SB_BOTTOM, 0); } return TRUE; case IDC_BTN_MAKEDATE: { NoFocus(); char date_text[20] = ""; char new_date[20] = ""; int len = GetDlgItemTextA(hwndDlg, IDC_EDT_DATEYMD, date_text, 20); for(int i = 0, j = 0; i < len; i++) if(date_text[i] != '-') j += sprintf(new_date + j, "%c", date_text[i]); len = strlen(new_date); UINT dest_id; HMENU myMenu = 0; myMenu = CreatePopupMenu(); if(len != 8) AppendMenuA(myMenu, MF_STRING | MF_GRAYED, 3, "Error!"); else { AppendMenu(myMenu, MF_STRING, 1, "Date"); AppendMenu(myMenu, MF_STRING, 2, "oth0"); } POINT cursorPos; GetCursorPos(&cursorPos); SetForegroundWindow(hwndDlg); UINT MenuItemClicked = TrackPopupMenu(myMenu, TPM_RETURNCMD | TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0); SendMessage(hwndDlg, WM_NULL, 0, 0); switch(MenuItemClicked) { case 1: dest_id = IDC_EDT_DATE; break; case 2: dest_id = IDC_EDT_OTHER0; break; case 3: return TRUE; break; } char y[5] = "", m[3] = "", d[3] = ""; int y_ = 0, m_ = 0, d_ = 0; strncpy(y, new_date, 4); strncpy(m, new_date + 4, 2); strncpy(d, new_date + 6, 2); sscanf(y, "%d", &y_); sscanf(m, "%d", &m_); sscanf(d, "%d", &d_); sprintf(date_text, "%d", MakeDate(y_, m_, d_)); SetDlgItemTextA(hwndDlg, dest_id, date_text); } return TRUE; case IDC_CHK_BABOON: { NoFocus(); bool baboon = true; if(IsDlgButtonChecked(hwndDlg, IDC_CHK_BABOON)) baboon = false; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_PVT), baboon); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_Y), baboon); } return TRUE; case IDC_BTN_CALC: { NoFocus(); char temp[1024] = ""; char temp2[256] = ""; UINT MenuItemClicked = 1; HMENU myMenu = 0; char clipboard[256] = ""; char pvt[1024] = ""; char y[1024] = ""; if(!GetDlgItemTextA(hwndDlg, IDC_EDT_TEMPLATE, temp, 1024)) return TRUE; KG_GeneratePvtY(keygenerate_level, temp, pvt, y); sprintf(temp, "%.8X", KG_GenerateSymmetric(keygenerate_level, temp)); if(keygenerate_level >= 0) { myMenu = CreatePopupMenu(); AppendMenuA(myMenu, MF_STRING, 4, "Sym Only"); if(keygenerate_level == 29) AppendMenu(myMenu, MF_STRING, 1, "Pvt, ECDSA, Sym"); else AppendMenu(myMenu, MF_STRING, 1, "Pvt, Y, Sym"); if(keygenerate_level == 29) AppendMenu(myMenu, MF_STRING, 2, "Pvt, ECDSA"); else AppendMenu(myMenu, MF_STRING, 2, "Pvt, Y"); PasteFromClipboard(clipboard, 256); FormatHex(clipboard); int len = strlen(clipboard); if(len and len < 9) { unsigned int clipboard_sym = 0; sscanf(clipboard, "%X", &clipboard_sym); if(keygenerate_level == 29) sprintf(temp2, "Pvt, ECDSA, Sym: %.8X", clipboard_sym); else sprintf(temp2, "Pvt, Y, Sym: %.8X", clipboard_sym); AppendMenu(myMenu, MF_STRING, 3, temp2); } POINT cursorPos; GetCursorPos(&cursorPos); SetForegroundWindow(hwndDlg); MenuItemClicked = TrackPopupMenu(myMenu, TPM_RETURNCMD | TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0); SendMessage(hwndDlg, WM_NULL, 0, 0); } switch(MenuItemClicked) { case 1: { SetDlgItemTextA(hwndDlg, IDC_EDT_Y, y); SetDlgItemTextA(hwndDlg, IDC_EDT_PVT, pvt); SetDlgItemTextA(hwndDlg, IDC_EDT_SYM, temp); } break; case 2: { SetDlgItemTextA(hwndDlg, IDC_EDT_Y, y); SetDlgItemTextA(hwndDlg, IDC_EDT_PVT, pvt); } break; case 3: { SetDlgItemTextA(hwndDlg, IDC_EDT_Y, y); SetDlgItemTextA(hwndDlg, IDC_EDT_PVT, pvt); SetDlgItemTextA(hwndDlg, IDC_EDT_SYM, clipboard); } break; case 4: { SetDlgItemTextA(hwndDlg, IDC_EDT_SYM, temp); } break; } if(keygenerate_level >= 0) DestroyMenu(myMenu); } return TRUE; case IDC_CHK_DIGITALRIVER: ///Digital River checkbox. { NoFocus(); if(IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) { CheckDlgButton(hwndDlg, IDC_CHK_ESELLERATE, 0); keygenerate_sym_xorval = 0x91827364; ///Official XOR value of DigitalRiver tagged keys... } else keygenerate_sym_xorval = 0; } return TRUE; case IDC_CHK_ESELLERATE: ///eSellerate checkbox. { NoFocus(); if(IsDlgButtonChecked(hwndDlg, LOWORD(wParam))) { CheckDlgButton(hwndDlg, IDC_CHK_DIGITALRIVER, 0); keygenerate_sym_xorval = 0x19283746; ///Official XOR value of eSellerate tagged keys... } else keygenerate_sym_xorval = 0; } return TRUE; case IDC_CHK_MODKEY: { NoFocus(); } return TRUE; case IDC_COMBO_LEVEL: { switch(HIWORD(wParam)) { case CBN_SELCHANGE: { bool isNoSeperator = true; keygenerate_level = SendDlgItemMessageA(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0); if(keygenerate_level == 1 or keygenerate_level == 6 or keygenerate_level == 16) isNoSeperator = false; if(!keygenerate_level) keygenerate_level--; else if(keygenerate_level > 1 and keygenerate_level < 6) //signed v2 keygenerate_level -= 2; else if(keygenerate_level > 6 and keygenerate_level < 16) //signed v3 keygenerate_level += 3; else if(keygenerate_level > 16) //short v3 keygenerate_level += 3; bool en = isNoSeperator; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_NAME), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_HWID), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_TEMPLATE), en); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CALC), en); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_DIGITALRIVER), en); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ESELLERATE), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_SYM), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_DATEYMD), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_DATE), en); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_MAKEDATE), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER0), en); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_GENERATE), en); if(keygenerate_level == -1) en = false; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER1), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER2), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER3), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_OTHER4), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_PVT), en); EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_Y), en); en = false; if(keygenerate_level > 18 and isNoSeperator) en = true; EnableWindow(GetDlgItem(hwndDlg, IDC_EDT_KEYSTRING), en); /*char temp[10]=""; sprintf(temp, "%d", keygenerate_level);*/ if(isNoSeperator) { SetDlgItemTextA(hwndDlg, IDC_EDT_PVT, ""); SetDlgItemTextA(hwndDlg, IDC_EDT_Y, ""); } bool baboon = false; if(keygenerate_level == 29) { SetDlgItemTextA(hwndDlg, IDC_STC_YPUB, "ECDSA Public:"); baboon = true; } else { SetDlgItemTextA(hwndDlg, IDC_STC_YPUB, "Y:"); CheckDlgButton(hwndDlg, IDC_CHK_BABOON, 0); } ShowWindow(GetDlgItem(hwndDlg, IDC_CHK_BABOON), baboon); } return TRUE; } } return TRUE; } } return TRUE; } return FALSE; }