Exemplo n.º 1
0
        private static RM_PROCESS_INFO[] GetProcessInfoList(RmSafeHandle handle)
        {
            uint lpdwRebootReasons = 0;
            uint pnProcInfo        = 0;

            int status = RmGetList(handle, out uint pnProcInfoNeeded, ref pnProcInfo, null, ref lpdwRebootReasons);

            if (status != ERROR_MORE_DATA && status != 0)
            {
                throw new Win32Exception(status);
            }

            RM_PROCESS_INFO[] processInfo = new RM_PROCESS_INFO[pnProcInfoNeeded];
            pnProcInfo = pnProcInfoNeeded;

            status = RmGetList(handle, out _, ref pnProcInfo, processInfo, ref lpdwRebootReasons);
            if (status != 0)
            {
                throw new Win32Exception(status);
            }

            return(processInfo);
        }
Exemplo n.º 2
0
 static extern int RmStartSession(out RmSafeHandle pSessionHandle, int dwSessionFlags, string strSessionKey);
Exemplo n.º 3
0
 static extern int RmGetList(RmSafeHandle dwSessionHandle, out uint pnProcInfoNeeded, ref uint pnProcInfo, [In, Out] RM_PROCESS_INFO[] rgAffectedApps, ref uint lpdwRebootReasons);
Exemplo n.º 4
0
 static extern int RmRegisterResources(RmSafeHandle pSessionHandle, uint nFiles, string[] rgsFilenames, uint nApplications, RM_UNIQUE_PROCESS[] rgApplications, uint nServices, string[] rgsServiceNames);