예제 #1
0
파일: WinAPI.cs 프로젝트: wilson0x4d/Mubox
            // TODO: nothing is calling this
            // TODO: sandboxing should be a profile-level option
            public static void SafeDestroySandbox(WinAPI.SandboxApi.Sandbox sandbox)
            {
                SafeLoadSID(sandbox);

                // delete profile
                DeleteProfile(sandbox.SID, null, null);

                // delete user account
                NetUserDel(null, sandbox.UserName);
            }
예제 #2
0
파일: WinAPI.cs 프로젝트: wilson0x4d/Mubox
 internal static void MouseActionViaSendInput(WinAPI.WindowHook.MSLLHOOKSTRUCT hookStruct, int X, int Y)
 {
     MouseActionViaSendInput((MouseEventFlags)hookStruct.flags, hookStruct.time, X, Y, hookStruct.mouseData);
 }
예제 #3
0
파일: WinAPI.cs 프로젝트: wilson0x4d/Mubox
            public static Process LaunchProcess(
                WinAPI.SandboxApi.Sandbox sandbox,
                string applicationPath,
                string commandLine,
                string workingDirectory)
            {
                if (sandbox.Process != null)
                {
                    return sandbox.Process;
                }

                var startupInfo = new STARTUPINFO
                {
                    cb = Marshal.SizeOf(typeof(STARTUPINFO)),
                };

                var processInformation = new PROCESS_INFORMATION
                {
                };

                var result = CreateProcessWithLogonW(
                    sandbox.UserName,
                    string.IsNullOrEmpty(Environment.UserDomainName)
                        ? Environment.MachineName
                        : Environment.UserDomainName,
                    sandbox.Password,
                    LogonFlags.LOGON_WITH_PROFILE,
                    applicationPath,
                    commandLine,
                    CreationFlags.CREATE_NEW_CONSOLE,
                    (uint)0,
                    workingDirectory,
                    ref startupInfo,
                    out processInformation);

                if (!result)
                {
                    ("CreateProcessWithLogonW failed with err 0x" + Marshal.GetLastWin32Error().ToString("X")).LogCritical();
                }

                sandbox.Process = result
                    ? Process.GetProcessById(processInformation.dwProcessId)
                    : null;

                var processHandle = sandbox.Process.Handle;

                sandbox.Process.Exited += (s, e) =>
                    {
                        // !!!
                    };

                return sandbox.Process;
            }