第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

.net中的CreateJobObject / SetInformationJobObject

.net中的CreateJobObject / SetInformationJobObject

LEATH 2019-10-29 10:35:08
我正在努力拼湊一個(gè)拼湊的CreateJobObject和SetInformationJobObject的工作示例。通過各種Google搜索(包括俄語和中文帖子?。覍⒁韵麓a拼湊在一起。我認(rèn)為JOBOBJECT_BASIC_LIMIT_INFORMATION的定義根據(jù)平臺(tái)(32/64位)而變化。CreateJobObject / AssignProcessToJobObject 似乎可以工作。SetInformationJobObject失敗-錯(cuò)誤24或87。Process myProcess // POPULATED SOMEWHERE ELSE// Create Job & assign this process and another process to the jobIntPtr jobHandle = CreateJobObject( null , null );AssignProcessToJobObject( jobHandle , myProcess.Handle );AssignProcessToJobObject( jobHandle , Process.GetCurrentProcess().Handle );// Ensure that killing one process kills the others                JOBOBJECT_BASIC_LIMIT_INFORMATION limits = new JOBOBJECT_BASIC_LIMIT_INFORMATION();limits.LimitFlags = (short)LimitFlags.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;IntPtr pointerToJobLimitInfo = Marshal.AllocHGlobal( Marshal.SizeOf( limits ) );Marshal.StructureToPtr( limits , pointerToJobLimitInfo , false );   SetInformationJobObject( job , JOBOBJECTINFOCLASS.JobObjectBasicLimitInformation , pionterToJobLimitInfo ,  ( uint )Marshal.SizeOf( limits ) )...        [DllImport( "kernel32.dll" , EntryPoint = "CreateJobObjectW" , CharSet = CharSet.Unicode )]        public static extern IntPtr CreateJobObject( SecurityAttributes JobAttributes , string lpName );        public class SecurityAttributes        {            public int nLength; //Useless field = 0            public IntPtr pSecurityDescriptor; //хз))            public bool bInheritHandle; //Возможность наследования            public SecurityAttributes()            {                this.bInheritHandle = true;                this.nLength = 0;                this.pSecurityDescriptor = IntPtr.Zero;            }        }        [DllImport( "kernel32.dll" )]        static extern bool SetInformationJobObject( IntPtr hJob , JOBOBJECTINFOCLASS JobObjectInfoClass , IntPtr lpJobObjectInfo , uint cbJobObjectInfoLength );
查看完整描述

3 回答

?
qq_遁去的一_1

TA貢獻(xiàn)1725條經(jīng)驗(yàn) 獲得超8個(gè)贊

總而言之,亞歷山大·葉祖托夫(Alexander Yezutov)構(gòu)成的簽名在x86和x64上均可工作。當(dāng)應(yīng)改用UIntPtr時(shí),Matt Howells簽名使用許多UInt32。我為CloseHandle使用了以下P / Invoke簽名,它似乎可以正常工作:


[DllImport("kernel32.dll", SetLastError = true)]

static extern bool CloseHandle(IntPtr hObject);

必須將以下內(nèi)容添加到由Mas發(fā)布的app.manifest中:


<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">

<application>

  <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->


    <!--The ID below indicates application support for Windows Vista -->

    <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>


    <!--The ID below indicates application support for Windows 7 -->

    <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>


</application>

最后,從Visual Studio啟動(dòng)時(shí),這將不起作用(至少在Win 7下)。父進(jìn)程必須從Windows資源管理器啟動(dòng)。


查看完整回答
反對 回復(fù) 2019-10-29
  • 3 回答
  • 0 關(guān)注
  • 982 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)