MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / InitInstance

Method InitInstance

Ext2Mgr/Ext2Mgr.cpp:218–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218BOOL CExt2MgrApp::InitInstance()
219{
220 AfxEnableControlContainer();
221
222 HWND hWnd = ::FindWindow(NULL, "Ext2 Volume Manager");
223 if (hWnd) {
224 if (::GetWindowLongPtr(hWnd, DWLP_USER) == EXT2_DIALOG_MAGIC) {
225 ::ShowWindow(hWnd, SW_SHOW);
226 ::SetForegroundWindow(hWnd);
227 return FALSE;
228 }
229 }
230
231 BOOL bHide = FALSE;
232 BOOL bQuiet = FALSE;
233 BOOL bService = FALSE;
234 BOOL bInstall = FALSE;
235 BOOL bRemove = FALSE;
236 BOOL bStat = FALSE;
237
238 char * cmds = GetCommandLine();
239 int i = (int)strlen(cmds);
240 while (--i > 0) {
241 if (cmds[i] == (char)' ') {
242 cmds[i] = 0;
243 if ( strlen(&cmds[i+1]) == 5 &&
244 _stricmp(&cmds[i+2], "hide") == 0 &&
245 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
246 bHide = TRUE;
247 } else if (strlen(&cmds[i+1]) == 6 &&
248 _stricmp(&cmds[i+2], "quiet") == 0 &&
249 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
250 bHide = bQuiet = TRUE;
251 } else if (strlen(&cmds[i+1]) == 8 &&
252 _stricmp(&cmds[i+2], "install") == 0 &&
253 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
254 bInstall = TRUE;
255 } else if (strlen(&cmds[i+1]) == 7 &&
256 _stricmp(&cmds[i+2], "remove") == 0 &&
257 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
258 bRemove = TRUE;
259 } else if (strlen(&cmds[i+1]) == 8 &&
260 _stricmp(&cmds[i+2], "service") == 0 &&
261 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
262 bHide = bService = TRUE;
263 } else if (strlen(&cmds[i+1]) == 5 &&
264 _stricmp(&cmds[i+2], "stat") == 0 &&
265 (cmds[i+1] == '/' || cmds[i+1] == '-')) {
266 bHide = bStat = TRUE;
267 }
268 }
269 }
270
271 if (bInstall) {
272 Ext2SetManagerAsService(TRUE);
273 return FALSE;
274 }
275

Callers

nothing calls this directly

Calls 4

Ext2SetManagerAsServiceFunction · 0.85
Ext2IsX64SystemFunction · 0.85
ManagerStartServiceFunction · 0.85
ManagerStartMainFunction · 0.85

Tested by

no test coverage detected