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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? server.c

?? 程序員源碼大全 程序員源碼大全 程序員源碼大全
?? C
?? 第 1 頁 / 共 2 頁
字號:
#define  STRICT
#include <windows.h>
#include "server.h"

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

                                       // clients[] is a global array of
                                       // structures used to keep track
                                       // of the multiple instances of
                                       // the server side of the named
                                       // pipe.  As a client connects
                                       // to a given instance, a new
                                       // server thread is created and
                                       // added to the array.
WRTHANDLE clients[MAX_PIPE_INSTANCES];
DWORD     clientCount = 0;             // Global count of connected clients.

HWND   hWnd;
HANDLE hInst;
CHAR   lpBuffer[255];


int APIENTRY WinMain (HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      LPSTR  lpCmdLine,
                      int    nCmdShow)


{

  MSG  msg;
  WNDCLASS wc;


  UNREFERENCED_PARAMETER( lpCmdLine );
  UNREFERENCED_PARAMETER( hPrevInstance );

  //
  // Detect platform and exit gracefully if not Windows NT.
  //

  {
    OSVERSIONINFO osvi;
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

    GetVersionEx (&osvi);
    if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) {
	  LoadString(hInst, IDS_WRONGOS, lpBuffer, sizeof(lpBuffer)); 	
      MessageBox (NULL, lpBuffer, "SERVER32", MB_OK | MB_ICONSTOP);
      return 0;
    }
  }



  hInst = hInstance;

  wc.style = 0;
  wc.lpfnWndProc = (WNDPROC)MainWndProc;
  wc.cbClsExtra = 0;
  wc.cbWndExtra = 0;
  wc.hInstance = hInstance;
  wc.hIcon = LoadIcon (hInstance, "npserver");
  wc.hCursor = LoadCursor (NULL, IDC_ARROW);
  wc.hbrBackground = GetStockObject (WHITE_BRUSH);
  wc.lpszMenuName = "PipeMenu";
  wc.lpszClassName = "PipeWClass";

  RegisterClass(&wc);

  LoadString(hInst, IDS_WINDOWTITLE, lpBuffer, sizeof(lpBuffer)); 	
  hWnd = CreateWindow ("PipeWClass",
                       lpBuffer,
                       WS_OVERLAPPEDWINDOW,
                       CW_USEDEFAULT,
                       CW_USEDEFAULT,
                       CW_USEDEFAULT,
                       CW_USEDEFAULT,
                       NULL,
                       NULL,
                       hInstance,
                       NULL);


  ShowWindow (hWnd, nCmdShow);

  while (GetMessage (&msg, NULL, 0, 0))
    DispatchMessage (&msg);

  return (msg.wParam);

}

LONG CALLBACK MainWndProc (HWND   hwnd,
                           UINT   message,
                           WPARAM wParam,
                           LPARAM lParam)
{

  LONG        lpServerThreadID;
  PAINTSTRUCT paintStruct;
  HDC         hDC;

  switch (message)
      {
        case WM_PAINT:
           // DrawBranch is used to paint the spools and text to the window.
           hDC = BeginPaint (hwnd, &paintStruct);
           DrawBranch (hDC);
           EndPaint (hwnd, &paintStruct);
           return(0);

        case WM_CREATE :
           // Create the first instance of a server side of the pipe.
           CreateThread ((LPSECURITY_ATTRIBUTES)NULL,       // No security.
                         (DWORD)0,                          // Same stack size.
                         (LPTHREAD_START_ROUTINE)ServerProc,// Thread procedure.
                         (LPVOID)&hwnd,                     // Parameter.
                         (DWORD)0,                          // Start immediatly.
                         (LPDWORD)&lpServerThreadID);       // Thread ID.
           return (0);

        case WM_DESTROY :
           PostQuitMessage (0);
           return (0);
       }
    return DefWindowProc (hwnd, message, wParam, lParam);
}



/*************************************************************************\
*
*  PROCEDURE: ServerProc (HWND *hWnd)
*
*    A thread procedure, which creates an instance of the server side of
*    the named pipe, and then blocks waiting for a client to connect.
*    Once the client connects, a global array is updated with the specific
*    clients information, and this procedure is called again
*    to launch another waiting server thread.  After launching the new
*    thread, this thread begins to loop, reading the named pipe.  When
*    a message comes from its client, it uses TellAll() to broadcast
*    the message to the other clients in the array.
*
*  CALLED BY:
*
*    ServerProc();
*    WinMain();
*
*  CALLS TO:
*
*    TellAll();
*    ServerProc().
*
*  COMMENTS:
*
*    Clients is a global array which hold information on each client
*    connected to the named pipe.  This procedure recieves a buffer.
*    It then steps through this global array, and for each client it
*    writes the buffer.
*
\*************************************************************************/

