/* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2007-2015 Hex-Rays <[email protected]> Detected compiler: Visual C++ */ #include <windows.h> #include <defs.h> //------------------------------------------------------------------------- // Function declarations // HWND __usercall start@<eax>(int a1@<ebp>); // void __userpurge WndProc(int a1@<ebx>, int a2@<edi>, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // HWND __userpurge GetText@<eax>(INT_PTR a1@<eax>, HWND hWnd, UINT a3, WPARAM a4, LPARAM a5); INT_PTR __stdcall DialogFunc(HWND, UINT, WPARAM, LPARAM); // idb // int __usercall GoodWork@<eax>(int a1@<ebp>); // int __usercall NoLuck@<eax>(int a1@<ebp>); // int __usercall ChFCompliance@<eax>(int a1@<ebp>, int a2@<edi>, char *a3); // void __usercall Loop(_BYTE *a1@<esi>); // char __usercall RegistrDown@<al>(char a1@<al>, _BYTE *a2@<esi>); char __cdecl PassGenerate(_BYTE *a1); // HCURSOR __stdcall LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName); // BOOL __stdcall MessageBeep(UINT uType); // HICON __stdcall LoadIconA(HINSTANCE hInstance, LPCSTR lpIconName); // HWND __stdcall SetFocus(HWND hWnd); // int __stdcall MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType); // void __stdcall PostQuitMessage(int nExitCode); // BOOL __stdcall InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase); // BOOL __stdcall TranslateMessage(const MSG *lpMsg); // BOOL __stdcall ShowWindow(HWND hWnd, int nCmdShow); // BOOL __stdcall UpdateWindow(HWND hWnd); // ATOM __stdcall RegisterClassA(const WNDCLASSA *lpWndClass); // HWND __stdcall CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); // LRESULT __stdcall DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // INT_PTR __stdcall DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); // LRESULT __stdcall DispatchMessageA(const MSG *lpMsg); // BOOL __stdcall EndDialog(HWND hDlg, INT_PTR nResult); // HWND __stdcall FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName); // UINT __stdcall GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int cchMax); // BOOL __stdcall GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); // HMODULE __stdcall GetModuleHandleA(LPCSTR lpModuleName); // void __stdcall __noreturn ExitProcess(UINT uExitCode); //------------------------------------------------------------------------- // Data declarations HWND hWnd = NULL; // idb MSG Msg = { NULL, 0u, 0u, 0, 0u, { 0, 0 } }; // idb WNDCLASSA WndClass = { 0u, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL }; // idb HINSTANCE hInstance = NULL; // idb CHAR WindowName[] = "CrackMe v1.0"; // idb CHAR ClassName[] = "No need to disasm the code!"; // idb char aMenu[5] = "MENU"; // weak CHAR aDlg_regis[] = "DLG_REGIS"; // idb CHAR TemplateName[] = "DLG_ABOUT"; // idb CHAR Caption[] = "Good work!"; // idb CHAR Text[] = "Great work, mate!\rNow try the next CrackMe!"; // idb CHAR aNoLuck[] = "No luck!"; // idb CHAR aNoLuckThereMat[] = "No luck there, mate!"; // idb CHAR byte_40217E[16] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', ... '\0' }; // idb CHAR String[3698] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0',... '\0', }; // idb //----- (00401000) -------------------------------------------------------- HWND __usercall start@<eax>(int a1@<ebp>) { HWND result; // eax@1 hInstance = GetModuleHandleA(0); result = FindWindowA(ClassName, 0); if ( !result ) { WndClass.style = 16387; WndClass.lpfnWndProc = (WNDPROC)WndProc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIconA(hInstance, (LPCSTR)0x64); WndClass.hCursor = LoadCursorA(0, (LPCSTR)0x7F00); WndClass.hbrBackground = (HBRUSH)5; WndClass.lpszMenuName = aMenu; WndClass.lpszClassName = ClassName; RegisterClassA(&WndClass); hWnd = CreateWindowExA(0, ClassName, WindowName, 0xCF0000u, 180, 110, 0x8000, 0x8000, 0, 0, hInstance, 0); ShowWindow(hWnd, 1); UpdateWindow(hWnd); InvalidateRect(*(HWND *)(a1 + 8), 0, 1); while ( (unsigned __int16)GetMessageA(&Msg, 0, 0, 0) ) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } ExitProcess(Msg.wParam); } return result; } //----- (00401128) -------------------------------------------------------- void __userpurge WndProc(int a1@<ebx>, int a2@<edi>, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { int v6; // ebp@0 int v7; // ST0C_4@21 if ( Msg == 2 ) goto LABEL_26; if ( Msg == 516 || Msg == 5 || Msg == 1 || Msg == 513 ) return; if ( Msg == 36 ) { *(_DWORD *)(lParam + 24) = 280; *(_DWORD *)(lParam + 28) = 160; *(_DWORD *)(lParam + 32) = 280; *(_DWORD *)(lParam + 36) = 160; return; } if ( Msg != 273 ) { DefWindowProcA(hWnd, Msg, wParam, lParam); return; } if ( wParam == 103 ) { DialogBoxParamA(hInstance, TemplateName, hWnd, DialogFunc, 0); return; } if ( wParam == 101 ) { LABEL_26: PostQuitMessage(0); return; } if ( wParam == 102 && DialogBoxParamA(hInstance, aDlg_regis, hWnd, (DLGPROC)GetText, 0) ) { v7 = ChFCompliance(v6, a2, String); PassGenerate(byte_40217E); if ( v7 == a1 ) GoodWork(v6); else NoLuck(v6); } } //----- (00401253) -------------------------------------------------------- HWND __userpurge GetText@<eax>(INT_PTR a1@<eax>, HWND hWnd, UINT a3, WPARAM a4, LPARAM a5) { if ( a3 == 272 ) return SetFocus(hWnd); if ( a3 == 273 ) { while ( 1 ) { a1 = 0; if ( a4 == 1003 ) break; if ( a4 != 1002 ) return 0; a4 = 1003; if ( GetDlgItemTextA(hWnd, 1000, String, 11) >= 1 ) { GetDlgItemTextA(hWnd, 1001, byte_40217E, 11); a1 = 1; break; } } } else if ( a3 != 16 ) { if ( a3 != 513 ) return 0; InvalidateRect(hWnd, 0, 1); return SetFocus(hWnd); } EndDialog(hWnd, a1); return (HWND)1; } //----- (0040130A) -------------------------------------------------------- INT_PTR __stdcall DialogFunc(HWND hDlg, UINT a2, WPARAM a3, LPARAM a4) { if ( a2 != 273 ) { if ( a2 != 16 ) return 0; goto LABEL_6; } if ( a3 == 1010 ) { LABEL_6: EndDialog(hDlg, 0); return 1; } return 0; } //----- (0040134D) -------------------------------------------------------- int __usercall GoodWork@<eax>(int a1@<ebp>) { return MessageBoxA(*(HWND *)(a1 + 8), Text, Caption, 0x30u); } //----- (00401362) -------------------------------------------------------- int __usercall NoLuck@<eax>(int a1@<ebp>) { MessageBeep(0); return MessageBoxA(*(HWND *)(a1 + 8), aNoLuckThereMat, aNoLuck, 0x30u); } //----- (0040137E) -------------------------------------------------------- int __usercall ChFCompliance@<eax>(int a1@<ebp>, int a2@<edi>, char *a3) { char *v3; // esi@1 char v4; // al@2 v3 = a3; while ( 1 ) { v4 = *v3; if ( !*v3 ) { Loop(a3); return a2 ^ 0x5678; } if ( (unsigned __int8)v4 < 0x41u ) break; if ( (unsigned __int8)v4 >= 0x5Au ) RegistrDown(v4, v3++); else ++v3; } return MessageBoxA(*(HWND *)(a1 + 8), aNoLuckThereMat, aNoLuck, 0x30u); } // 40137E: could not find valid save-restore pair for esi //----- (004013C2) -------------------------------------------------------- void __usercall Loop(_BYTE *a1@<esi>) { int v1; // edi@1 int v2; // ebx@1 v1 = 0; v2 = 0; while ( *a1 ) { LOBYTE(v2) = *a1; v1 += v2; ++a1; } } //----- (004013D2) -------------------------------------------------------- char __usercall RegistrDown@<al>(char a1@<al>, _BYTE *a2@<esi>) { char result; // al@1 result = a1 - 32; *a2 = result; return result; } //----- (004013D8) -------------------------------------------------------- char __cdecl PassGenerate(_BYTE *a1) { int v1; // eax@1 int v2; // edi@1 int v3; // ebx@1 _BYTE *i; // esi@1 v1 = 0; v2 = 0; v3 = 0; for ( i = a1; ; ++i ) { LOBYTE(v1) = 10; if ( !*i ) break; LOBYTE(v3) = *i - 48; v2 = v3 + v1 * v2; } return v1; } // ALL OK, 10 function(s) have been successfully decompiled
Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++
and start coding!
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter name:";
getline (cin, name);
cout << "Hello " << name;
return 0;
}
C++ is a widely used middle-level programming language.
When ever you want to perform a set of operations based on a condition If-Else is used.
if(conditional-expression) {
//code
}
else {
//code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
Switch is an alternative to If-Else-If ladder.
switch(conditional-expression){
case value1:
// code
break; // optional
case value2:
// code
break; // optional
......
default:
code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
return_type function_name(parameters);
function_name (parameters)
return_type function_name(parameters) {
// code
}