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

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

?? main.c

?? 開發板bios源碼 開發板bios源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * main.c -- Main program for the GoAhead WebServer
 *
 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved.
 *
 * See the file "license.txt" for usage and redistribution license requirements
 *
 * $Id: main.c,v 1.3 2002/07/29 15:28:33 bporter Exp $
 */

/******************************** Description *********************************/

/*
 *	Main program for the GoAhead WebServer. This is a demonstration
 *	program to initialize and configure the web server.
 */

/********************************* Includes ***********************************/

#include	<direct.h>
#include	<windows.h>
#include	<winuser.h>
#include	<process.h>

#include	"../wsIntrn.h"

#ifdef WEBS_SSL_SUPPORT
#include	"../websSSL.h"
#endif

#ifdef USER_MANAGEMENT_SUPPORT
#include	"../um.h"
void		formDefineUserMgmt(void);
#endif

/********************************** Defines ***********************************/

#define		IDM_ABOUTBOX		0xF200
#define		IDS_ABOUTBOX		"AboutBox"
#define		IDC_VERSION			101
#define		IDC_BUILDDATE		102
#define		IDC_DISMISS			103
#define		SOCK_DFT_SVC_TIME	20

/*********************************** Locals ***********************************/
/*
 *	Change configuration here
 */

static HWND		hwnd;							/* Main Window handle */
static HWND		hwndAbout;						/* About Window handle */
static char_t	*title = T("GoAhead WebServer");/* Window title */
static char_t	*name = T("gowebs");			/* Window name */
static char_t	*rootWeb = T("web");			/* Root web directory */
static char_t	*password = T("");				/* Security password */
static int		port = 80;						/* Server port */
static int		retries = 5;					/* Server port retries */
static int		finished;						/* Finished flag */
static int		sockServiceTime;				/* in milliseconds */

/****************************** Forward Declarations **************************/

static int		initWebs();
static long		CALLBACK websWindProc(HWND hwnd, unsigned int msg, 
				unsigned int wp, long lp);
static long		CALLBACK websAboutProc(HWND hwnd, unsigned int msg, 
				unsigned int wp, long lp);
static int		registerAboutBox(HINSTANCE hInstance);
static int		createAboutBox(HINSTANCE hInstance, HWND hwnd);
static int		aspTest(int eid, webs_t wp, int argc, char_t **argv);
static WPARAM	checkWindowsMsgLoop();
static void		formTest(webs_t wp, char_t *path, char_t *query);
static int		windowsInit(HINSTANCE hinstance);
static int		windowsClose(HINSTANCE hinstance);
static int		websHomePageHandler(webs_t wp, char_t *urlPrefix,
					char_t *webDir, int arg, char_t *url, char_t *path,
					char_t *query);
extern void		defaultErrorHandler(int etype, char_t *msg);
extern void		defaultTraceHandler(int level, char_t *buf);
static void		printMemStats(int handle, char_t *fmt, ...);
static void		memLeaks();

static LPWORD	lpwAlign(LPWORD);
static int		nCopyAnsiToWideChar(LPWORD, LPSTR);
static void		centerWindowOnDisplay(HWND hwndCenter);

static unsigned char	*tableToBlock(char **table);

/*********************************** Code *************************************/
/*
 *	WinMain -- entry point from Windows
 */

int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance,
						char *args, int cmd_show)
{
	WPARAM	rc;

/*
 *	Initialize the memory allocator. Allow use of malloc and start 
 *	with a 60K heap.  For each page request approx 8KB is allocated.
 *	60KB allows for several concurrent page requests.  If more space
 *	is required, malloc will be used for the overflow.
 */
	bopen(NULL, (60 * 1024), B_USE_MALLOC);

/* 
 *	Store the instance handle (used in socket.c)
 */

	if (windowsInit(hinstance) < 0) {
		return FALSE;
	}

/*
 *	Initialize the web server
 */
	if (initWebs() < 0) {
		return FALSE;
	}

#ifdef WEBS_SSL_SUPPORT
	websSSLOpen();
#endif

/*
 *	Basic event loop. SocketReady returns true when a socket is ready for
 *	service. SocketSelect will block until an event occurs. SocketProcess
 *	will actually do the servicing.
 */
	while (!finished) {
		if (socketReady(-1) || socketSelect(-1, sockServiceTime)) {
			socketProcess(-1);
		}
		emfSchedProcess();
		websCgiCleanup();
		if ((rc = checkWindowsMsgLoop()) != 0) {
			break;
		}
	}

#ifdef WEBS_SSL_SUPPORT
	websSSLClose();
#endif

/*
 *	Close the User Management database
 */
#ifdef USER_MANAGEMENT_SUPPORT
	umClose();
#endif

/*
 *	Close the socket module, report memory leaks and close the memory allocator
 */
	websCloseServer();
	socketClose();

/*
 *	Free up Windows resources
 */
	windowsClose(hinstance);

#ifdef B_STATS
	memLeaks();
#endif
	bclose();
	return rc;
}

