亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lion-tutorial21.htm

?? 內(nèi)有一些代碼
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<html>

<head>
<link rel="stylesheet" href="../../asm.css">

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Iczelion's win32 asm tutorial</title>
</head>

<body bgcolor="#FFFFFF" background="../../images/back01.jpg">
<p align="center">Tutorial 21: Pipe</p>
<hr size="1">
<strong> </strong> In this tutorial, we will explore pipe, what it is and what 
we can use it for. To make it more interesting, I throw in the technique on how 
to change the background and text color of an edit control. <br>
Download the example <a href="files/tut21.zip" style="text-decoration:none">here</a>. 
<h3> Theory:</h3>
Pipe is a communication conduit or pathway with two ends. You can use pipe to 
exchange the data between two different processes, or within the same process. 
It's like a walkie-talkie. You give the other party one set and he can use it 
to communicate with you. <br>
There are two types of pipes: anonymous and named pipes. Anonymous pipe is, well, 
anonymous: that is, you can use it without knowing its name. A named pipe is the 
opposite: you have to know its name before you can use it. <br>
You can also categorize pipes according to its property: one-way or two-way. In 
a one-way pipe, the data can flow only in one direction: from one end to the other. 
While in a two-way pipe, the data can be exchanged between both ends. <br>
An anonymous pipe is always one-way while a named pipe can be one-way or two-way. 
A named pipe is usually used in a network environment where a server can connect 
to several clients. <br>
In this tutorial, we will examine anonymous pipe in some detail. Anonymous pipe's 
main purpose is to be used as a communcation pathway between a parent and child 
processes or between child processes. <br>
Anonymous pipe is really useful when you deal with a console application. A console 
application is a kind of win32 program which uses a console for its input &amp; 
output. A console is like a DOS box. However, a console application is a fully 
32-bit program. It can use any GUI function, the same as other GUI programs. It 
just happens to have a console for its use. <br>
A console application has three handles it can use for its input &amp; output. 
They are called standard handles. There are three of them: standard input, standard 
output and standard error. Standard input handle is used to read/retrieve the 
information from the console and standard output handle is used to output/print 
the information to the console. Standard error handle is used to report error 
condition since its output cannot be redirected. <br>
A console application can retrieve those three standard handles by calling GetStdHandle 
function, specifying the handle it wants to obtain. A GUI application doesn't 
have a console. If you call GetStdHandle, it will return error. If you really 
want to use a console, you can call AllocConsole to allocate a new console. However, 
don't forget to call FreeConsole when you're done with the console. <br>
Anonymous pipe is most frequently used to redirect input and/or output of a child 
console application. The parent process may be a console or a GUI application 
but the child must be a console app. for this to work. As you know, a console 
application uses standard handles for its input and output. If we want to redirect 
the input and/or output of a console application, we can replace the handle with 
a handle to one end of a pipe. A console application will not know that it's using 
a handle to one end of a pipe. It'll use it as a standard handle. This is a kind 
of polymorphism, in OOP jargon. This approach is powerful since we need not modify 
the child process in anyway. <br>
Another thing you should know about a console application is where it gets those 
standard handles from. When a console application is created, the parent process 
has two choices: it can create a new console for the child or it can let the child 
inherit its own console. For the second approach to work, the parent process must 
be a console application or if it's a GUI application, it must call AllocConsole 
first to allocate a console. <br>
Let's begin the work. In order to create an anonymous pipe you need to call CreatePipe. 
CreatePipe has the following prototype: 
<blockquote><b>CreatePipe proto pReadHandle:DWORD, \</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pWriteHandle:DWORD,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pPipeAttributes:DWORD,\</b> <br>
  <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nBufferSize:DWORD</b></blockquote>
<ul>
  <li> pReadHandle is a pointer to a dword variable that will receive the handle 
    to the read end of the pipe</li>
  <li> pWriteHandle is a pointer to a dword variable that will receive the handle 
    to the write end of the pipe.</li>
  <li> pPipeAttributes points to a SECURITY_ATTRIBUTES structure that determines 
    whether the returned read &amp; write handles are inheritable by child processes</li>
  <li> nBufferSize is the suggested size of the buffer the pipe will reserve for 
    use. This is a suggested size only. You can use NULL to tell the function 
    to use the default size.</li>
