亚洲精品亚洲人成在线观看麻豆,在线欧美视频一区,亚洲国产精品一区二区动图,色综合久久丁香婷婷

              當(dāng)前位置:首頁 > IT技術(shù) > Windows編程 > 正文

              C#代碼關(guān)閉Windows XP
              2021-08-08 13:21:14

              using?System;
              C#代碼關(guān)閉Windows XP_C#using?System.Runtime.InteropServices;
              C#代碼關(guān)閉Windows XP_C#???
              C#代碼關(guān)閉Windows XP_C#_03class?shoutdown{
              C#代碼關(guān)閉Windows XP_C#_04???[StructLayout(LayoutKind.Sequential,?Pack=1)]
              C#代碼關(guān)閉Windows XP_C#_04???internal?struct?TokPriv1Luid
              C#代碼關(guān)閉Windows XP_C#_06???{
              C#代碼關(guān)閉Windows XP_C#_04??????public?int?Count;
              C#代碼關(guān)閉Windows XP_C#_04??????public?long?Luid;
              C#代碼關(guān)閉Windows XP_C#_04??????public?int?Attr;
              C#代碼關(guān)閉Windows XP_C#_10???}
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???[DllImport("kernel32.dll",?ExactSpelling=true)?]
              C#代碼關(guān)閉Windows XP_C#_04???internal?static?extern?IntPtr?GetCurrentProcess();
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???[DllImport("advapi32.dll",?ExactSpelling=true,?SetLastError=true)?]
              C#代碼關(guān)閉Windows XP_C#_04???internal?static?extern?bool?OpenProcessToken(?IntPtr?h,?int?acc,?ref?IntPtr?phtok?);
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???[DllImport("advapi32.dll",?SetLastError=true)?]
              C#代碼關(guān)閉Windows XP_C#_04???internal?static?extern?bool?LookupPrivilegeValue(?string?host,?string?name,?ref?long?pluid?);
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???[DllImport("advapi32.dll",?ExactSpelling=true,?SetLastError=true)?]
              C#代碼關(guān)閉Windows XP_C#_04???internal?static?extern?bool?AdjustTokenPrivileges(?IntPtr?htok,?bool?disall,
              C#代碼關(guān)閉Windows XP_C#_04ref?TokPriv1Luid?newst,?int?len,?IntPtr?prev,?IntPtr?relen?);
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???[DllImport("user32.dll",?ExactSpelling=true,?SetLastError=true)?]
              C#代碼關(guān)閉Windows XP_C#_04???internal?static?extern?bool?ExitWindowsEx(?int?flg,?int?rea?);
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?SE_PRIVILEGE_ENABLED?=?0x00000002;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?TOKEN_QUERY?=?0x00000008;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?TOKEN_ADJUST_PRIVILEGES?=?0x00000020;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?string?SE_SHUTDOWN_NAME?=?"SeShutdownPrivilege";
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_LOGOFF?=?0x00000000;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_SHUTDOWN?=?0x00000001;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_REBOOT?=?0x00000002;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_FORCE?=?0x00000004;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_POWEROFF?=?0x00000008;
              C#代碼關(guān)閉Windows XP_C#_04???internal?const?int?EWX_FORCEIFHUNG?=?0x00000010;
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04???private?static?void?DoExitWin(int?flg)
              C#代碼關(guān)閉Windows XP_C#_06???{
              C#代碼關(guān)閉Windows XP_C#_04??????bool?ok;
              C#代碼關(guān)閉Windows XP_C#_04??????TokPriv1Luid?tp;
              C#代碼關(guān)閉Windows XP_C#_04??????IntPtr?hproc?=?GetCurrentProcess();
              C#代碼關(guān)閉Windows XP_C#_04??????IntPtr?htok?=?IntPtr.Zero;
              C#代碼關(guān)閉Windows XP_C#_04??????ok?=?OpenProcessToken(?hproc,?TOKEN_ADJUST_PRIVILEGES?|?TOKEN_QUERY,?ref?htok?);
              C#代碼關(guān)閉Windows XP_C#_04??????tp.Count?=?1;
              C#代碼關(guān)閉Windows XP_C#_04??????tp.Luid?=?0;
              C#代碼關(guān)閉Windows XP_C#_04??????tp.Attr?=?SE_PRIVILEGE_ENABLED;
              C#代碼關(guān)閉Windows XP_C#_04??????ok?=?LookupPrivilegeValue(?null,?SE_SHUTDOWN_NAME,?ref?tp.Luid?);
              C#代碼關(guān)閉Windows XP_C#_04??????ok?=?AdjustTokenPrivileges(?htok,?false,?ref?tp,?0,?IntPtr.Zero,?IntPtr.Zero?);
              C#代碼關(guān)閉Windows XP_C#_04??????ok?=?ExitWindowsEx(?flg,?0?);
              C#代碼關(guān)閉Windows XP_C#_10???}
              C#代碼關(guān)閉Windows XP_C#_04
              C#代碼關(guān)閉Windows XP_C#_04??????public?static?void?Main()
              C#代碼關(guān)閉Windows XP_C#_06??????{
              C#代碼關(guān)閉Windows XP_C#_04?????????Console.WriteLine("正在關(guān)閉計(jì)算機(jī)……");
              C#代碼關(guān)閉Windows XP_C#_04?????????//?修改?EWX_SHUTDOWN?或者?EWX_LOGOFF,?EWX_REBOOT等實(shí)現(xiàn)不同得功能。
              C#代碼關(guān)閉Windows XP_C#_04?????????//?在XP下可以看到幫助信息,以得到不同得參數(shù)
              C#代碼關(guān)閉Windows XP_C#_04?????????//?SHUTDOWN?/?
              C#代碼關(guān)閉Windows XP_C#_04?????????DoExitWin(EWX_SHUTDOWN);
              C#代碼關(guān)閉Windows XP_C#_10??????}
              C#代碼關(guān)閉Windows XP_C#_62}

              本文摘自 :https://blog.51cto.com/u

              開通會(huì)員,享受整站包年服務(wù)立即開通 >