/******************************************************************************/
/*
 *	Initialize the web server.
 */

static int initWebs()
{
	struct hostent	*hp;
	struct in_addr	intaddr;
	char			*cp;
	char			host[64], dir[128];
	char_t			dir_t[128];
	char_t			wbuf[256];

/*
 *	Initialize the socket subsystem
 */
	socketOpen();

/*
 *	Initialize the User Management database
 */
#ifdef USER_MANAGEMENT_SUPPORT
	umOpen();
	umRestore(T("umconfig.txt"));
#endif

/*
 *	Define the local Ip address, host name, default home page and the 
 *	root web directory.
 */
	if (gethostname(host, sizeof(host)) < 0) {
		error(E_L, E_LOG, T("Can't get hostname"));
		return -1;
	}
	if ((hp = gethostbyname(host)) == NULL) {
		error(E_L, E_LOG, T("Can't get host address"));
		return -1;
	}
	memcpy((void *) &intaddr, (void *) hp->h_addr_list[0],
		(size_t) hp->h_length);

/*
 *	Set ../web as the root web. Modify this to suit your needs
 */
	getcwd(dir, sizeof(dir)); 
	for (cp = dir; *cp; cp++) {
		if (*cp == '\\')
			*cp = '/';
	}
	if (cp = strrchr(dir, '/')) {
		*cp = '\0';
	}
	ascToUni(dir_t, dir, sizeof(dir_t));
	gsprintf(wbuf, T("%s/%s"), dir_t, rootWeb);
	websSetDefaultDir(wbuf);
	cp = inet_ntoa(intaddr);
	ascToUni(wbuf, cp, min(strlen(cp) + 1, sizeof(wbuf)));
	websSetIpaddr(wbuf);
	ascToUni(wbuf, hp->h_name, min(strlen(hp->h_name) + 1, sizeof(wbuf)));
	websSetHost(wbuf);

/*
 *	Configure the web server options before opening the web server
 */
	websSetDefaultPage(T("default.asp"));
	websSetPassword(password);

/* 
 *	Open the web server on the given port. If that port is taken, try
 *	the next sequential port for up to "retries" attempts.
 */
	websOpenServer(port, retries);

/*
 * 	First create the URL handlers. Note: handlers are called in sorted order
 *	with the longest path handler examined first. Here we define the security 
 *	handler, forms handler and the default web page handler.
 */
	websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler, 
		WEBS_HANDLER_FIRST);
	websUrlHandlerDefine(T("/goform"), NULL, 0, websFormHandler, 0);
	websUrlHandlerDefine(T("/cgi-bin"), NULL, 0, websCgiHandler, 0);
	websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler, 
		WEBS_HANDLER_LAST); 

/*
 *	Now define two test procedures. Replace these with your application
 *	relevant ASP script procedures and form functions.
 */
	websAspDefine(T("aspTest"), aspTest);
	websFormDefine(T("formTest"), formTest);
/*
 *	Create the Form handlers for the User Management pages
 */
#ifdef USER_MANAGEMENT_SUPPORT
	formDefineUserMgmt();
#endif

/*
 *	Create a handler for the default home page
 */
	websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0); 

/* 
 *	Set the socket service timeout to the default
 */
	sockServiceTime = SOCK_DFT_SVC_TIME;				

	return 0;
}


/******************************************************************************/
/*
 *	Create a taskbar entry. Register the window class and create a window
 */