</ul>
If the call is successful, the return value is nonzero. If it failed, the return 
value is zero. <br>
After the call is successful, you will get two handles, one to read end of the 
pipe and the other to the write end. Now I will outline the steps needed for redirecting 
the standard output of a child console program to your own process.Note that my 
method differs from the one in Borland's win32 api reference. The method in win32 
api reference assumes the parent process is a console application and thus the 
child can inherit the standard handles from it. But most of the time, we will 
need to redirect output from a console application to a GUI one. 
<ol>
  <li> Create an anonymous pipe with CreatePipe. Don't forget to set the bInheritable 
    member of SECURITY_ATTRIBUTES to TRUE so the handles are inheritable.</li>
  <li> Now we must prepare the parameters we will pass to CreateProcess since 
    we will use it to load the child console application. One important structure 
    is the STARTUPINFO structure. This structure determines the appearance of 
    the main window of the child process when it first appears. This structure 
    is vital to our purpose. You can hide the main window and pass the pipe handle 
    to the child console process with it. Below is the members you must fill:</li>
  <ul>
    <li> cb : the size of STARTUPINFO structure</li>
    <li> dwFlags : the binary bit flags that determine which members of the structure 
      are valid also it governs the show/hide state of the main window. For our 
      purpose, you should use a combination of STARTF_USESHOWWINDOW and STARTF_USESTDHANDLES</li>
    <li> hStdOutput and hStdError : the handles you want the child process to 
      use as standard output/error handles. For our purpose, we will pass write 
      handle of the pipe as the standard output and error of the child. So when 
      the child outputs something to the standard output/error, it actually passes 
      the info via the pipe to the parent process.</li>
    <li> wShowWindow governs the show/hide state of the main window. For our purpose, 
      we don't want the console window of the child to show so we put SW_HIDE 
      into this member.</li>
  </ul>
  <li> Call CreateProcess to load the child application. After CreateProcess is 
    successful, the child is still dormant. It is loaded into memory but it doesn't 
    run immediately</li>
  <li> Close the write pipe handle. This is necessary. Because the parent process 
    has no use for the write pipe handle, and the pipe won't work if there are 
    more than one write end, we MUST close it before reading the data from the 
    pipe. However, don't close the write handle before calling CreateProcess, 
    your pipe will be broken. You should close it just after CreateProcess returns 
    and before you read data from the read end of the pipe.</li>
  <li> Now you can read data from the read end of the pipe with ReadFile. With 
    ReadFile, you kick the child process into running mode. It will start execution 
    and when it writes something to the standard output handle (which is actually 
    the handle to the write end of the pipe), the data are sent through the pipe 
    to the read end. You can think of ReadFile as sucking data from the read end 
    of the pipe. You must call ReadFile repeatedly until it returns 0 which means 
    there are no more data to be read. You can do anything with the data you read 
    from the pipe. In our example, I put them into an edit control.</li>
  <li> Close the read pipe handle.</li>
