1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
| int __stdcall myRegister(HINSTANCE hInstance, HGDIOBJ oldhFont, LPSTR pureCmdLine, int nCmdShow) { HINSTANCE hInst; int v6; HACCEL hAccelerator; void *v8; HWND hwnd; HMENU hMenu; HMENU hSubMenu; int hDeviceCaps; unsigned __int16 *iterCMD; unsigned __int16 *CopyIterCMD; int v15; int v16; WCHAR Name[32]; WINDOWPLACEMENT wndpl; struct tagRECT Rect; struct tagRECT rectStatus; LPARAM lParam[2]; HDC hdc;
WM_FINDREPLACE = RegisterWindowMessageW(L"commdlg_FindReplace"); if ( !WM_FINDREPLACE ) return 0; WM_HELP = RegisterWindowMessageW(L"commdlg_help"); if ( !WM_HELP ) return 0; hdc = GetDC(0); if ( !hdc ) return 0; hInst = hInstance; if ( !sub_1003D57(hInstance) ) return 0; v6 = GetSystemMetrics(41); hCursor_0 = LoadCursorW(0, (32513 - (v6 != 0))); hCursor = LoadCursorW(0, 0x7F02); hAccelerator = LoadAcceleratorsW(hInst, L"MainAcc"); hAccTable = hAccelerator; if ( !hCursor || !hAccelerator || !oldhFont && !myRegistClass(hInst) ) return 0; ::hInstance = hInst; psdw.lStructSize = 84; psdw.hDevMode = 0; psdw.hDevNames = 0; psdw.hInstance = hInst; sub_10018DF(v8); setFont(); hwnd = CreateWindowExW(0, ClassName, &szText, WS_OVERLAPPEDWINDOW, X, Y, nWidth, nHeight, 0, 0, hInst, 0); hwndParent = hwnd; psdw.hwndOwner = hwnd; if ( !hwnd ) return 0; if ( nWidth != 0x80000000 && nHeight != 0x80000000 ) { memset(&wndpl, 0, sizeof(wndpl)); wndpl.rcNormalPosition.left = X; wndpl.rcNormalPosition.right = nWidth + X; wndpl.rcNormalPosition.top = Y; wndpl.rcNormalPosition.bottom = nHeight + Y; wndpl.length = 44; SetWindowPlacement(hwnd, &wndpl); hwnd = hwndParent; } DragAcceptFiles(hwnd, 1); GetClientRect(hwndParent, &Rect); hWnd = CreateWindowExW( 0x200u, L"Edit", &szText, wParam1 != 0 ? 0x50200104 : 0x50300104, 0, 0, Rect.right, Rect.bottom - 100, hwndParent, 0xF, hInstance, 0); if ( !hWnd ) return 0; hwndStatus = CreateStatusWindowW( (*&isStatusWndVisible != 0 ? WS_VISIBLE : 0) | 0x44800000,
&szText, hwndParent, 0x401u); if ( !hwndStatus ) return 0; hookfunc(1); GetClientRect(hwndStatus, &rectStatus); cyStatus = rectStatus.bottom - rectStatus.top; lParam[1] = -1; lParam[0] = 3 * (rectStatus.right - rectStatus.left) / 4; SendMessageW(hwndStatus, SB_SETPARTS, 2u, lParam); SendMessageW(hWnd, EM_FMTLINES, wParam1, 0); if ( wParam1 ) { hMenu = GetMenu(hwndParent); hSubMenu = GetSubMenu(hMenu, 3); EnableMenuItem(hSubMenu, 0x1Bu, 1u); } hDeviceCaps = GetDeviceCaps(hdc, 90); lf.lfHeight = -MulDiv(*&nNumber, hDeviceCaps, 720); hFont = CreateFontIndirectW(&lf); oldhFont = SelectObject(hdc, hFont); GetTextFaceW(hdc, 32, Name); SelectObject(hdc, oldhFont); if ( lstrcmpiW(Name, lf.lfFaceName) ) { EnumFontsW(hdc, lf.lfFaceName, Proc, &lf); DeleteObject(hFont); hFont = CreateFontIndirectW(&lf); } SendMessageW(hWnd, WM_SETFONT, hFont, 0); ReleaseDC(0, hdc); word_1009800 = 0; hMem = LocalAlloc(0x42u, 2u); PostMessageW(hWnd, EM_LIMITTEXT, 0, 0); sub_1001C5B(lpString2); ShowWindow(hwndParent, nCmdShow); SetCursor(hCursor_0); iterCMD = getNextCMD(pureCmdLine); encodingMode = -1; CopyIterCMD = iterCMD; if ( !Lstrcmp(iterCMD, L"/A") ) { encodingMode = 0; LABEL_25: CopyIterCMD = getNextCMD(CopyIterCMD + 2); goto LABEL_26; } if ( !Lstrcmp(CopyIterCMD, L"/W") ) encodingMode = 1; if ( encodingMode != -1 ) goto LABEL_25; LABEL_26: v15 = sub_1003E29(CopyIterCMD); if ( !v15 ) { if ( sub_1003F7F(CopyIterCMD, nCmdShow) ) { PostMessageW(hwndParent, WM_CLOSE, 0, 0); return 1; } if ( *CopyIterCMD ) { sub_1003C5B(FileName, CopyIterCMD); hFile = CreateFileW(FileName, 0x80000000, 3u, 0, 3u, 0x80u, 0); if ( hFile != -1 ) goto LABEL_41; if ( GetLastError() == 2 ) { v16 = sub_1001F55(hwndParent, lpCaption, dword_1008020, FileName, 0x33u); if ( v16 == 2 ) return 0; if ( v16 == 6 ) hFile = CreateFileW(FileName, 0xC0000000, 3u, 0, 4u, 0x80u, 0); } else { sub_1004A24(FileName); sub_1001C5B(lpString2); lstrcpyW(FileName, lpString2); } if ( hFile != -1 ) LABEL_41: sub_1004D75(FileName, encodingMode); } LABEL_42: sub_10040D7(&word_10095E0); sub_10040D7(&word_1009540); memset(&ofnw, 0, sizeof(ofnw)); ofnw.hInstance = hInstance; memset(&findReplace, 0, sizeof(findReplace)); ofnw.lStructSize = 88; ofnw.hwndOwner = hwndParent; ofnw.nMaxFile = 260; findReplace.lStructSize = 40; findReplace.hwndOwner = hwndParent; SendMessageW(hWnd, EM_GETSEL, &nCmdShow, &hInstance); SendMessageW(hWnd, EM_SETSEL, nCmdShow, hInstance); SendMessageW(hWnd, EM_SCROLLCARET, 0, 0); if ( (GetKeyboardLayout(0) & 0x3FF) == 0x11 ) SendMessageW(hWnd, EM_SETIMESTATUS, 1u, 1); return 1; } if ( v15 != 2 ) goto LABEL_42; return 0; }
|