static int windowsInit(HINSTANCE hinstance)
{
	WNDCLASS  		wc;						/* Window class */
	HMENU			hSysMenu;

	emfInstSet((int) hinstance);

	wc.style		 = CS_HREDRAW | CS_VREDRAW;
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	wc.cbClsExtra	 = 0;
	wc.cbWndExtra	 = 0;
	wc.hInstance	 = hinstance;
	wc.hIcon		 = NULL;
	wc.lpfnWndProc	 = (WNDPROC) websWindProc;
	wc.lpszMenuName	 = wc.lpszClassName = name;
	if (! RegisterClass(&wc)) {
		return -1;
	}

/*
 *	Create a window just so we can have a taskbar to close this web server
 */
	hwnd = CreateWindow(name, title, WS_MINIMIZE | WS_POPUPWINDOW,
		CW_USEDEFAULT, 0, 0, 0, NULL, NULL, hinstance, NULL);
	if (hwnd == NULL) {
		return -1;
	}

/*
 *	Add the about box menu item to the system menu
 *	a_assert: IDM_ABOUTBOX must be in the system command range.
 */
	hSysMenu = GetSystemMenu(hwnd, FALSE);
	if (hSysMenu != NULL)
	{
		AppendMenu(hSysMenu, MF_SEPARATOR, 0, NULL);
		AppendMenu(hSysMenu, MF_STRING, IDM_ABOUTBOX, T("About WebServer"));
	}

	ShowWindow(hwnd, SW_SHOWNORMAL);
	UpdateWindow(hwnd);

	hwndAbout = NULL;
	return 0;
}

/******************************************************************************/
/*
 *	Close windows resources
 */

static int windowsClose(HINSTANCE hInstance)
{
	int nReturn;

	nReturn = UnregisterClass(name, hInstance);

	if (hwndAbout) {
		DestroyWindow(hwndAbout);
	}

	return nReturn;
}

/******************************************************************************/
/*
 *	Main menu window message handler.
 */

static long CALLBACK websWindProc(HWND hwnd, unsigned int msg, 
									unsigned int wp, long lp)
{
	switch (msg) {
		case WM_DESTROY:
			PostQuitMessage(0);
			finished++;
			return 0;

		case WM_SYSCOMMAND:
			if (wp == IDM_ABOUTBOX) {
				if (!hwndAbout) {
					createAboutBox((HINSTANCE) emfInstGet(), hwnd);
				}
				if (hwndAbout) {
					ShowWindow(hwndAbout, SW_SHOWNORMAL);
				}
			}
			break;
	}

	return DefWindowProc(hwnd, msg, wp, lp);
}

/******************************************************************************/
/*
 *	Check for Windows Messages
 */

WPARAM checkWindowsMsgLoop()
{
	MSG		msg;					/* Message block */

	if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
		if (!GetMessage(&msg, NULL, 0, 0) || msg.message == WM_QUIT) {
			return msg.wParam;
		}

		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return 0;
}

/******************************************************************************/
/*
 *	Windows message handler for the About Box
 */

static long CALLBACK websAboutProc(HWND hwndDlg, unsigned int msg, 
									unsigned int wp, long lp)
{
	long lResult;
	HWND hwnd;

	lResult = DefWindowProc(hwndDlg, msg, wp, lp);

	switch (msg) {
		case WM_CREATE:
			hwndAbout = hwndDlg;
			break;

		case WM_DESTROY:
			hwndAbout = NULL;
			break;

		case WM_COMMAND:
			if (wp == IDOK) {
				EndDialog(hwndDlg, 0);
				PostMessage(hwndDlg, WM_CLOSE, 0, 0);
			}
			break;

		case WM_INITDIALOG:
/*
 *			Set the version and build date values
 */
			hwnd = GetDlgItem(hwndDlg, IDC_VERSION);
			if (hwnd) {
				SetWindowText(hwnd, WEBS_VERSION);
			}

			hwnd = GetDlgItem(hwndDlg, IDC_BUILDDATE);
			if (hwnd) {
				SetWindowText(hwnd, __DATE__);
			}

			SetWindowText(hwndDlg, T("GoAhead WebServer"));
			centerWindowOnDisplay(hwndDlg);

			hwndAbout = hwndDlg;

			lResult = FALSE;
			break;
	}

	return lResult;
}

/******************************************************************************/
/*
 *	Registers the About Box class
 */

