亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一区二区在线观看免费视频播放| 91浏览器在线视频| 精品国产一区二区三区av性色| 亚洲观看高清完整版在线观看| 在线观看一区不卡| 亚洲一区二区三区四区五区中文 | 欧美一区二区三区小说| 肉肉av福利一精品导航| 日韩一级高清毛片| 狠狠狠色丁香婷婷综合激情| 国产日韩欧美一区二区三区乱码| 粉嫩在线一区二区三区视频| 亚洲欧美在线观看| 精品视频在线免费| 老司机午夜精品| 亚洲国产精品成人久久综合一区| 波多野结衣中文字幕一区| 亚洲一区二区三区在线| 日韩欧美一级在线播放| 国产成人精品三级| 亚洲一区二区三区四区的| 日韩欧美精品三级| 波多野结衣亚洲| 性欧美疯狂xxxxbbbb| 久久蜜桃av一区精品变态类天堂 | 91麻豆精品久久久久蜜臀| 免费精品视频在线| 国产精品理伦片| 91精品中文字幕一区二区三区| 国产一区二区三区四区五区美女| 1000部国产精品成人观看| 7777精品伊人久久久大香线蕉完整版 | 一区二区激情小说| 欧美成人精品3d动漫h| 不卡一二三区首页| 奇米精品一区二区三区四区| 国产精品二三区| 91精品国产色综合久久不卡电影 | 欧美mv日韩mv国产网站app| www.久久久久久久久| 日本vs亚洲vs韩国一区三区二区| 国产亚洲欧美一级| 欧美精品色综合| av不卡一区二区三区| 麻豆精品在线播放| 亚洲黄色尤物视频| 久久久不卡网国产精品二区| 欧美日韩国产123区| 99国产精品久久久久久久久久 | 国产suv一区二区三区88区| 偷拍自拍另类欧美| 18欧美亚洲精品| 久久伊99综合婷婷久久伊| 欧美日韩一区三区四区| 99久久精品国产网站| 国内成人精品2018免费看| 亚洲va欧美va国产va天堂影院| 亚洲国产精品国自产拍av| 精品久久久久久亚洲综合网| 欧美日韩一区二区三区四区| 91丨porny丨首页| 成人午夜碰碰视频| 国产乱码字幕精品高清av| 蜜臀va亚洲va欧美va天堂| 亚洲主播在线播放| 亚洲乱码中文字幕| 综合电影一区二区三区 | 91小视频在线观看| 岛国精品一区二区| 国产剧情一区二区| 久久se这里有精品| 美女视频黄 久久| 欧美aaa在线| 男男gaygay亚洲| 日本视频中文字幕一区二区三区| 亚洲国产aⅴ天堂久久| 亚洲国产精品久久艾草纯爱| 亚洲综合免费观看高清完整版| 亚洲欧洲日韩女同| 1区2区3区精品视频| 亚洲欧美偷拍三级| 亚洲欧美aⅴ...| 亚洲男人的天堂av| 亚洲精品国产a| 亚洲a一区二区| 午夜伦理一区二区| 日本免费在线视频不卡一不卡二| 日韩中文欧美在线| 麻豆国产精品777777在线| 久久精品av麻豆的观看方式| 狠狠久久亚洲欧美| 成人激情黄色小说| 色狠狠av一区二区三区| 欧美在线看片a免费观看| 91久久精品一区二区三| 欧美日本不卡视频| 精品国产麻豆免费人成网站| 久久久综合视频| 亚洲欧美在线另类| 五月天婷婷综合| 国产美女娇喘av呻吟久久 | 在线免费不卡视频| 欧美二区乱c少妇| 精品国产电影一区二区| 国产精品欧美综合在线| 一区二区免费看| 美女性感视频久久| 成人综合激情网| 在线观看日韩电影| 久久蜜臀精品av| 亚洲精品视频观看| 久久电影网站中文字幕| 成人黄色777网| 欧美精品三级在线观看| 久久久www免费人成精品| 亚洲专区一二三| 国产在线播放一区二区三区| 一本色道a无线码一区v| 欧美成人a∨高清免费观看| 中文字幕制服丝袜一区二区三区| 亚洲福利视频导航| 国产盗摄视频一区二区三区| 在线这里只有精品| 精品久久人人做人人爰| 亚洲一区在线电影| 国产馆精品极品| 欧美美女一区二区在线观看| 国产三区在线成人av| 亚洲高清视频的网址| 国产成人免费视频一区| 884aa四虎影成人精品一区| 国产精品看片你懂得| 日本成人在线不卡视频| 91色乱码一区二区三区| 久久久久久亚洲综合影院红桃| 亚洲国产精品久久久男人的天堂| 丁香亚洲综合激情啪啪综合| 欧美一区二区成人| 一区二区三区毛片| 国产成人综合网站| 欧美一级欧美三级在线观看| 亚洲视频中文字幕| 国产成人亚洲综合a∨婷婷图片| 欧美精品一卡二卡| 一区二区三区四区五区视频在线观看| 国产一区二区三区av电影| 欧美久久久久久久久中文字幕| 国产精品你懂的| 国产精品 欧美精品| 精品对白一区国产伦| 爽好久久久欧美精品| 欧美最新大片在线看| 亚洲视频 欧洲视频| 成人蜜臀av电影| 久久精品一区二区| 国精产品一区一区三区mba视频| 在线播放中文一区| 午夜天堂影视香蕉久久| 色94色欧美sute亚洲线路一久| 国产精品久久久久久久久久久免费看| 精品在线一区二区| 精品伦理精品一区| 精品一区二区av| 精品欧美乱码久久久久久| 蜜桃av一区二区| 日韩三级电影网址| 久久99精品久久久久婷婷| 欧美大片在线观看一区二区| 日本欧美一区二区在线观看| 制服视频三区第一页精品| 丝袜美腿成人在线| 日韩欧美一级片| 国内精品伊人久久久久av影院| 日韩欧美中文字幕公布| 久国产精品韩国三级视频| 欧美va亚洲va国产综合| 国产伦精品一区二区三区免费| 精品成人a区在线观看| 狠狠色狠狠色综合| 国产精品你懂的在线欣赏| 91小视频在线免费看| 亚洲午夜精品在线| 91精品国产综合久久小美女| 美女精品一区二区| 久久久久久久久蜜桃| 91偷拍与自偷拍精品| 一区二区在线观看视频| 欧美日韩国产bt| 国内一区二区视频| 中文字幕制服丝袜一区二区三区| 在线免费观看视频一区| 奇米影视在线99精品| 久久新电视剧免费观看| 成人18视频日本| 亚洲一区在线视频| 日韩精品一区在线观看| eeuss鲁一区二区三区| 亚洲成人你懂的| 久久亚洲欧美国产精品乐播| 91视频一区二区|