</ol>
<h3> Example:</h3>
<blockquote><b>.386</b> <br>
  <b>.model flat,stdcall</b> <br>
  <b>option casemap:none</b> <br>
  <b>include \masm32\include\windows.inc</b> <br>
  <b>include \masm32\include\user32.inc</b> <br>
  <b>include \masm32\include\kernel32.inc</b> <br>
  <b>include \masm32\include\gdi32.inc</b> <br>
  <b>includelib \masm32\lib\gdi32.lib</b> <br>
  <b>includelib \masm32\lib\user32.lib</b> <br>
  <b>includelib \masm32\lib\kernel32.lib</b> 
  <p><b>WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD</b> 
  <p><b>.const</b> <br>
    <b>IDR_MAINMENU equ 101&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; 
    the ID of the main menu</b> <br>
    <b>IDM_ASSEMBLE equ 40001</b> 
  <p><b>.data</b> <br>
    <b>ClassName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    db "PipeWinClass",0</b> <br>
    <b>AppName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    db "One-way Pipe Example",0 EditClass db "EDIT",0</b> <br>
    <b>CreatePipeError&nbsp;&nbsp;&nbsp;&nbsp; db "Error during pipe creation",0</b> 
    <br>
    <b>CreateProcessError&nbsp;&nbsp;&nbsp;&nbsp; db "Error during process creation",0</b> 
    <br>
    <b>CommandLine&nbsp;&nbsp;&nbsp;&nbsp; db "ml /c /coff /Cp test.asm",0</b> 
  <p><b>.data?</b> <br>
    <b>hInstance HINSTANCE ?</b> <br>
    <b>hwndEdit dd ?</b> 
  <p><b>.code</b> <br>
    <b>start:</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke GetModuleHandle, NULL</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov hInstance,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT</b> 
    <br>
    <b>&nbsp;&nbsp;&nbsp; invoke ExitProcess,eax</b> 
  <p><b>WinMain proc hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,CmdShow:DWORD</b> 
    <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL wc:WNDCLASSEX</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL msg:MSG</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL hwnd:HWND</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.cbSize,SIZEOF WNDCLASSEX</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc, 
    OFFSET WndProc</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.cbClsExtra,NULL</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.cbWndExtra,NULL</b> <br>
    <b>&nbsp;&nbsp;&nbsp; push hInst</b> <br>
    <b>&nbsp;&nbsp;&nbsp; pop wc.hInstance</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.hbrBackground,COLOR_APPWORKSPACE</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.lpszMenuName,IDR_MAINMENU</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.lpszClassName,OFFSET ClassName</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke LoadIcon,NULL,IDI_APPLICATION</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.hIcon,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.hIconSm,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke LoadCursor,NULL,IDC_ARROW</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov wc.hCursor,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke RegisterClassEx, addr wc</b> <br>
    <b>&nbsp;&nbsp;&nbsp; invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR 
    AppName,\ WS_OVERLAPPEDWINDOW+WS_VISIBLE,CW_USEDEFAULT,\ CW_USEDEFAULT,400,200,NULL,NULL,\ 
    hInst,NULL</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov hwnd,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; .while TRUE</b> <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke GetMessage, ADDR msg,NULL,0,0</b> 
    <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .BREAK .IF (!eax)</b> <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke TranslateMessage, ADDR 
    msg</b> <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke DispatchMessage, ADDR 
    msg</b> <br>
    <b>&nbsp;&nbsp;&nbsp; .endw</b> <br>
    <b>&nbsp;&nbsp;&nbsp; mov eax,msg.wParam</b> <br>
    <b>&nbsp;&nbsp;&nbsp; ret</b> <br>
    <b>WinMain endp</b> 
  <p><b>WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL rect:RECT</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL hRead:DWORD</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL hWrite:DWORD</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL startupinfo:STARTUPINFO</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL pinfo:PROCESS_INFORMATION</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL buffer[1024]:byte</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL bytesRead:DWORD</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL hdc:DWORD</b> <br>
    <b>&nbsp;&nbsp;&nbsp; LOCAL sat:SECURITY_ATTRIBUTES</b> <br>
    <b>&nbsp;&nbsp;&nbsp; .if uMsg==WM_CREATE</b> <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke CreateWindowEx,NULL,addr 
    EditClass, NULL, WS_CHILD+ WS_VISIBLE+ ES_MULTILINE+ ES_AUTOHSCROLL+ ES_AUTOVSCROLL, 
    0, 0, 0, 0, hWnd, NULL, hInstance, NULL</b> <br>
    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov hwndEdit,eax</b> <br>
    <b>&nbsp;&nbsp;&nbsp; .elseif uMsg==WM_CTLCOLOREDIT</b> <br>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