static int registerAboutBox(HINSTANCE hInstance)
{
	WNDCLASS  wc;

    wc.style = 0;
    wc.lpfnWndProc = (WNDPROC)websAboutProc;

    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = GetStockObject(LTGRAY_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = IDS_ABOUTBOX;

    if (!RegisterClass(&wc)) {
		return 0;
	}

 	return 1;
}

/******************************************************************************/
/*
 *   Helper routine.  Take an input pointer, return closest
 *    pointer that is aligned on a DWORD (4 byte) boundary.
 */

static LPWORD lpwAlign(LPWORD lpIn)
{
	ULONG ul;

	ul = (ULONG) lpIn;
	ul +=3;
	ul >>=2;
	ul <<=2;
	return (LPWORD) ul;
}

/******************************************************************************/
/*
 *   Helper routine.  Takes second parameter as Ansi string, copies
 *    it to first parameter as wide character (16-bits / char) string,
 *    and returns integer number of wide characters (words) in string
 *    (including the trailing wide char NULL).
 */

static int nCopyAnsiToWideChar(LPWORD lpWCStr, LPSTR lpAnsiIn)
{
	int cchAnsi = lstrlen(lpAnsiIn);

	return MultiByteToWideChar(GetACP(), 
		MB_PRECOMPOSED, lpAnsiIn, cchAnsi, lpWCStr, cchAnsi) + 1;
}

/******************************************************************************/
/*
 *	Creates an About Box Window
 */

static int createAboutBox(HINSTANCE hInstance, HWND hwnd)
{
	WORD	*p, *pdlgtemplate;
	int		nchar;
	DWORD	lStyle;
	HWND	hwndReturn;

/* 
 *	Allocate some memory to play with  
 */
	pdlgtemplate = p = (PWORD) LocalAlloc(LPTR, 1000);

/*
 *	Start to fill in the dlgtemplate information.  addressing by WORDs 
 */

	lStyle = WS_DLGFRAME | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | DS_SETFONT;
	*p++ = LOWORD(lStyle);
	*p++ = HIWORD(lStyle);
	*p++ = 0;          /* LOWORD (lExtendedStyle) */
	*p++ = 0;          /* HIWORD (lExtendedStyle) */
	*p++ = 7;          /* Number Of Items	*/
	*p++ = 210;        /* x */
	*p++ = 10;         /* y */
	*p++ = 200;        /* cx */
	*p++ = 100;        /* cy */
	*p++ = 0;          /* Menu */
	*p++ = 0;          /* Class */

/* 
 *	Copy the title of the dialog 
 */
	nchar = nCopyAnsiToWideChar(p, "GoAhead WebServer");
	p += nchar;

/*	
 *	Font information because of DS_SETFONT
 */
	*p++ = 11;     /* point size */
	nchar = nCopyAnsiToWideChar(p, T("Arial Bold"));
	p += nchar;

/*
 *	Make sure the first item starts on a DWORD boundary
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲三级小视频| 亚洲精品中文字幕乱码三区| www.一区二区| 久久成人久久爱| 视频一区国产视频| 亚洲福利国产精品| 亚洲欧美另类久久久精品2019| 2014亚洲片线观看视频免费| 日韩欧美一区二区不卡| 欧美男生操女生| 日本韩国欧美一区| 色综合天天综合| 波多野结衣亚洲一区| 99久久综合色| 91福利在线播放| 欧美日韩性生活| 91精品国产手机| 久久亚洲精精品中文字幕早川悠里 | 中文字幕人成不卡一区| 亚洲天堂av一区| 亚洲电影视频在线| 久久不见久久见免费视频1| 精品午夜一区二区三区在线观看| 精品亚洲国内自在自线福利| 国产精品影视天天线| 成人美女视频在线观看| 在线观看亚洲专区| 日韩视频一区二区| 国产亲近乱来精品视频| 亚洲特黄一级片| 视频在线在亚洲| 韩国欧美国产1区| 99麻豆久久久国产精品免费| 欧美日韩国产美女| 久久亚洲精华国产精华液| 国产精品乱码一区二区三区软件 | 狠狠色综合日日| 粉嫩欧美一区二区三区高清影视| 99国产精品久久久久久久久久| 欧美三区在线观看| 久久久久久电影| 国产精品不卡在线观看| 午夜日韩在线观看| 国产黄色精品网站| 欧美色中文字幕| 久久中文娱乐网| 夜夜嗨av一区二区三区四季av| 毛片av一区二区| 91免费在线看| 精品美女一区二区| 亚洲精品视频在线| 狠狠色丁香久久婷婷综合丁香| 91免费版在线| 精品理论电影在线观看| 亚洲色图视频网站| 国内外成人在线| 欧美日韩一级视频| 中文字幕av在线一区二区三区| 五月婷婷色综合| www.66久久| 欧美sm极限捆绑bd| 亚洲黄色录像片| 国产一区二区网址| 欧美精选午夜久久久乱码6080| 久久精品在线免费观看| 日日夜夜免费精品| 色哟哟国产精品| 久久精品亚洲精品国产欧美kt∨| 亚洲一区二区三区四区在线观看| 国产成人精品综合在线观看| 欧美日韩高清一区二区不卡| 欧美韩日一区二区三区四区| 国产91精品久久久久久久网曝门| 欧美日韩高清不卡| 亚洲三级在线播放| 岛国av在线一区| 欧美成人一区二区三区| 亚洲一区自拍偷拍| 成人动漫一区二区| 国产亚洲一区二区三区四区| 日韩专区中文字幕一区二区| 色嗨嗨av一区二区三区| 国产精品三级视频| 国产精品一区二区视频| 91精品国产91综合久久蜜臀| 亚洲精品国产成人久久av盗摄 | 成人激情免费电影网址| 日韩三级视频中文字幕| 性欧美大战久久久久久久久| 不卡av在线免费观看| 国产日韩欧美综合一区| 久久黄色级2电影| 欧美色图一区二区三区| 亚洲视频免费在线观看| 成人av小说网| 国产免费久久精品| 国内一区二区视频| 26uuu色噜噜精品一区| 视频一区二区欧美| 在线电影欧美成精品| 亚洲国产日日夜夜| 欧美吻胸吃奶大尺度电影| 一区二区三区鲁丝不卡| 在线视频国内自拍亚洲视频| 亚洲视频一区在线| 色综合婷婷久久| 一区二区三区在线视频观看 | 欧美丰满美乳xxx高潮www| 性感美女久久精品| 91精品欧美综合在线观看最新| 天堂成人国产精品一区| 日韩视频在线永久播放| 蜜桃视频一区二区三区 | 夜夜精品视频一区二区| 色哟哟国产精品| 亚洲国产cao| 在线不卡一区二区| 午夜精品久久久久久| 91精品国产91热久久久做人人 | 一道本成人在线| 亚洲国产综合91精品麻豆| 欧美精品99久久久**| 久久超碰97中文字幕| 国产亚洲综合性久久久影院| 丁香激情综合国产| 亚洲欧美电影一区二区| 欧美色国产精品| 美腿丝袜一区二区三区| 久久久精品免费观看| 9l国产精品久久久久麻豆| 亚洲男同1069视频| 7799精品视频| 久久精品国产精品青草| 国产精品免费aⅴ片在线观看| 91片在线免费观看| 日韩二区三区在线观看| 26uuu国产日韩综合| av亚洲精华国产精华| 亚洲gay无套男同| 精品久久国产字幕高潮| 成人黄色综合网站| 亚洲aⅴ怡春院| 精品粉嫩超白一线天av| www.亚洲人| 日韩黄色片在线观看| 亚洲国产高清aⅴ视频| 欧美在线视频不卡| 国产一区二区剧情av在线| 综合激情网...| 欧美成人一区二区三区片免费 | 中文字幕中文字幕一区| 欧美美女激情18p| 国产成人精品影院| 污片在线观看一区二区| 国产精品日日摸夜夜摸av| 欧美色中文字幕| 成人午夜av电影| 日本网站在线观看一区二区三区 | 国产精品国模大尺度视频| 欧美性色aⅴ视频一区日韩精品| 国内精品国产成人国产三级粉色 | 九九视频精品免费| 尤物视频一区二区| 国产女人aaa级久久久级 | 日本一区免费视频| 91精品国产综合久久国产大片| 国产a级毛片一区| 秋霞电影网一区二区| 亚洲色图制服丝袜| 久久久www成人免费毛片麻豆| 欧美伊人精品成人久久综合97| 国产一区 二区 三区一级| 天涯成人国产亚洲精品一区av| 国产精品天干天干在线综合| 日韩一区二区精品| 欧美中文字幕亚洲一区二区va在线 | 国产精品理伦片| 欧美一级艳片视频免费观看| 亚洲h精品动漫在线观看| 国产欧美一区二区精品久导航| 欧美日韩一卡二卡三卡| av成人免费在线| 精品一区二区成人精品| 午夜成人在线视频| 亚洲欧美国产高清| 欧美国产亚洲另类动漫| 精品国免费一区二区三区| 欧美图区在线视频| 一本色道久久综合亚洲aⅴ蜜桃| 国产成人在线色| 精品无码三级在线观看视频| 日韩在线一区二区三区| 亚洲一区日韩精品中文字幕| 综合中文字幕亚洲| 国产欧美精品一区二区色综合| 亚洲精品在线一区二区| 日韩欧美不卡一区| 91精品国产色综合久久久蜜香臀| 欧美无砖专区一中文字| 欧美日韩另类一区|