VOID ServerProc(HWND *hWnd)
 {
   HANDLE hPipe;                       // Pipe handle.
   CHAR   inBuf[IN_BUF_SIZE] = "";     // Input buffer for pipe.
   DWORD  ServerThreadID;              // Used for CreateThread().

   CHAR   errorBuf[LINE_LEN] = "";     // Used for error messages.
   DWORD  bytesRead;                   // Used in ReadFile().
   DWORD  retCode;                     // Used to trap return codes.
   DWORD  clientIndex;                 // Index into global array, for this
                                       // instances client.
   DWORD  lastError;                   // Traps returns from GetLastError().
   BOOL   ExitLoop = FALSE;            // Boolean Flag to exit loop.

   OVERLAPPED OverLapWrt;              // Overlapped structure for writing.
   HANDLE     hEventWrt;               // Event handle for overlapped write.

   OVERLAPPED OverLapRd;               // Overlapped structure for reading.
   HANDLE     hEventRd;                // Event handle for overlapped reads.
   DWORD        bytesTransRd;          // Bytes transferred by overlapped.
   PSECURITY_DESCRIPTOR    pSD;
   SECURITY_ATTRIBUTES     sa;

                                       // create a security NULL security
                                       // descriptor, one that allows anyone
                                       // to write to the pipe... WARNING
                                       // entering NULL as the last attribute
                                       // of the CreateNamedPipe() will
                                       // indicate that you wish all
                                       // clients connecting to it to have
                                       // all of the same security attributes
                                       // as the user that started the
                                       // pipe server.

   pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
               SECURITY_DESCRIPTOR_MIN_LENGTH);

   if (pSD == NULL)
     {
     MessageBox (*hWnd, "Error in LocalAlloc for pSD",
                 "Debug: ServerProc()", MB_OK);
     return;
     }

   if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
     {
     wsprintf (errorBuf, "Error: InitializeSecurityDescriptor() %d",
               GetLastError());
     MessageBox (*hWnd, errorBuf, "Debug: ServerProc()", MB_OK);
       LocalFree((HLOCAL)pSD);
       return;
     }

                                       // add a NULL disc. ACL to the
                                       // security descriptor.

   if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE))
     {
     wsprintf (errorBuf, "Error: SetSecurityDescriptorDacl() %d",
                GetLastError());
     MessageBox (*hWnd, errorBuf, "Debug: ServerProc()", MB_OK);
     LocalFree((HLOCAL)pSD);
     return;
     }

   sa.nLength = sizeof(sa);
   sa.lpSecurityDescriptor = pSD;
   sa.bInheritHandle = TRUE;

                                       // Create a local named pipe with
                                       // the name '\\.\PIPE\test'.  The
                                       // '.' signifies local pipe.
   hPipe = CreateNamedPipe ("\\\\.\\PIPE\\test", // Pipe name = 'test'.
               PIPE_ACCESS_DUPLEX                // 2 way pipe.
               | FILE_FLAG_OVERLAPPED,           // Use overlapped structure.
               PIPE_WAIT                         // Wait on messages.
               | PIPE_READMODE_MESSAGE           // Specify message mode pipe.
               | PIPE_TYPE_MESSAGE,
               MAX_PIPE_INSTANCES,               // Maximum instance limit.
               OUT_BUF_SIZE,                     // Buffer sizes.
               IN_BUF_SIZE,
               TIME_OUT,                         // Specify time out.
               &sa);                             // Security attributes.

                                       // Check Errors.
    if ((DWORD)hPipe == 0xFFFFFFFF)
     {

     retCode = GetLastError();         // Report any error, it should always succeed.
     LoadString(hInst, IDS_ERRORCODE, lpBuffer, sizeof(lpBuffer));
     wsprintf (errorBuf, lpBuffer, retCode);
     LoadString(hInst, IDS_DEBUGTITLE, lpBuffer, sizeof(lpBuffer));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜精品一区二区三区| 国产欧美日韩另类一区| 国产欧美在线观看一区| 亚洲成av人片一区二区三区| 成人福利视频网站| 精品国产凹凸成av人导航| 裸体健美xxxx欧美裸体表演| 91在线国产观看| 久久一区二区三区四区| 婷婷国产v国产偷v亚洲高清| 在线一区二区观看| 国产精品国产三级国产专播品爱网| 另类小说图片综合网| 欧美丝袜自拍制服另类| 亚洲欧洲综合另类在线| 成人黄页在线观看| 欧美国产丝袜视频| 国产一区二区导航在线播放| 91精品国产手机| 亚洲成年人影院| 欧美色综合网站| 亚洲国产精品久久久男人的天堂| 91麻豆精品在线观看| 最好看的中文字幕久久| 不卡一区二区中文字幕| 欧美国产日韩在线观看| 国产91精品久久久久久久网曝门| wwwwww.欧美系列| 精品一区二区在线观看| 欧美大度的电影原声| 蜜桃视频一区二区| 日韩欧美中文一区二区| 卡一卡二国产精品| 精品国精品自拍自在线| 国产福利精品一区二区| 国产精品大尺度| 色又黄又爽网站www久久| 亚洲人成网站精品片在线观看| 91论坛在线播放| 亚洲香蕉伊在人在线观| 欧美日韩中文字幕一区| 日产国产欧美视频一区精品 | 日韩精品电影一区亚洲| 欧美一级国产精品| 国产老女人精品毛片久久| 国产午夜精品久久| 99r国产精品| 亚洲一级二级三级在线免费观看| 欧美精三区欧美精三区| 精品一区二区成人精品| 国产精品美女久久久久aⅴ| 91免费版pro下载短视频| 亚洲国产乱码最新视频 | 欧日韩精品视频| 日本视频一区二区三区| 久久精品视频网| 91亚洲午夜精品久久久久久| 亚洲电影视频在线| 欧美va亚洲va| 色综合久久中文综合久久牛| 视频一区中文字幕| 国产欧美日韩麻豆91| 91久久线看在观草草青青| 美女在线视频一区| 成人免费一区二区三区在线观看| 欧美色成人综合| 国产一区二区三区美女| 一区二区国产视频| 久久理论电影网| 欧美无砖专区一中文字| 国产一区二区在线视频| 亚洲综合av网| 国产三级欧美三级| 欧美日韩精品电影| 成人h动漫精品| 精品一区二区三区不卡 | 久久不见久久见中文字幕免费| 国产精品理论片| 精品噜噜噜噜久久久久久久久试看| 99国产精品国产精品毛片| 黄色小说综合网站| 午夜精彩视频在线观看不卡| 国产精品欧美久久久久无广告| 日韩一区二区三| 欧美专区在线观看一区| 国产精品亚洲视频| 免费欧美高清视频| 亚洲成人自拍偷拍| 国产精品短视频| 久久―日本道色综合久久| 4hu四虎永久在线影院成人| 99在线热播精品免费| 国产米奇在线777精品观看| 天堂va蜜桃一区二区三区漫画版| 亚洲三级理论片| 国产精品色一区二区三区| 日韩欧美一级在线播放| 538在线一区二区精品国产| 欧美三级电影在线看| 99国产精品一区| 97精品久久久久中文字幕| 懂色av一区二区夜夜嗨| 国产大陆精品国产| 国产一区福利在线| 国产一区二区三区在线观看免费 | 91激情在线视频| 91一区二区在线观看| av电影在线观看不卡| 丁香五精品蜜臀久久久久99网站| 国产精华液一区二区三区| 国产乱码精品一区二区三 | 亚洲免费在线视频| 国产精品第五页| 亚洲三级免费观看| 亚洲黄一区二区三区| 亚洲精品一二三区| 亚洲一二三区在线观看| 亚洲成a人v欧美综合天堂下载 | 中文字幕中文乱码欧美一区二区| 欧美激情一区二区三区四区| 国产精品美女久久久久久久久| 国产精品国产三级国产aⅴ原创 | 国产精品影视在线观看| 国产一区二区精品在线观看| 国产一区不卡在线| 成人av资源下载| 色拍拍在线精品视频8848| 欧美日韩亚洲综合| 日韩丝袜情趣美女图片| 久久综合狠狠综合久久激情| 久久久精品蜜桃| 国产精品久99| 亚洲第一激情av| 极品美女销魂一区二区三区免费| 国产精品小仙女| 国产欧美一区二区精品秋霞影院| 中文字幕精品综合| 欧美一级一级性生活免费录像| 欧美一级一区二区| 色先锋资源久久综合| 粉嫩绯色av一区二区在线观看| 99免费精品在线| 色综合久久中文综合久久牛| 欧美一a一片一级一片| va亚洲va日韩不卡在线观看| 欧美亚洲一区二区在线| 亚洲天堂成人在线观看| 丁香一区二区三区| 久久亚洲春色中文字幕久久久| 视频在线观看一区| 欧美日韩国产高清一区| 伊人性伊人情综合网| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 一区二区三区在线观看动漫| 国产不卡一区视频| 国产农村妇女毛片精品久久麻豆 | 一区二区三区四区在线免费观看 | 午夜视频一区在线观看| 欧美综合一区二区三区| 日韩美女视频一区二区| av中文一区二区三区| 国产精品家庭影院| 波多野结衣中文字幕一区 | 日韩欧美国产午夜精品| 免费在线欧美视频| 日韩欧美一区二区在线视频| 美国一区二区三区在线播放| 91精品国产91久久综合桃花| 日韩成人一区二区三区在线观看| 欧美少妇一区二区| 日韩avvvv在线播放| 日韩欧美另类在线| 麻豆91在线播放| www国产亚洲精品久久麻豆| 国产精品456| 欧美国产一区视频在线观看| jlzzjlzz亚洲日本少妇| 亚洲男人的天堂av| 欧美日韩精品欧美日韩精品| 日韩不卡免费视频| 久久综合色之久久综合| 夫妻av一区二区| 自拍偷拍亚洲欧美日韩| 欧美视频一区二| 久久er99热精品一区二区| 国产日本欧美一区二区| a4yy欧美一区二区三区| 亚洲国产综合91精品麻豆| 日韩三级视频在线看| 激情都市一区二区| 亚洲婷婷在线视频| 欧美精品电影在线播放| 麻豆精品在线视频| 中文幕一区二区三区久久蜜桃| 色一情一乱一乱一91av| 青青草伊人久久| 国产精品电影院| 欧美一区二区三区精品| 风间由美中文字幕在线看视频国产欧美| 亚洲欧美日韩国产一区二区三区 |