樱桃视频在线观看一区| 日韩国产一区二| 欧美一区二区精品在线| 国产成人av电影| 五月开心婷婷久久| 国产精品久久久久四虎| 717成人午夜免费福利电影| 成人激情校园春色| 精品在线你懂的| 亚洲国产成人高清精品| 亚洲欧美自拍偷拍| 久久综合五月天婷婷伊人| 欧美午夜精品久久久久久孕妇 | 日韩伦理免费电影| 久久香蕉国产线看观看99| 91精品国产乱| 欧美婷婷六月丁香综合色| 99久久精品情趣| 国产v综合v亚洲欧| 国产一区二区三区最好精华液| 亚洲国产sm捆绑调教视频| 国产精品天干天干在线综合| 精品国产免费一区二区三区香蕉| 日本一区二区三区久久久久久久久不| 91精品国产综合久久福利软件 | 精品久久一二三区| 5858s免费视频成人| 日本精品裸体写真集在线观看| 成人性视频网站| 高清国产一区二区三区| 精品在线播放免费| 激情六月婷婷久久| 激情小说欧美图片| 国内精品国产三级国产a久久| 免费国产亚洲视频| 老色鬼精品视频在线观看播放| 日本亚洲天堂网| 美女被吸乳得到大胸91| 久久99热99| 国产在线精品免费| 国产精品一区二区久久精品爱涩| 久久99精品久久久久久久久久久久| 日韩综合小视频| 免费精品视频最新在线| 久久国产精品72免费观看| 久久不见久久见免费视频1| 狠狠色丁香婷婷综合久久片| 精品一区二区三区免费视频| 狠狠色综合色综合网络| 久久99精品久久久| 国产很黄免费观看久久| 国产传媒日韩欧美成人| 成人免费视频app| 一本在线高清不卡dvd| 91久久奴性调教| 欧美美女激情18p| 日韩欧美国产麻豆| 国产免费成人在线视频| 亚洲免费av在线| 丝瓜av网站精品一区二区| 免费观看一级欧美片| 337p亚洲精品色噜噜狠狠| 91精品国产一区二区| 精品国产在天天线2019| 中文字幕精品一区二区三区精品| 国产精品国产三级国产aⅴ入口 | 九色综合狠狠综合久久| 国产精品18久久久久久久久久久久 | 久久婷婷国产综合国色天香| 国产精品天干天干在观线| 亚洲一区二区3| 美美哒免费高清在线观看视频一区二区| 国产一二精品视频| 97久久精品人人爽人人爽蜜臀| 色婷婷综合久久久| 日韩欧美成人激情| 国产精品久久福利| 日日嗨av一区二区三区四区| 高潮精品一区videoshd| 91福利国产成人精品照片| 欧美一级艳片视频免费观看| 国产欧美日韩在线视频| 亚洲夂夂婷婷色拍ww47| 另类调教123区 | 看片的网站亚洲| 97se亚洲国产综合在线| 日韩精品在线看片z| 国产精品美女视频| 日本欧美肥老太交大片| 波多野结衣亚洲| 91精品国产综合久久久久久漫画| 国产精品久久毛片| 奇米亚洲午夜久久精品| 972aa.com艺术欧美| 欧美成人a视频| 一区二区三国产精华液| 久久99精品国产.久久久久| 欧美激情综合五月色丁香小说| 亚洲亚洲精品在线观看| 国产福利一区二区三区视频| 欧美日韩精品专区| 国产精品免费久久久久| 裸体一区二区三区| 欧美亚洲国产一区在线观看网站| 国产欧美日韩不卡| 激情综合网av| 91精品国产综合久久国产大片| 在线播放91灌醉迷j高跟美女| 日本中文一区二区三区| 福利电影一区二区| 911精品国产一区二区在线| 中文字幕在线不卡视频| 精品一区免费av| 欧美一区二区三区色| 亚洲小说春色综合另类电影| av不卡免费在线观看| 久久精品亚洲乱码伦伦中文| 日本免费新一区视频| 欧洲一区在线观看| 一区二区在线看| 91丝袜美女网| 国产精品传媒视频| 成人不卡免费av| 久久久久久久免费视频了| 免费人成在线不卡| 337p亚洲精品色噜噜噜| 日韩精品一级中文字幕精品视频免费观看 | 激情伊人五月天久久综合| 欧美一区二区啪啪| 日韩精品五月天| 综合激情成人伊人| 成人看片黄a免费看在线| 国产午夜精品福利| 粉嫩aⅴ一区二区三区四区| 国产亚洲女人久久久久毛片| 国产精品一区二区男女羞羞无遮挡| 日韩精品中午字幕| 久久精品av麻豆的观看方式| 日韩一卡二卡三卡| 久久se精品一区精品二区| 日韩一级视频免费观看在线| 毛片av一区二区三区| 欧美成人精品福利| 国产盗摄一区二区| 国产精品久久久久久久久免费丝袜 | 精品国产露脸精彩对白| 精品在线一区二区三区| 337p粉嫩大胆噜噜噜噜噜91av | 亚洲婷婷综合色高清在线| 色综合天天在线| 香蕉久久夜色精品国产使用方法| 欧美精品在线观看播放| 蜜臀av性久久久久蜜臀av麻豆| 精品少妇一区二区三区免费观看| 国产风韵犹存在线视精品| 亚洲欧美区自拍先锋| 欧美日韩精品高清| 久久精工是国产品牌吗| 国产欧美一区二区三区在线老狼| 99精品视频在线播放观看| 亚洲激情中文1区| 日韩一区二区三区视频在线| 高清成人在线观看| 亚洲欧美日韩精品久久久久| 欧美日韩成人综合在线一区二区| 免费在线观看一区| 国产精品理论在线观看| 欧美午夜精品久久久| 国精产品一区一区三区mba视频 | 伦理电影国产精品| 国产精品伦一区二区三级视频| 91国偷自产一区二区开放时间 | 欧美亚洲禁片免费| 精品系列免费在线观看| 日韩一区在线播放| 欧美久久久久免费| 丁香六月久久综合狠狠色| 亚洲欧洲中文日韩久久av乱码| 欧美精品久久久久久久久老牛影院| 国产一区二区91| 亚洲国产成人91porn| 久久久久国产一区二区三区四区| 91在线高清观看| 91丨porny丨首页| 蜜臀精品一区二区三区在线观看 | 精品制服美女丁香| 亚洲精品成人少妇| 精品理论电影在线观看 | 色视频欧美一区二区三区| 毛片不卡一区二区| 亚洲六月丁香色婷婷综合久久 | 欧美一区二区三区日韩视频| 丰满放荡岳乱妇91ww| 五月婷婷激情综合| 国产精品白丝在线| 26uuu精品一区二区| 欧美性生活大片视频| 丁香激情综合国产| 精品亚洲成a人| 日本成人在线看|