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

Function Ext2StartSrvAsUser

Ext2Mgr/Ext2Pipe.cpp:571–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569lpfnCreateProcessWithTokenW g_CreateProcessWithTokenW;
570
571int Ext2StartSrvAsUser(HANDLE token)
572{
573 LPWSTR cmd = NULL;
574 STARTUPINFOW si = {0};
575 PROCESS_INFORMATION pi = {0};
576 int rc = -1;
577
578 cmd = Ext2BuildCMDW();
579 if (!cmd) {
580 rc = -1;
581 goto errorout;
582 }
583
584 si.cb = sizeof( STARTUPINFO );
585 if (token && g_CreateProcessWithTokenW) {
586 rc = g_CreateProcessWithTokenW(
587 token, 0, NULL, cmd,
588 NORMAL_PRIORITY_CLASS |
589 CREATE_NO_WINDOW,
590 NULL, NULL,
591 &si, &pi );
592 } else {
593 rc = CreateProcessW( NULL, cmd, NULL, NULL,
594 FALSE, NORMAL_PRIORITY_CLASS |
595 CREATE_NO_WINDOW, NULL, NULL,
596 &si, &pi );
597 }
598
599 if (!rc) {
600 rc = -1 * GetLastError();
601 goto errorout;
602 }
603
604 g_Ext2Srv = pi;
605
606errorout:
607
608 if (cmd)
609 delete []cmd;
610
611 return rc;
612}
613
614int Ext2StartSrvAsElevated()
615{

Callers 1

Ext2StartSrvFunction · 0.85

Calls 1

Ext2BuildCMDWFunction · 0.85

Tested by

no test coverage detected