| 101 | } |
| 102 | |
| 103 | int Run(LPTSTR lpstrCmdLine = nullptr, int nCmdShow = SW_SHOWDEFAULT) { |
| 104 | CMessageLoop theLoop; |
| 105 | _Module.AddMessageLoop(&theLoop); |
| 106 | |
| 107 | HANDLE hThread = ::CreateThread(nullptr, 0, [](auto param)->DWORD { |
| 108 | std::string name = Helpers::GetNtosFileName(); |
| 109 | std::wstring osFileName = Helpers::StringToWstring(name); |
| 110 | InitSymbols(osFileName.c_str()); |
| 111 | if (!g_hasSymbol) |
| 112 | return -1; |
| 113 | InitSymbols(L"user32.dll"); |
| 114 | if (!g_hasSymbol) |
| 115 | return -1; |
| 116 | InitSymbols(L"ntdll.dll"); |
| 117 | if (!g_hasSymbol) |
| 118 | return -1; |
| 119 | InitSymbols(L"win32k.sys"); |
| 120 | if (!g_hasSymbol) |
| 121 | return -1; |
| 122 | InitSymbols(L"drivers\\fltmgr.sys"); |
| 123 | if (!g_hasSymbol) |
| 124 | return -1; |
| 125 | |
| 126 | |
| 127 | return 0; |
| 128 | }, nullptr, 0, nullptr); |
| 129 | |
| 130 | ::WaitForSingleObject(hThread, INFINITE); |
| 131 | if (!g_hasSymbol||NULL == hThread) { |
| 132 | AtlMessageBox(0, L"Failed init symbols,\r\nWinArk will exit...\r\n���ų�ʼ��ʧ�ܣ������˳�...", L"WinArk", MB_ICONERROR); |
| 133 | ClearSymbols(); |
| 134 | return 0; |
| 135 | } |
| 136 | ::CloseHandle(hThread); |
| 137 | |
| 138 | |
| 139 | SymbolHelper::Init(); |
| 140 | |
| 141 | InitColorSys(); |
| 142 | InitFontSys(); |
| 143 | InitPenSys(); |
| 144 | InitBrushSys(); |
| 145 | InitSchemSys(); |
| 146 | |
| 147 | CMainFrame wndMain; |
| 148 | |
| 149 | /*CString cmdLine(lpstrCmdLine); |
| 150 | cmdLine.Trim(L" \""); |
| 151 | if(!cmdLine.IsEmpty()&&cmdLine.Right(11).CompareNoCase(L"regedit.exe")!=0)*/ |
| 152 | |
| 153 | // CreateEx�Ż���� IDR_MAINFRAME��ص���Դ |
| 154 | _hMainWnd = wndMain.CreateEx(NULL); |
| 155 | if (_hMainWnd == NULL) { |
| 156 | ATLTRACE(_T("Main dialog creation failed!\n")); |
| 157 | return 0; |
| 158 | } |
| 159 | AddNotifyIcon(); |
| 160 |
no test coverage detected