| 569 | lpfnCreateProcessWithTokenW g_CreateProcessWithTokenW; |
| 570 | |
| 571 | int 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 | |
| 606 | errorout: |
| 607 | |
| 608 | if (cmd) |
| 609 | delete []cmd; |
| 610 | |
| 611 | return rc; |
| 612 | } |
| 613 | |
| 614 | int Ext2StartSrvAsElevated() |
| 615 | { |
no test coverage detected