﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Timothy&#039;s Space &#187; Process</title>
	<atom:link href="http://www.xiaozhou.net/tag/process/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xiaozhou.net</link>
	<description>君看一叶舟，出没风波里</description>
	<lastBuildDate>Tue, 07 Feb 2012 04:28:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>一份进程注入的代码</title>
		<link>http://www.xiaozhou.net/vcdevelopment/a-code-injection-process-2004-10-22.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/a-code-injection-process-2004-10-22.htm#comments</comments>
		<pubDate>Fri, 22 Oct 2004 05:29:18 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[注入]]></category>
		<category><![CDATA[进程]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=34</guid>
		<description><![CDATA[// Injection.cpp : 定义控制台应用程序的入口点。 // #include &#8220;stdafx.h&#8221; #include &#8220;Injection.h&#8221; #ifdef _DEBUG #define new DEBUG_NEW #endif // 唯一的应用程序对象 CWinApp theApp; using namespace std; typedef struct _RemotePara{//参数结构 char pMessageBox[12]; DWORD dwMessageBox; }RemotePara; //远程线程 DWORD __stdcall ThreadProc (RemotePara *lpPara){ typedef int (__stdcall *MMessageBoxA)(HWND,LPCTSTR,LPCTSTR,DWORD);//定义MessageBox函数 MMessageBoxA myMessageBoxA; myMessageBoxA =(MMessageBoxA) lpPara->dwMessageBox ;//得到函数入口地址 myMessageBoxA(NULL,lpPara->pMessageBox ,lpPara->pMessageBox,0);//call return 0; } void EnableDebugPriv();//提升应用级调试权限 int _tmain(int [...]]]></description>
			<content:encoded><![CDATA[<p>// Injection.cpp : 定义控制台应用程序的入口点。<br />
//</p>
<p>#include &#8220;stdafx.h&#8221;<br />
#include &#8220;Injection.h&#8221;<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#endif</p>
<p>// 唯一的应用程序对象</p>
<p>CWinApp theApp;</p>
<p>using namespace std;</p>
<p>typedef struct _RemotePara{//参数结构<br />
   char pMessageBox[12];<br />
   DWORD dwMessageBox;<br />
}RemotePara;<br />
//远程线程<br />
DWORD __stdcall ThreadProc (RemotePara *lpPara){<br />
   typedef int (__stdcall *MMessageBoxA)(HWND,LPCTSTR,LPCTSTR,DWORD);//定义MessageBox函数<br />
   MMessageBoxA myMessageBoxA;<br />
   myMessageBoxA =(MMessageBoxA) lpPara->dwMessageBox ;//得到函数入口地址<br />
   myMessageBoxA(NULL,lpPara->pMessageBox ,lpPara->pMessageBox,0);//call<br />
   return 0;<br />
}<br />
void EnableDebugPriv();//提升应用级调试权限</p>
<p>int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])<br />
{<br />
    const DWORD THREADSIZE=1024*4;<br />
   DWORD byte_write;<br />
   EnableDebugPriv();//提升权限<br />
   HANDLE hWnd = ::OpenProcess (PROCESS_ALL_ACCESS,FALSE,760);<br />
   if(!hWnd)return 0;<br />
   void *pRemoteThread =::VirtualAllocEx(hWnd,0,THREADSIZE,MEM_COMMIT| MEM_RESERVE,PAGE_EXECUTE_READWRITE);<br />
   if(!pRemoteThread)return 0;<br />
   if(!::WriteProcessMemory(hWnd,pRemoteThread,&#038;ThreadProc,THREADSIZE,0))<br />
   return 0;</p>
<p>   //再付值<br />
   RemotePara myRemotePara;<br />
   ::ZeroMemory(&#038;myRemotePara,sizeof(RemotePara));<br />
   HINSTANCE hUser32 = ::LoadLibrary (&#8220;user32.dll&#8221;);<br />
   myRemotePara.dwMessageBox =(DWORD) ::GetProcAddress (hUser32 , &#8220;MessageBoxA&#8221;);<br />
   strcat(myRemotePara.pMessageBox,&#8221;hello\0&#8243;);<br />
   //写进目标进程<br />
   RemotePara *pRemotePara =(RemotePara *) ::VirtualAllocEx (hWnd ,0,sizeof(RemotePara),MEM_COMMIT,PAGE_READWRITE);//注意申请空间时的页面属性<br />
   if(!pRemotePara)return 0;<br />
   if(!::WriteProcessMemory (hWnd ,pRemotePara,&#038;myRemotePara,sizeof myRemotePara,0))return 0;</p>
<p>   //启动线程<br />
   HANDLE hThread = ::CreateRemoteThread (hWnd ,0,0,(DWORD (__stdcall *)(void *))pRemoteThread ,pRemotePara,0,&#038;byte_write);<br />
   if(!hThread){<br />
      return 0;<br />
   }<br />
	return 0;<br />
}</p>
<p>void EnableDebugPriv( void )<br />
{<br />
HANDLE hToken;<br />
LUID sedebugnameValue;<br />
TOKEN_PRIVILEGES tkp;</p>
<p>if ( ! OpenProcessToken( GetCurrentProcess(),<br />
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &#038;hToken ) )<br />
return;<br />
if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &#038;sedebugnameValue ) ){<br />
CloseHandle( hToken );<br />
return;<br />
}<br />
tkp.PrivilegeCount = 1;<br />
tkp.Privileges[0].Luid = sedebugnameValue;<br />
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;<br />
if ( ! AdjustTokenPrivileges( hToken, FALSE, &#038;tkp, sizeof tkp, NULL, NULL ) )<br />
CloseHandle( hToken );<br />
}</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/a-code-injection-process-2004-10-22.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>调整当前进程权限并关机</title>
		<link>http://www.xiaozhou.net/vcdevelopment/to-adjust-the-current-process-permissions-and-shutdown-2004-10-21.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/to-adjust-the-current-process-permissions-and-shutdown-2004-10-21.htm#comments</comments>
		<pubDate>Thu, 21 Oct 2004 14:11:51 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[adjust]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Shutdown]]></category>
		<category><![CDATA[关机]]></category>
		<category><![CDATA[权限]]></category>
		<category><![CDATA[调整]]></category>
		<category><![CDATA[进程]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=33</guid>
		<description><![CDATA[核心代码片断： if (!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES &#124; TOKEN_QUERY, &#038;hToken)) { MessageBox(&#8220;OpenProcessToken failed!&#8221;); } LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,&#038;tkp.Privileges[0].Luid); //获得本地机唯一的标识 tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &#038;tkp, 0,(PTOKEN_PRIVILEGES) NULL, 0); //调整获得的权限 if (GetLastError() != ERROR_SUCCESS) { MessageBox(&#8220;切换系统级权限失败!&#8221;); } fResult =InitiateSystemShutdown( NULL, // 要关的计算机用户名 &#8220;关机时间已到，WINDOWS将在上面的时间内关机，请做好保存工作!&#8221;, // 显示的消息 10, // 关机所需的时间 TRUE, // ask user to close apps FALSE); //设为TRUE为重起，设为FALSE为关机 if(!fResult) { [...]]]></description>
			<content:encoded><![CDATA[<p>核心代码片断：</p>
<p>if (!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &#038;hToken))<br />
		{<br />
		    MessageBox(&#8220;OpenProcessToken failed!&#8221;);<br />
		}</p>
<p>	    LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,&#038;tkp.Privileges[0].Luid); //获得本地机唯一的标识<br />
	    tkp.PrivilegeCount = 1;<br />
	    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;<br />
        AdjustTokenPrivileges(hToken, FALSE, &#038;tkp, 0,(PTOKEN_PRIVILEGES) NULL, 0); //调整获得的权限</p>
<p>	    if (GetLastError() != ERROR_SUCCESS)<br />
		{<br />
            MessageBox(&#8220;切换系统级权限失败!&#8221;);<br />
		}</p>
<p>	    fResult =InitiateSystemShutdown(<br />
             NULL,                                  // 要关的计算机用户名<br />
             &#8220;关机时间已到，WINDOWS将在上面的时间内关机，请做好保存工作!&#8221;,  // 显示的消息<br />
             10,                                    // 关机所需的时间<br />
             TRUE,                                 // ask user to close apps<br />
             FALSE);                               //设为TRUE为重起，设为FALSE为关机<br />
	    if(!fResult)<br />
		{<br />
             MessageBox(&#8220;初始化系统关机失败！&#8221;);<br />
		}</p>
<p>	    tkp.Privileges[0].Attributes = 0;<br />
        AdjustTokenPrivileges(hToken, FALSE, &#038;tkp, 0,(PTOKEN_PRIVILEGES) NULL, 0);</p>
<p>	    if (GetLastError() != ERROR_SUCCESS)<br />
		{<br />
             MessageBox(&#8220;AdjustTokenPrivileges disable failed.&#8221;);<br />
		}</p>
<p>	    ExitWindowsEx(EWX_SHUTDOWN,0);</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/to-adjust-the-current-process-permissions-and-shutdown-2004-10-21.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>调整本进程权限核心代码</title>
		<link>http://www.xiaozhou.net/vcdevelopment/adjust-the-process-the-core-code-access-2004-10-10.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/adjust-the-process-the-core-code-access-2004-10-10.htm#comments</comments>
		<pubDate>Sun, 10 Oct 2004 14:42:49 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[adjust]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[权限]]></category>
		<category><![CDATA[核心代码]]></category>
		<category><![CDATA[调整]]></category>
		<category><![CDATA[进程]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=28</guid>
		<description><![CDATA[void EnablePrivilege() { HANDLE hProcess; HANDLE hCurrentProcess; HANDLE hProcessToken; TOKEN_PRIVILEGES tp; LUID luid; hCurrentProcess=GetCurrentProcess(); OpenProcessToken(hCurrentProcess,TOKEN_ALL_ACCESS,&#038;hProcessToken); LookupPrivilegeValue(NULL,&#8221;SeDebugPrivilege&#8221;,&#038;luid); tp.PrivilegeCount=1; tp.Privileges[0].Luid=luid; tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges( hProcessToken, FALSE, &#038;tp, sizeof(TOKEN_PRIVILEGES), (PTOKEN_PRIVILEGES)NULL, (PDWORD)NULL); } 声明: 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 本站文章均采用 知识共享署名-相同方式共享3.0 协议进行授权，除非注明，本站文章均为原创，转载请注明转自 Timothy&#039;s Space 并应以链接形式标明本文地址!]]></description>
			<content:encoded><![CDATA[<p>void EnablePrivilege()<br />
{<br />
	HANDLE hProcess;<br />
	HANDLE hCurrentProcess;<br />
	HANDLE hProcessToken;<br />
	TOKEN_PRIVILEGES tp;<br />
	LUID luid;<br />
	hCurrentProcess=GetCurrentProcess();<br />
	OpenProcessToken(hCurrentProcess,TOKEN_ALL_ACCESS,&#038;hProcessToken);<br />
	LookupPrivilegeValue(NULL,&#8221;SeDebugPrivilege&#8221;,&#038;luid);<br />
	tp.PrivilegeCount=1;<br />
	tp.Privileges[0].Luid=luid;<br />
	tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;<br />
	AdjustTokenPrivileges(<br />
		hProcessToken,<br />
		FALSE,<br />
		&#038;tp,<br />
		sizeof(TOKEN_PRIVILEGES),<br />
		(PTOKEN_PRIVILEGES)NULL,<br />
		(PDWORD)NULL);<br />
}</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/adjust-the-process-the-core-code-access-2004-10-10.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>枚举系统进程核心代码</title>
		<link>http://www.xiaozhou.net/vcdevelopment/enumerate-the-system-processes-the-core-code-2004-10-10.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/enumerate-the-system-processes-the-core-code-2004-10-10.htm#comments</comments>
		<pubDate>Sun, 10 Oct 2004 14:41:05 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[枚举]]></category>
		<category><![CDATA[核心代码]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[进程]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=27</guid>
		<description><![CDATA[包含头文件： #include &#8220;tlhelp32.h&#8221; 示例： void CTerminateProcessDlg::OnGetProcess() { m_ListBox.ResetContent(); CString m_output; HANDLE hProcessSnap=NULL; PROCESSENTRY32 pe32={0}; hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); if(hProcessSnap==(HANDLE)-1) { ::MessageBox(NULL,&#8221;查询进程失败！:(&#8220;,&#8221;错误提示&#8221;,MB_OK); } pe32.dwSize=sizeof(PROCESSENTRY32); if(Process32First(hProcessSnap,&#038;pe32)) { do { m_output.Format(&#8220;%-20s ID:%-5d&#8221;,pe32.szExeFile,pe32.th32ProcessID); m_ListBox.AddString(m_output); } while(Process32Next(hProcessSnap,&#038;pe32)); } else { ::MessageBox(NULL,&#8221;出现意外错误！&#8221;,&#8221;错误提示&#8221;,MB_OK); } CloseHandle(hProcessSnap); } 声明: 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 本站文章均采用 知识共享署名-相同方式共享3.0 协议进行授权，除非注明，本站文章均为原创，转载请注明转自 Timothy&#039;s Space 并应以链接形式标明本文地址!]]></description>
			<content:encoded><![CDATA[<p>包含头文件：<br />
#include &#8220;tlhelp32.h&#8221;<br />
示例：</p>
<p>void CTerminateProcessDlg::OnGetProcess()<br />
{<br />
	m_ListBox.ResetContent();<br />
	CString m_output;<br />
	HANDLE hProcessSnap=NULL;<br />
	PROCESSENTRY32 pe32={0};<br />
	hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br />
	if(hProcessSnap==(HANDLE)-1)<br />
	{<br />
		::MessageBox(NULL,&#8221;查询进程失败！:(&#8220;,&#8221;错误提示&#8221;,MB_OK);</p>
<p>	}<br />
	pe32.dwSize=sizeof(PROCESSENTRY32);<br />
	if(Process32First(hProcessSnap,&#038;pe32))<br />
	{<br />
		do<br />
		{<br />
			m_output.Format(&#8220;%-20s     ID:%-5d&#8221;,pe32.szExeFile,pe32.th32ProcessID);<br />
			m_ListBox.AddString(m_output);<br />
		}<br />
		while(Process32Next(hProcessSnap,&#038;pe32));<br />
	}<br />
	else<br />
	{<br />
		::MessageBox(NULL,&#8221;出现意外错误！&#8221;,&#8221;错误提示&#8221;,MB_OK);<br />
	}<br />
	CloseHandle(hProcessSnap);</p>
<p>}</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/enumerate-the-system-processes-the-core-code-2004-10-10.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>进程杀手v1.0</title>
		<link>http://www.xiaozhou.net/myworks/process-killer-v1-0-2004-09-07.htm</link>
		<comments>http://www.xiaozhou.net/myworks/process-killer-v1-0-2004-09-07.htm#comments</comments>
		<pubDate>Tue, 07 Sep 2004 07:34:34 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[我的拙作]]></category>
		<category><![CDATA[Killer]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[杀手]]></category>
		<category><![CDATA[进程]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=19</guid>
		<description><![CDATA[这是一个能枚举当前系统进程，并且终止进程的小程序。 程序界面如下： 程序源代码下载： 点击下载此文件 声明: 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 本站文章均采用 知识共享署名-相同方式共享3.0 协议进行授权，除非注明，本站文章均为原创，转载请注明转自 Timothy&#039;s Space 并应以链接形式标明本文地址!]]></description>
			<content:encoded><![CDATA[<p>这是一个能枚举当前系统进程，并且终止进程的小程序。<br />
程序界面如下：</p>
<p><img src="/pics/killer.jpg" border="0" alt=""/></p>
<p>程序源代码下载：</p>
<p><a href="/attachments/month_0409/sphv_TerminateProcess.rar" target="_blank">点击下载此文件</a></p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/myworks/process-killer-v1-0-2004-09-07.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

