您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ExitProcess函数代码示例

51自学网 2021-06-01 20:39:57
  C++
这篇教程C++ ExitProcess函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ExitProcess函数的典型用法代码示例。如果您正苦于以下问题:C++ ExitProcess函数的具体用法?C++ ExitProcess怎么用?C++ ExitProcess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ExitProcess函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CreateThread

void MergeHashManager::execute(){    {        uint32 file_size = ((uint32)std::ceil(((float)this->merge_files.size()) / ((float)MAX_MERGE_THREADS)));        uint32 offset = (this->end - this->start) / MAX_MERGE_THREADS;        MergeHash merge[MAX_MERGE_THREADS];        int prev_size = 0;        for (int i = 0; i < MAX_MERGE_THREADS; ++i) {            std::deque<std::string>tmp_files;            for (int j = 0; j < file_size && this->merge_files.size() > 0; ++j) {                tmp_files.emplace_back(this->merge_files.front());                this->merge_files.pop_front();            }            (merge + i)->init(this->start + i*offset, this->start + (i + 1)*offset, tmp_files);            (merge + i)->file_count = i * (prev_size);            prev_size = tmp_files.size();        }        DWORD   dwThreadIdArray[MAX_MERGE_THREADS];        HANDLE  hThreadArray[MAX_MERGE_THREADS];        for (int i = 0; i < MAX_MERGE_THREADS; ++i) {            hThreadArray[i] = CreateThread(                NULL,                   // default security attributes                0,                      // use default stack size                  mergeExecute,         // thread function name                (merge + i),  // argument to thread function                 0,                      // use default creation flags                 &dwThreadIdArray[i]);   // returns the thread identifier             if (DEBUG && hThreadArray[i] == NULL)            {                //ErrorHandler(TEXT("CreateThread"));                ExitProcess(3);            }        }        WaitForMultipleObjects(MAX_MERGE_THREADS, hThreadArray, TRUE, INFINITE);        // Close all thread handles.        for (int i = 0; i < MAX_MERGE_THREADS; ++i)        {            CloseHandle(hThreadArray[i]);        }        //At this stage we have just 4 files to merge.        //Lets give two to each thread.        //Lets construct two new mergeHash objects to take care of them        for (int i = 0; i < MAX_MERGE_THREADS; ++i) {            this->total_read += (merge + i)->total_read;            this->total_write += (merge + i)->total_write;            this->merge_files.push_back((merge + i)->merge_files[0]);        }    }    MergeHash merge = MergeHash(this->start, this->end, this->merge_files);    merge.file_count = 100;    merge.execute();    this->merge_files.clear();    this->merge_files.push_back(merge.merge_files[0]);    this->total_read += merge.total_read;    this->total_write += merge.total_write;}
开发者ID:arunxls,项目名称:InvertedLinks,代码行数:63,


示例2: Main

EXTERN_C int WINAPI Main(){	int result = wWinMain(nullptr, nullptr, nullptr, 0);	ExitProcess(result);	return 0;  // Never reached.}
开发者ID:Crawping,项目名称:rainmeter,代码行数:6,


示例3: WINECON_Fatal

void WINECON_Fatal(const char* msg){    WINE_ERR("%s/n", msg);    ExitProcess(0);}
开发者ID:mikekap,项目名称:wine,代码行数:5,


示例4: GL_Init

bool GL_Init(HWND window, std::string *error_message) {    *error_message = "ok";    hWnd = window;    GLuint PixelFormat;    // TODO: Change to use WGL_ARB_pixel_format instead    static const PIXELFORMATDESCRIPTOR pfd = {        sizeof(PIXELFORMATDESCRIPTOR),							// Size Of This Pixel Format Descriptor        1,														// Version Number        PFD_DRAW_TO_WINDOW |									// Format Must Support Window        PFD_SUPPORT_OPENGL |									// Format Must Support OpenGL        PFD_DOUBLEBUFFER,										// Must Support Double Buffering        PFD_TYPE_RGBA,											// Request An RGBA Format        24,														// Select Our Color Depth        0, 0, 0, 0, 0, 0,										// Color Bits Ignored        8,														// No Alpha Buffer        0,														// Shift Bit Ignored        0,														// No Accumulation Buffer        0, 0, 0, 0,										// Accumulation Bits Ignored        16,														// At least a 16Bit Z-Buffer (Depth Buffer)        8,														// 8-bit Stencil Buffer        0,														// No Auxiliary Buffer        PFD_MAIN_PLANE,								// Main Drawing Layer        0,														// Reserved        0, 0, 0												// Layer Masks Ignored    };    hDC = GetDC(hWnd);    if (!hDC) {        *error_message = "Failed to get a device context.";        return false;											// Return FALSE    }    if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd)))	{        *error_message = "Can't find a suitable PixelFormat.";        return false;    }    if (!SetPixelFormat(hDC, PixelFormat, &pfd)) {        *error_message = "Can't set the PixelFormat.";        return false;    }    if (!(hRC = wglCreateContext(hDC)))	{        *error_message = "Can't create a GL rendering context.";        return false;    }    if (!wglMakeCurrent(hDC, hRC)) {        *error_message = "Can't activate the GL rendering context.";        return false;    }    // Check for really old OpenGL drivers and refuse to run really early in some cases.    // TODO: Also either tell the user to give up or point the user to the right websites. Here's some collected    // information about a system that will not work:    // GL_VERSION                        GL_VENDOR        GL_RENDERER    // "1.4.0 - Build 8.14.10.2364"      "intel"          intel Pineview Platform    I18NCategory *err = GetI18NCategory("Error");    std::string glVersion = (const char *)glGetString(GL_VERSION);    std::string glRenderer = (const char *)glGetString(GL_RENDERER);    const std::string openGL_1 = "1.";    if (glRenderer == "GDI Generic" || glVersion.substr(0, openGL_1.size()) == openGL_1) {        //The error may come from 16-bit colour mode        //Check Colour depth        HDC dc = GetDC(NULL);        u32 colour_depth = GetDeviceCaps(dc, BITSPIXEL);        ReleaseDC(NULL, dc);        if (colour_depth != 32) {            MessageBox(0, L"Please switch your display to 32-bit colour mode", L"OpenGL Error", MB_OK);            ExitProcess(1);        }        const char *defaultError = "Insufficient OpenGL driver support detected!/n/n"                                   "Your GPU reports that it does not support OpenGL 2.0. Would you like to try using DirectX 9 instead?/n/n"                                   "DirectX is currently compatible with less games, but on your GPU it may be the only choice./n/n"                                   "Visit the forums at http://forums.ppsspp.org for more information./n/n";        std::wstring versionDetected = ConvertUTF8ToWString(glVersion + "/n/n");        std::wstring error = ConvertUTF8ToWString(err->T("InsufficientOpenGLDriver", defaultError));        std::wstring title = ConvertUTF8ToWString(err->T("OpenGLDriverError", "OpenGL driver error"));        std::wstring combined = versionDetected + error;        bool yes = IDYES == MessageBox(hWnd, combined.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);        if (yes) {            // Change the config to D3D and restart.            g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9;            g_Config.Save();            W32Util::ExitAndRestart();        }        // Avoid further error messages. Let's just bail, it's safe, and we can't continue.        ExitProcess(1);    }//.........这里部分代码省略.........
开发者ID:VOID001,项目名称:ppsspp,代码行数:101,


示例5: printf

/*-------------------------------------------------------------------------------	FUNCTION:		receiveStream----	DATE:			2009-04-06----	REVISIONS:		2009-04-06 - Jaymz, Took out the TCP connection stuff since--								 we already have that at this point. Also added--								 a parameter WPARAM sd, which is the socket--								 from which we are receiving the data.--							   - Jaymz, Miscellaneous code touch-ups (mainly--								 formatting and removing of test printf()'s)----	DESIGNER(S):	David Overton--	PROGRAMMER(S):	David Overton, Jaymz Boilard, Steffen L. Norgren----	INTERFACE:		receiveStream(LPVOID iValue)----	RETURNS:		void----	NOTES: The main function to receive a UDP stream of data and process--	that information.-----------------------------------------------------------------------------*/DWORD WINAPI receiveStream(LPVOID iValue){	WAVEFORMATEX	wfx;	char			buffer[BLOCK_SIZE]; /* intermediate buffer for reading */	int				i, n, remote_len;	DWORD			outBytes = 0;	char			* play_byte = "1";	BOOL			firstRun = TRUE;	remote_len = sizeof(udp_remote);	/* initialise the module variables */	waveBlocks			= allocateBlocks(BLOCK_SIZE, BLOCK_COUNT);	waveFreeBlockCount	= BLOCK_COUNT;	waveCurrentBlock	= 0;	InitializeCriticalSection(&waveCriticalSection);		/* playback loop - read from socket */	while (TRUE) 	{		if (ci.request != MULTI_STREAM) {			/* send play signal */			sendto(ci.udpSocket, play_byte, sizeof(play_byte), 0, (struct sockaddr *)&udp_remote, remote_len);		}		if ((n = recvfrom(ci.udpSocket, buffer, sizeof(buffer), 0, (struct sockaddr *)&udp_remote, &remote_len)) <= 0)		{			waveOutClose(hWaveOut);			ExitThread(0);		}		/* first 4 bytes in a file, so set the header information */		if(strncmp(buffer, "RIFF", 4) == 0)		{			memcpy(&wfx, buffer+20, sizeof(wfx));			if (ci.request != MULTI_STREAM || firstRun == TRUE) {				waveOutClose(hWaveOut);							if(waveOutOpen(&hWaveOut, WAVE_MAPPER, &wfx, (DWORD_PTR)waveOutProc,					(DWORD_PTR)&waveFreeBlockCount, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)				{						MessageBox(NULL, "Unable to open mapper device.", "Error", MB_OK);						ExitProcess(1);				}				firstRun = FALSE;			}		}		if(n == 0)			break;		else if(n < sizeof(buffer) && n != WAVE_HEAD_SIZE)		{			memset(buffer + n, 0, sizeof(buffer) - n);			writeAudio(buffer, n);			break;		}		writeAudio(buffer, n);	}	/* wait for all blocks to complete */	while(waveFreeBlockCount < BLOCK_COUNT)		Sleep(10);	/* unprepare any blocks that are still prepared */	for(i = 0; i < waveFreeBlockCount; i++)	{		if(waveBlocks[i].dwFlags & WHDR_PREPARED)			waveOutUnprepareHeader(hWaveOut, &waveBlocks[i], sizeof(WAVEHDR));	}	DeleteCriticalSection(&waveCriticalSection);	freeBlocks(waveBlocks);	waveOutClose(hWaveOut);	streamInProgress = FALSE;	ExitThread(0);}
开发者ID:AshuDassanRepo,项目名称:bcit-courses,代码行数:99,


示例6: WinMain

BOOL APIENTRY WinMain(HINSTANCE hInstance,                     HINSTANCE hPrevInstance,                     LPSTR     lpCmdLine,                     int       nCmdShow){	PCHAR pszDllPath = "Accelerator.dll";	CHAR szDllPath[1024];    PCHAR pszFilePart = NULL;	if (!GetFullPathName(pszDllPath, ARRAYSIZE(szDllPath), szDllPath, &pszFilePart)) 	{        MessageBoxA(NULL, "GetFullPathName Failed/n", "Error", MB_OK);        return false;    }	HMODULE hDll = LoadLibraryEx(pszDllPath, NULL, DONT_RESOLVE_DLL_REFERENCES);    if (hDll == NULL) 	{		MessageBoxA(NULL, "Failed to load dll/n", "Error", MB_OK);        return false;    }	ExportContext ec;    ec.fHasOrdinal1 = FALSE;    ec.nExports = 0;    DetourEnumerateExports(hDll, &ec, ExportCallback);    FreeLibrary(hDll);	if (!ec.fHasOrdinal1) 	{		MessageBoxA(NULL, "This dll does not export ordinal #1./n", "Error", MB_OK);        return false;    }	//////////////////////////////////////////////////////////////////////////////////	STARTUPINFO si;    PROCESS_INFORMATION pi;    CHAR szCommand[2048];    CHAR szExe[1024];    CHAR szFullExe[1024] = "/0";    PCHAR pszFileExe = NULL;    ZeroMemory(&si, sizeof(si));    ZeroMemory(&pi, sizeof(pi));    si.cb = sizeof(si);    szCommand[0] = L'/0';	strcpy(szExe, "LOVESICK_PUPPIES.exe");	strcpy(szCommand, "LOVESICK_PUPPIES.exe");	//////////////////////////////////////////////////////////////////////////////////	DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED;    SetLastError(0);    SearchPath(NULL, szExe, ".exe", ARRAYSIZE(szFullExe), szFullExe, &pszFileExe);    if (!DetourCreateProcessWithDllEx(szFullExe[0] ? szFullExe : NULL, szCommand,                                      NULL, NULL, TRUE, dwFlags, NULL, NULL,                                      &si, &pi, szDllPath, NULL)) 	{        DWORD dwError = GetLastError();		MessageBoxA(NULL, "DetourCreateProcessWithDllEx failed/n", "Error", MB_OK);                if (dwError == ERROR_INVALID_HANDLE)		{#if DETOURS_64BIT			MessageBoxA(NULL, " Can't detour a 32-bit target process from a 64-bit parent process./n", "Error", MB_OK);            #else			MessageBoxA(NULL, " Can't detour a 64-bit target process from a 32-bit parent process./n", "Error", MB_OK);#endif        }        ExitProcess(9009);    }    ResumeThread(pi.hThread);    WaitForSingleObject(pi.hProcess, INFINITE);    DWORD dwResult = 0;    if (!GetExitCodeProcess(pi.hProcess, &dwResult)) 	{		MessageBoxA(NULL, "GetExitCodeProcess failed/n", "Error", MB_OK);        return false;    }    return true;}
开发者ID:AbyssSquall,项目名称:FuckGalEngine,代码行数:86,


示例7: UIShader_Prepare

void MenuScreen::render() {	UIShader_Prepare();	UIBegin(UIShader_Get());	DrawBackground(1.0f);	double xoff = 150 - frames_ * frames_ * 0.4f;	if (xoff < -20)		xoff = -20;	if (frames_ > 200)  // seems the above goes nuts after a while...		xoff = -20;	int w = LARGE_BUTTON_WIDTH + 60;	ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 75, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM);	ui_draw2d.SetFontScale(0.7f, 0.7f);	ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_GIT_VERSION, dp_xres + xoff, 85, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM);	ui_draw2d.SetFontScale(1.0f, 1.0f);	VLinear vlinear(dp_xres + xoff, 100, 20);	I18NCategory *m = GetI18NCategory("MainMenu");	if (UIButton(GEN_ID, vlinear, w, 0, m->T("Load", "Load..."), ALIGN_RIGHT)) {#if defined(USING_QT_UI) && !defined(MEEGO_EDITION_HARMATTAN)		QString fileName = QFileDialog::getOpenFileName(NULL, "Load ROM", g_Config.currentDirectory.c_str(), "PSP ROMs (*.iso *.cso *.pbp *.elf)");		if (QFile::exists(fileName)) {			QDir newPath;			g_Config.currentDirectory = newPath.filePath(fileName).toStdString();			g_Config.Save();			screenManager()->switchScreen(new EmuScreen(fileName.toStdString()));		}#elif _WIN32		MainWindow::BrowseAndBoot("");#else		FileSelectScreenOptions options;		options.allowChooseDirectory = true;		options.filter = "iso:cso:pbp:elf:prx:";		options.folderIcon = I_ICON_FOLDER;		options.iconMapping["iso"] = I_ICON_UMD;		options.iconMapping["cso"] = I_ICON_UMD;		options.iconMapping["pbp"] = I_ICON_EXE;		options.iconMapping["elf"] = I_ICON_EXE;		screenManager()->switchScreen(new FileSelectScreen(options));#endif		UIReset();	}	if (UIButton(GEN_ID, vlinear, w, 0, m->T("Settings"), ALIGN_RIGHT)) {		screenManager()->push(new SettingsScreen(), 0);		UIReset();	}	if (UIButton(GEN_ID, vlinear, w, 0, m->T("Credits"), ALIGN_RIGHT)) {		screenManager()->switchScreen(new CreditsScreen());		UIReset();	}	if (UIButton(GEN_ID, vlinear, w, 0, m->T("Exit"), ALIGN_RIGHT)) {		// TODO: Save when setting changes, rather than when we quit		NativeShutdown();		// TODO: Need a more elegant way to quit#ifdef _WIN32		ExitProcess(0);#else		exit(0);#endif	}	if (UIButton(GEN_ID, vlinear, w, 0, "www.ppsspp.org", ALIGN_RIGHT)) {		LaunchBrowser("http://www.ppsspp.org/");	}	int recentW = 350;	if (g_Config.recentIsos.size()) {		ui_draw2d.DrawText(UBUNTU24, m->T("Recent"), -xoff, 80, 0xFFFFFFFF, ALIGN_BOTTOMLEFT);	}	int spacing = 15;	float textureButtonWidth = 144;	float textureButtonHeight = 80;	if (dp_yres < 480)		spacing = 8;	// On small screens, we can't fit four vertically.	if (100 + spacing * 6 + textureButtonHeight * 4 > dp_yres) {		textureButtonHeight = (dp_yres - 100 - spacing * 6) / 4;		textureButtonWidth = (textureButtonHeight / 80) * 144;	}	VGrid vgrid_recent(-xoff, 100, std::min(dp_yres-spacing*2, 480), spacing, spacing);	for (size_t i = 0; i < g_Config.recentIsos.size(); i++) {		std::string filename;		std::string rec = g_Config.recentIsos[i];		for (size_t j = 0; j < rec.size(); j++)			if (rec[j] == '//') rec[j] = '/';		SplitPath(rec, nullptr, &filename, nullptr);		UIContext *ctx = screenManager()->getUIContext();		// This might create a texture so we must flush first.//.........这里部分代码省略.........
开发者ID:cemedine,项目名称:ppsspp,代码行数:101,


示例8: exception_filter

static LONG CALLBACK exception_filter(struct _EXCEPTION_POINTERS *info){	static const struct	{		DWORD code;		const char *string;	} exception_table[] =	{		{ EXCEPTION_ACCESS_VIOLATION,		"ACCESS VIOLATION" },		{ EXCEPTION_DATATYPE_MISALIGNMENT,	"DATATYPE MISALIGNMENT" },		{ EXCEPTION_BREAKPOINT, 			"BREAKPOINT" },		{ EXCEPTION_SINGLE_STEP,			"SINGLE STEP" },		{ EXCEPTION_ARRAY_BOUNDS_EXCEEDED,	"ARRAY BOUNDS EXCEEDED" },		{ EXCEPTION_FLT_DENORMAL_OPERAND,	"FLOAT DENORMAL OPERAND" },		{ EXCEPTION_FLT_DIVIDE_BY_ZERO,		"FLOAT DIVIDE BY ZERO" },		{ EXCEPTION_FLT_INEXACT_RESULT,		"FLOAT INEXACT RESULT" },		{ EXCEPTION_FLT_INVALID_OPERATION,	"FLOAT INVALID OPERATION" },		{ EXCEPTION_FLT_OVERFLOW,			"FLOAT OVERFLOW" },		{ EXCEPTION_FLT_STACK_CHECK,		"FLOAT STACK CHECK" },		{ EXCEPTION_FLT_UNDERFLOW,			"FLOAT UNDERFLOW" },		{ EXCEPTION_INT_DIVIDE_BY_ZERO,		"INTEGER DIVIDE BY ZERO" },		{ EXCEPTION_INT_OVERFLOW, 			"INTEGER OVERFLOW" },		{ EXCEPTION_PRIV_INSTRUCTION, 		"PRIVILEGED INSTRUCTION" },		{ EXCEPTION_IN_PAGE_ERROR, 			"IN PAGE ERROR" },		{ EXCEPTION_ILLEGAL_INSTRUCTION, 	"ILLEGAL INSTRUCTION" },		{ EXCEPTION_NONCONTINUABLE_EXCEPTION,"NONCONTINUABLE EXCEPTION" },		{ EXCEPTION_STACK_OVERFLOW, 		"STACK OVERFLOW" },		{ EXCEPTION_INVALID_DISPOSITION, 	"INVALID DISPOSITION" },		{ EXCEPTION_GUARD_PAGE, 			"GUARD PAGE VIOLATION" },		{ EXCEPTION_INVALID_HANDLE, 		"INVALID HANDLE" },		{ 0,								"UNKNOWN EXCEPTION" }	};	static int already_hit = 0;#ifndef PTR64	UINT32 code_start, code_size;#endif	int i;	// if we're hitting this recursively, just exit	if (already_hit)		ExitProcess(100);	already_hit = 1;	// find our man	for (i = 0; exception_table[i].code != 0; i++)		if (info->ExceptionRecord->ExceptionCode == exception_table[i].code)			break;	// print the exception type and address	fprintf(stderr, "/n-----------------------------------------------------/n");	fprintf(stderr, "Exception at EIP=%08X%s: %s/n", (UINT32)info->ExceptionRecord->ExceptionAddress,			lookup_symbol((UINT32)info->ExceptionRecord->ExceptionAddress), exception_table[i].string);	// for access violations, print more info	if (info->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)		fprintf(stderr, "While attempting to %s memory at %08X/n",				info->ExceptionRecord->ExceptionInformation[0] ? "write" : "read",				(UINT32)info->ExceptionRecord->ExceptionInformation[1]);	// print the state of the CPU	fprintf(stderr, "-----------------------------------------------------/n");#ifdef PTR64	fprintf(stderr, "RAX=%p RBX=%p RCX=%p RDX=%p/n",			(void *)info->ContextRecord->Rax,			(void *)info->ContextRecord->Rbx,			(void *)info->ContextRecord->Rcx,			(void *)info->ContextRecord->Rdx);	fprintf(stderr, "RSI=%p RDI=%p RBP=%p RSP=%p/n",			(void *)info->ContextRecord->Rsi,			(void *)info->ContextRecord->Rdi,			(void *)info->ContextRecord->Rbp,			(void *)info->ContextRecord->Rsp);	fprintf(stderr, " R8=%p  R9=%p R10=%p R11=%p/n",			(void *)info->ContextRecord->R8,			(void *)info->ContextRecord->R9,			(void *)info->ContextRecord->R10,			(void *)info->ContextRecord->R11);	fprintf(stderr, "R12=%p R13=%p R14=%p R15=%p/n",			(void *)info->ContextRecord->R12,			(void *)info->ContextRecord->R13,			(void *)info->ContextRecord->R14,			(void *)info->ContextRecord->R15);#else	fprintf(stderr, "EAX=%p EBX=%p ECX=%p EDX=%p/n",			(void *)info->ContextRecord->Eax,			(void *)info->ContextRecord->Ebx,			(void *)info->ContextRecord->Ecx,			(void *)info->ContextRecord->Edx);	fprintf(stderr, "ESI=%p EDI=%p EBP=%p ESP=%p/n",			(void *)info->ContextRecord->Esi,			(void *)info->ContextRecord->Edi,			(void *)info->ContextRecord->Ebp,			(void *)info->ContextRecord->Esp);#endif#ifndef PTR64	// crawl the stack for a while	if (get_code_base_size(&code_start, &code_size))	{		char prev_symbol[1024], curr_symbol[1024];//.........这里部分代码省略.........
开发者ID:broftkd,项目名称:mess-cvs,代码行数:101,


示例9: main

int main(int argc, char **argv){	struct cmdline_args args = {0};	int ret = 0;	setvbuf(stderr, NULL, _IOFBF, 0);	setvbuf(stdout, NULL, _IOFBF, 0);	opdb_reset();	ctrlc_init();	args.devarg.vcc_mv = 3000;	args.devarg.requested_serial = NULL;	if (parse_cmdline_args(argc, argv, &args) < 0)		goto fail_parse;	if (args.flags & OPT_EMBEDDED)		input_module = &input_async;	if (input_module->init() < 0)		goto fail_input;	output_set_embedded(args.flags & OPT_EMBEDDED);	if (sockets_init() < 0) {		ret = -1;		goto fail_sockets;	}	printc_dbg("%s/n", version_text);	if (setup_driver(&args) < 0) {		ret = -1;		goto fail_driver;	}	if (device_probe_id(device_default) < 0)		printc_err("warning: device ID probe failed/n");	simio_init();	if (!(args.flags & OPT_NO_RC))		process_rc_file(args.alt_config);	/* Process commands */	if (optind < argc) {		while (optind < argc) {			if (process_command(argv[optind++]) < 0) {				ret = -1;				break;			}		}	} else {		reader_loop();	}	simio_exit();	device_destroy();	stab_exit();fail_driver:	sockets_exit();fail_sockets:	input_module->exit();fail_input:fail_parse:	/* We need to do this on Windows, because in embedded mode we	 * may still have a running background thread for input. If so,	 * returning from main() won't cause the process to terminate.	 */#if defined(__Windows__) || defined(__CYGWIN__)	ExitProcess(ret);#endif	return ret;}
开发者ID:noccy80,项目名称:mspdebug,代码行数:73,


示例10: WorkerThread

DWORDWorkerThread(    PVOID ThreadIndex    ){    DWORD Me;    PDWORD MyCellVectorBase;    PDWORD CurrentCellVector;    DWORD MyRecalcValue;    DWORD MyNumberOfCells;    DWORD i;    BOOL MemoryContention;    Me = (DWORD)ThreadIndex;    MyRecalcValue = 0;    MyCellVectorBase = ThreadWork[Me].CellVector;    MyNumberOfCells = ThreadWork[Me].NumberOfCells;    MemoryContention = fMemoryContention;    //    // Signal that I am ready to go    //    if ( !SetEvent(ThreadReadyDoneEvents[Me]) ) {        fprintf(stderr,"MTBNCH: (1) SetEvent(ThreadReadyDoneEvent[%d]) Failed %d/n",Me,GetLastError());        ExitProcess(1);        }    //    // Wait for the master to release us to do the recalc    //    i = WaitForSingleObject(hStartOfRace,INFINITE);    if ( i == WAIT_FAILED ) {        fprintf(stderr,"MTBNCH: Thread %d Wait for start of recalc Failed %d/n",Me,GetLastError());        ExitProcess(1);        }    //    // perform the recalc operation    //    for (i=0, CurrentCellVector = MyCellVectorBase; i<MyNumberOfCells; i++ ) {        MyRecalcValue += *CurrentCellVector++;        if ( MemoryContention ) {            InterlockedIncrement(&ContentionValue);            }        }    ThreadWork[Me].RecalcResult = MyRecalcValue;    //    // Signal that I am done and then wait for further instructions    //    if ( !SetEvent(ThreadReadyDoneEvents[Me]) ) {        fprintf(stderr,"MTBNCH: (2) SetEvent(ThreadReadyDoneEvent[%d]) Failed %d/n",Me,GetLastError());        ExitProcess(1);        }    i = WaitForSingleObject(hEndOfRace,INFINITE);    if ( i == WAIT_FAILED ) {        fprintf(stderr,"MTBNCH: Thread %d Wait for end of recalc Failed %d/n",Me,GetLastError());        ExitProcess(1);        }    return MyRecalcValue;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:68,


示例11: main

int _CRTAPI1main(    int argc,    char *argv[],    char *envp[]    ){    DWORD StartTicks, EndTicks;    DWORD i;    BOOL fShowUsage;    char c, *p, *whocares;    PDWORD CellVector;    DWORD NumberOfDwords;    DWORD DwordsPerThread;    DWORD ThreadId;    LPSTR Answer;    fShowUsage = FALSE;    fMemoryContention = FALSE;    if (argc <= 1) {        goto showUsage;        }    while (--argc) {        p = *++argv;        if (*p == '/' || *p == '-') {            while (c = *++p)            switch (toupper( c )) {            case '?':                fShowUsage = TRUE;                goto showUsage;                break;            case 'M':                if (!argc--) {                    fShowUsage = TRUE;                    goto showUsage;                    }                argv++;                Mb = strtoul(*argv,&whocares,10);                break;            case 'C':                fMemoryContention = TRUE;                break;            case 'T':                if (!argc--) {                    fShowUsage = TRUE;                    goto showUsage;                    }                argv++;                NumberOfThreads = strtoul(*argv,&whocares,10);                if ( NumberOfThreads > MAX_THREADS ) {                    fShowUsage = TRUE;                    goto showUsage;                    }                break;            default:                fprintf( stderr, "MTBNCH: Invalid switch - /%c/n", c );                goto showUsage;                break;                }            }        }showUsage:    if ( fShowUsage ) {        fprintf(stderr,"usage: MTBNCH/n" );        fprintf(stderr,"              [-?] display this message/n" );        fprintf(stderr,"              [-t n] use n threads for benchmark (less than 32)/n" );        fprintf(stderr,"              [-m n] use an n Mb spreadsheet size (default 4)/n" );        fprintf(stderr,"              [-c] cause memory contention on each loop iteration/n" );        ExitProcess(1);        }    //    // Prepare the race events. These are manual reset events.    //    hStartOfRace = CreateEvent(NULL,TRUE,FALSE,NULL);    hEndOfRace = CreateEvent(NULL,TRUE,FALSE,NULL);    if ( !hStartOfRace || !hEndOfRace ) {        fprintf(stderr,"MTBNCH: Race Event Creation Failed/n");        ExitProcess(1);        }    //    // Prepare the ready done events. These are auto clearing events    //    for(i=0; i<NumberOfThreads; i++ ) {        ThreadReadyDoneEvents[i] = CreateEvent(NULL,FALSE,FALSE,NULL);        if ( !ThreadReadyDoneEvents[i] ) {            fprintf(stderr,"MTBNCH: Ready Done Event Creation Failed %d/n",GetLastError());            ExitProcess(1);            }//.........这里部分代码省略.........
开发者ID:mingpen,项目名称:OpenNT,代码行数:101,


示例12: WinProcCallback

//// WinProcCallback//INT_PTR WINAPI WinProcCallback(	HWND hWnd,	UINT message,	WPARAM wParam,	LPARAM lParam	)	// Routine Description:	//     Simple Windows callback for handling messages.	//     This is where all the work is done because the example	//     is using a window to process messages. This logic would be handled 	//     differently if registering a service instead of a window.	// Parameters:	//     hWnd - the window handle being registered for events.	//     message - the message being interpreted.	//     wParam and lParam - extended information provided to this	//          callback by the message sender.	//     For more information regarding these parameters and return value,	//     see the documentation for WNDCLASSEX and CreateWindowEx.{	LRESULT lRet = 1;	static HDEVNOTIFY hDeviceNotify;	static HWND hEditWnd;	static ULONGLONG msgCount = 0;	switch (message)	{	case WM_CREATE:		//		// This is the actual registration., In this example, registration 		// should happen only once, at application startup when the window		// is created.		//		// If you were using a service, you would put this in your main code 		// path as part of your service initialization.		//		if (!DoRegisterDeviceInterfaceToHwnd(			WceusbshGUID,			hWnd,			&hDeviceNotify))		{			// Terminate on failure.			ErrorHandler(TEXT("DoRegisterDeviceInterfaceToHwnd"));			ExitProcess(1);		}		//		// Make the child window for output.		//		hEditWnd = CreateWindow(TEXT("EDIT"),// predefined class 			NULL,        // no window title 			WS_CHILD | WS_VISIBLE | WS_VSCROLL |			ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,			0, 0, 0, 0,  // set size in WM_SIZE message 			hWnd,        // parent window 			(HMENU)1,    // edit control ID 			(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),			NULL);       // pointer not needed 		if (hEditWnd == NULL)		{			// Terminate on failure.			ErrorHandler(TEXT("CreateWindow: Edit Control"));			ExitProcess(1);		}		// Add text to the window. 		SendMessage(hEditWnd, WM_SETTEXT, 0,			(LPARAM)TEXT("Registered for USB device notification.../n"));		break;	case WM_SETFOCUS:		SetFocus(hEditWnd);		break;	case WM_SIZE:		// Make the edit control the size of the window's client area. 		MoveWindow(hEditWnd,			0, 0,                  // starting x- and y-coordinates 			LOWORD(lParam),        // width of client area 			HIWORD(lParam),        // height of client area 			TRUE);                 // repaint window 		break;	case WM_DEVICECHANGE:	{		//		// This is the actual message from the interface via Windows messaging.		// This code includes some additional decoding for this particular device type		// and some common validation checks.		////.........这里部分代码省略.........
开发者ID:tqtam,项目名称:LUANVAN,代码行数:101,


示例13: WinMainCRTStartup

// this is a simplified entry point ...void __stdcall WinMainCRTStartup(){    ExitProcess(WinMain(GetModuleHandle(NULL), NULL, NULL, 0));}
开发者ID:piaoasd123,项目名称:graphicsdemoskeleton,代码行数:5,


示例14: switch

	LRESULT WindowImplBase::OnCreate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )	{		LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);		styleValue &= ~( WS_CAPTION );		::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);		RECT rcClient;		::GetClientRect(*this, &rcClient);		::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, /			rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);		m_PaintManager.Init(m_hWnd);		m_PaintManager.AddPreMessageFilter(this);		CDialogBuilder builder;		CDuiString strResourcePath=m_PaintManager.GetInstancePath();		strResourcePath+=GetSkinFolder().GetData();		m_PaintManager.SetResourcePath(strResourcePath.GetData());		switch(GetResourceType())		{		case UILIB_ZIP:			m_PaintManager.SetResourceZip(GetZIPFileName().GetData(), true);			break;		case UILIB_ZIPRESOURCE:			{				HRSRC hResource = ::FindResource(m_PaintManager.GetResourceDll(), GetResourceID(), _T("WDKJ001"));				if( hResource == NULL )					return 0L;				DWORD dwSize = 0;				HGLOBAL hGlobal = ::LoadResource(m_PaintManager.GetResourceDll(), hResource);				if( hGlobal == NULL ) 				{#if defined(WIN32) && !defined(UNDER_CE)					::FreeResource(hResource);#endif					return 0L;				}				dwSize = ::SizeofResource(m_PaintManager.GetResourceDll(), hResource);				if( dwSize == 0 )					return 0L;				m_lpResourceZIPBuffer = new BYTE[ dwSize ];				if (m_lpResourceZIPBuffer != NULL)				{					::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize);				}#if defined(WIN32) && !defined(UNDER_CE)				::FreeResource(hResource);#endif				m_PaintManager.SetResourceZip(m_lpResourceZIPBuffer, dwSize);			}			break;		}		CControlUI* pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);		ASSERT(pRoot);		if (pRoot==NULL)		{			MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR);			ExitProcess(1);			return 0;		}		m_PaintManager.AttachDialog(pRoot);		m_PaintManager.AddNotifier(this);		m_PaintManager.SetBackgroundTransparent(TRUE);		InitWindow();		return 0;	}
开发者ID:wang1986one,项目名称:dxsuperdown,代码行数:68,


示例15: DebugBreakDo

static void DebugBreakDo(){	__debugbreak();	ExitProcess(0);}
开发者ID:ghost30812,项目名称:client,代码行数:5,


示例16: HandleDuplicateLaunching

////////////////////////////////////////////////////////////// HandleDuplicateLaunching//// Handle duplicate launching, or running from mtasa:// URI ?////////////////////////////////////////////////////////////void HandleDuplicateLaunching( void ){    LPSTR lpCmdLine = GetCommandLine();    int iRecheckTimeLimit = 2000;    while ( ! CreateSingleInstanceMutex () )    {        if ( strcmp ( lpCmdLine, "" ) != 0 )        {            HWND hwMTAWindow = FindWindow( NULL, "MTA: San Andreas" );#ifdef MTA_DEBUG            if( hwMTAWindow == NULL )                hwMTAWindow = FindWindow( NULL, "MTA: San Andreas [DEBUG]" );#endif            if( hwMTAWindow != NULL )            {                LPWSTR szCommandLine = GetCommandLineW ();                int numArgs;                LPWSTR* aCommandLineArgs = CommandLineToArgvW ( szCommandLine, &numArgs );                for ( int i = 1; i < numArgs; ++i )                {                    if ( WStringX( aCommandLineArgs[i] ).BeginsWith( L"mtasa://" ) )                    {                        WString wideConnectInfo = aCommandLineArgs[i];                        SString strConnectInfo = ToUTF8 ( wideConnectInfo );                        COPYDATASTRUCT cdStruct;                        cdStruct.cbData = strConnectInfo.length () + 1;                        cdStruct.lpData = const_cast<char *> ( strConnectInfo.c_str () );                        cdStruct.dwData = URI_CONNECT;                        SendMessage( hwMTAWindow, WM_COPYDATA, NULL, (LPARAM)&cdStruct );                        break;                    }                }                            }            else            {                if ( iRecheckTimeLimit > 0 )                {                    // Sleep a little bit and check the mutex again                    Sleep ( 500 );                    iRecheckTimeLimit -= 500;                    continue;                }                SString strMessage;                strMessage += _(    "Trouble restarting MTA:SA/n/n"                                    "If the problem persists, open Task Manager and/n"                                    "stop the 'gta_sa.exe' and 'Multi Theft Auto.exe' processes/n/n/n"                                    "Try to launch MTA:SA again?" );                if ( MessageBoxUTF8( 0, strMessage, _("Error")+_E("CL04"), MB_ICONWARNING | MB_YESNO | MB_TOPMOST  ) == IDYES ) // Trouble restarting MTA:SA                {                    TerminateGTAIfRunning ();                    TerminateOtherMTAIfRunning ();                    ShellExecuteNonBlocking( "open", PathJoin ( GetMTASAPath (), MTA_EXE_NAME ), lpCmdLine );                }                return ExitProcess( EXIT_ERROR );            }        }        else        {            if ( !IsGTARunning () && !IsOtherMTARunning () )            {                MessageBoxUTF8 ( 0, _("Another instance of MTA is already running./n/nIf this problem persists, please restart your computer"), _("Error")+_E("CL05"), MB_ICONERROR | MB_TOPMOST  );            }            else            if ( MessageBoxUTF8( 0, _("Another instance of MTA is already running./n/nDo you want to terminate it?"), _("Error")+_E("CL06"), MB_ICONQUESTION | MB_YESNO | MB_TOPMOST  ) == IDYES )            {                TerminateGTAIfRunning ();                TerminateOtherMTAIfRunning ();                ShellExecuteNonBlocking( "open", PathJoin ( GetMTASAPath (), MTA_EXE_NAME ), lpCmdLine );            }        }        return ExitProcess( EXIT_ERROR );    }}
开发者ID:F420,项目名称:mtasa-blue,代码行数:85,


示例17: launch

static void launch(LPCWSTR what){  Control_RunDLLW(GetDesktopWindow(), 0, what, SW_SHOW);  ExitProcess(0);}
开发者ID:AlexSteel,项目名称:wine,代码行数:5,


示例18: InitLocalization

////////////////////////////////////////////////////////////// InitLocalization//// Start localization thingmy////////////////////////////////////////////////////////////void InitLocalization( bool bNoFail ){    static bool bDone = false;    if ( bDone )        return;    // Check for and load core.dll for localization    // Use launch relative path so core.dll can get updated    SString strCoreDLL = PathJoin( GetLaunchPath(), "mta", MTA_DLL_NAME );    if ( !FileExists ( strCoreDLL ) )    {        if ( !bNoFail )            return;        DisplayErrorMessageBox ( ("Load failed.  Please ensure that "                            "the file core.dll is in the modules "                            "directory within the MTA root directory."), _E("CL23"), "core-missing" ); // Core.dll missing        return ExitProcess( EXIT_ERROR );    }    // Use registry setting of mta path for dlls, as they will not be present in update files    const SString strMTASAPath = GetMTASAPath ();    SetDllDirectory( PathJoin( strMTASAPath, "mta" ) );    // See if xinput is loadable (XInput9_1_0.dll is core.dll dependency)    HMODULE hXInputModule = LoadLibrary( "XInput9_1_0.dll" );    if ( hXInputModule )        FreeLibrary( hXInputModule );    else    {        // If not, do hack to use dll supplied with MTA        SString strDest = PathJoin( strMTASAPath, "mta", "XInput9_1_0.dll" );        if ( !FileExists( strDest ) )        {            SString strSrc = PathJoin( strMTASAPath, "mta", "XInput9_1_0_mta.dll" );                   FileCopy( strSrc, strDest );        }    }    // Check if the core can be loaded - failure may mean msvcr90.dll or d3dx9_40.dll etc is not installed    // Use LOAD_WITH_ALTERED_SEARCH_PATH so the strCoreDLL path is searched first for dependent dlls    HMODULE hCoreModule = LoadLibraryEx( strCoreDLL, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );    if ( hCoreModule == NULL )    {        if ( !bNoFail )            return;        DisplayErrorMessageBox ( ("Loading core failed.  Please ensure that /n"                            "Microsoft Visual C++ 2013 Redistributable Package (x86) /n"                            "and the latest DirectX is correctly installed."), _E("CL24"), "vc-redist-missing" );  // Core.dll load failed.  Ensure VC++ Redists and DX are installed        return ExitProcess( EXIT_ERROR );    }    // Grab our locale from the registry if possible, if not Windows    SString strLocale = GetApplicationSetting ( "locale" );    if ( strLocale.empty() )    {        setlocale(LC_ALL, "");        char* szLocale = setlocale(LC_ALL, NULL);        strLocale = szLocale;    }    typedef CLocalizationInterface* (__cdecl *FUNC_CREATELOCALIZATIONFROMENVIRONMENT)(SString strLocale);    FUNC_CREATELOCALIZATIONFROMENVIRONMENT pFunc = (FUNC_CREATELOCALIZATIONFROMENVIRONMENT)GetProcAddress ( hCoreModule, "L10n_CreateLocalization" );    CLocalizationInterface* pLocalization = pFunc(strLocale);    if ( pLocalization == NULL )    {        if ( !bNoFail )            return;        DisplayErrorMessageBox ( ("Loading core failed.  Please ensure that /n"                            "Microsoft Visual C++ 2013 Redistributable Package (x86) /n"                            "and the latest DirectX is correctly installed."), _E("CL26"), "vc-redist-missing" );  // Core.dll load failed.  Ensure VC++ Redists and DX are installed        FreeLibrary ( hCoreModule );        return ExitProcess( EXIT_ERROR );    }    SAFE_DELETE( g_pLocalization );    g_pLocalization = pLocalization;    bDone = true;#ifdef MTA_DEBUG    TestDialogs();#endif}
开发者ID:F420,项目名称:mtasa-blue,代码行数:91,


示例19: SendAuthentificationBlobLS

//.........这里部分代码省略.........	AES_ctr128_encrypt(RecvBuffer + sizeof(HttpsPacketHeader), RecvBuffer + sizeof(HttpsPacketHeader), htons(HSHeader->ResponseLen) - 0x02, &AesKey, ivec, ecount_buf, &Idx);		printf("[UNCIPHERED]Auth Response../n/n");	//showmem(RecvBuffer, RecvBufferSz);	//printf("/n/n");	uchar		*Buffer;	uint		BSize;	SResponse	Response;	Buffer = RecvBuffer;	BSize = RecvBufferSz;	Response.Objs = NULL;	Response.NbObj = 0;	while (BSize)	{		MainArchResponseManager(&Buffer, &BSize, &Response);		Buffer += 2;	}	for (Idx = 0; Idx < Response.NbObj; Idx++)	{		switch (Response.Objs[Idx].Id)		{		case OBJ_ID_LOGINANSWER:			switch (Response.Objs[Idx].Value.Nbr)			{			case LOGIN_OK:				cprintf(FOREGROUND_BLUE, "Login Successful../n");				GLoginD.RSAKeys = Keys;				break;			default :				cprintf(FOREGROUND_RED, "Login Failed.. Bad Credentials../n");				ExitProcess(0);				break;			}			break;		case OBJ_ID_CIPHERDLOGD:			GLoginD.SignedCredentials.Memory = MemDup(Response.Objs[Idx].Value.Memory.Memory, Response.Objs[Idx].Value.Memory.MsZ);			GLoginD.SignedCredentials.MsZ = Response.Objs[Idx].Value.Memory.MsZ;						uchar	*PostProcessed;			char	*Key;			uint	KeyIdx, PPsZ;			KeyIdx = htonl(*(uint *)Response.Objs[Idx].Value.Memory.Memory);			Response.Objs[Idx].Value.Memory.Memory += 4;			Response.Objs[Idx].Value.Memory.MsZ -= 4;						SkypeRSA = RSA_new();			Key = KeySelect(KeyIdx);			BN_hex2bn(&(SkypeRSA->n), Key);			BN_hex2bn(&(SkypeRSA->e), "10001");			PPsZ = RSA_public_decrypt(Response.Objs[Idx].Value.Memory.MsZ, Response.Objs[Idx].Value.Memory.Memory, Response.Objs[Idx].Value.Memory.Memory, SkypeRSA, RSA_NO_PADDING);			RSA_free(SkypeRSA);						PostProcessed = FinalizeLoginDatas(Response.Objs[Idx].Value.Memory.Memory, &PPsZ, NULL, 0);			Response.Objs[Idx].Value.Memory.Memory += PPsZ;			if (PostProcessed == NULL)			{				printf("Bad Datas Finalization../n");				return (0);			}			//showmem(PostProcessed, PPsZ);			//printf("/n");
开发者ID:DaemonOverlord,项目名称:Skype,代码行数:67,


示例20: CheckDataFiles

////////////////////////////////////////////////////////////// CheckDataFiles//// Basic check for some essential files////////////////////////////////////////////////////////////void CheckDataFiles( void ){    const SString strMTASAPath = GetMTASAPath();    const SString strGTAPath = GetGTAPath();    const char* dataFilesFiles [] = { "MTA//cgui//images//background_logo.png"                                     ,"MTA//cgui//images//radarset//up.png"                                     ,"MTA//cgui//images//busy_spinner.png"                                     ,"MTA//cgui//images//rect_edge.png"                                     ,"MTA//D3DX9_42.dll"                                     ,"MTA//D3DCompiler_42.dll"                                     ,"MTA//bass.dll"                                     ,"MTA//bass_fx.dll"                                     ,"MTA//tags.dll"                                     ,"MTA//sa.dat"                                     ,"MTA//XInput9_1_0_mta.dll"                                     ,"MTA//vea.dll"};    for ( uint i = 0 ; i < NUMELMS( dataFilesFiles ) ; i++ )    {        if ( !FileExists ( PathJoin( strMTASAPath, dataFilesFiles [ i ] ) ) )        {            DisplayErrorMessageBox ( _("Load failed. Please ensure that the latest data files have been installed correctly."), _E("CL16"), "mta-datafiles-missing" );            return ExitProcess( EXIT_ERROR );        }    }    if ( FileSize ( PathJoin( strMTASAPath, "MTA", "bass.dll" ) ) != 0x0001A440 )    {        DisplayErrorMessageBox ( _("Load failed. Please ensure that the latest data files have been installed correctly."), _E("CL17"), "mta-datafiles-missing" );        return ExitProcess( EXIT_ERROR );    }    // Check for client file    if ( !FileExists ( PathJoin( strMTASAPath, CHECK_DM_CLIENT_NAME ) ) )    {        DisplayErrorMessageBox ( SString(_("Load failed. Please ensure that %s is installed correctly."),CHECK_DM_CLIENT_NAME), _E("CL18"), "client-missing" );        return ExitProcess( EXIT_ERROR );    }    // Make sure the gta executable exists    if ( !FileExists( PathJoin( strGTAPath, MTA_GTAEXE_NAME ) ) )    {        DisplayErrorMessageBox ( SString ( _("Load failed. Could not find gta_sa.exe in %s."), strGTAPath.c_str () ), _E("CL20"), "gta_sa-missing" );        return ExitProcess( EXIT_ERROR );    }    // Make sure important dll's do not exist in the wrong place    const char* dllCheckList[] = { "xmll.dll", "cgui.dll", "netc.dll", "libcurl.dll", "pthread.dll" };    for ( int i = 0 ; i < NUMELMS ( dllCheckList ); i++ )    {        if ( FileExists( PathJoin( strGTAPath, dllCheckList[i] ) ) )        {            DisplayErrorMessageBox ( SString ( _("Load failed. %s exists in the GTA directory. Please delete before continuing."), dllCheckList[i] ), _E("CL21"), "file-clash" );            return ExitProcess( EXIT_ERROR );        }        }    // Check main exe has the correct name    if ( GetLaunchFilename().CompareI( MTA_EXE_NAME ) == false )    {        SString strMessage( _("Main file has an incorrect name (%s)"), *GetLaunchFilename() );        int iResponse = MessageBoxUTF8 ( NULL, strMessage, _("Error")+_E("CL33"), MB_RETRYCANCEL | MB_ICONERROR | MB_TOPMOST  );        ReleaseSingleInstanceMutex ();        if ( iResponse == IDRETRY )            ShellExecuteNonBlocking( "open", PathJoin ( strMTASAPath, MTA_EXE_NAME ) );                    return ExitProcess( EXIT_ERROR );    }    // Check for possible virus file changing activities    if ( !VerifyEmbeddedSignature( PathJoin( strMTASAPath, MTA_EXE_NAME ) ) )    {        SString strMessage( _("Main file is unsigned. Possible virus activity./n/nSee online help if MTA does not work correctly.") );        #if MTASA_VERSION_BUILD > 0 && defined(MTA_DM_CONNECT_TO_PUBLIC) && !defined(MTA_DEBUG)            DisplayErrorMessageBox( strMessage, _E("CL29"), "maybe-virus1" );        #endif    }    struct {        const char* szMd5;        const char* szFilename;    } integrityCheckList[] = { { "9586E7BE6AE8016932038932D1417241", "bass.dll", },                               { "B2E49F0C22C8B7D92D615F942BA19353", "bass_aac.dll", },                               { "569C60F8397C34034E685A303B7404C0", "bass_ac3.dll", },                               { "0E44BCAC0E940DB2BFB13448E96E4B29", "bass_fx.dll", },                               { "50AF8A7D49E83A723ED0F70FB682DCFB", "bassflac.dll", },                               { "BEBA64522AA8265751187E38D1FC0653", "bassmidi.dll", },                               { "99F4F38007D347CEED482B7C04FDD122", "bassmix.dll", },                               { "7B52BE6D702AA590DB57A0E135F81C45", "basswma.dll", },                                { "38D7679D3B8B6D7F16A0AA9BF2A60043", "tags.dll", },                               { "309D860FC8137E5FE9E7056C33B4B8BE", "vea.dll", },                               { "0602F672BA595716E64EC4040E6DE376", "vog.dll", },                               { "B37D7DF4A1430DB65AD3EA84801F9EC3", "vvo.dll", },//.........这里部分代码省略.........
开发者ID:F420,项目名称:mtasa-blue,代码行数:101,


示例21: process_events

void process_events(void){	HANDLE hThread1, hThread2;	DWORD dwThreadID1, dwThreadID2;	uint16_t length = 0;	uint8_t *payload;	uint16_t protocol;	uint8_t *proto;	struct avb_avtpdu *avtpdu = NULL;	uint64_t src_mac_address = 0;	struct ctl_thread_params localhost_pkt;	struct netif_thread_data wpcap_pkt;	int i;	timer_check_tick = mrpd_timer_create();	mrpd_timer_start_interval(timer_check_tick, 100, 100);	que_wpcap = que_new(256, sizeof(struct netif_thread_data));	que_localhost = que_new(256, sizeof(struct ctl_thread_params));	sem_kill_wpcap_thread = CreateSemaphore(NULL, 0, 32767, NULL);	sem_kill_localhost_thread = CreateSemaphore(NULL, 0, 32767, NULL);	for (i = pkt_event_wpcap_timeout; i <= loop_time_tick; i++) {		pkt_events[i] = CreateEvent(NULL, FALSE, FALSE, NULL);		if (pkt_events[i] == NULL) {			fprintf(stderr, "CreateEvent error: %d/n",				GetLastError());			ExitProcess(0);		}	}	pkt_events[pkt_event_wpcap] =		que_data_available_object(que_wpcap);	pkt_events[pkt_event_localhost] =	    que_data_available_object(que_localhost);	// Create threads	hThread1 = CreateThread(NULL,	// default security attributes				0,	// default stack size				(LPTHREAD_START_ROUTINE) netif_thread, NULL,	// no thread function arguments				0,	// default creation flags				&dwThreadID1);	// receive thread identifier	if (hThread1 == NULL) {		fprintf(stderr, "CreateThread error: %d/n", GetLastError());		ExitProcess(0);	}	hThread2 = CreateThread(NULL,	// default security attributes				0,	// default stack size				(LPTHREAD_START_ROUTINE) ctl_thread, NULL,	// no thread function arguments				0,	// default creation flags				&dwThreadID2);	// receive thread identifier	if (hThread2 == NULL) {		fprintf(stderr, "CreateThread error: %d/n", GetLastError());		ExitProcess(0);	}	while (1) {		DWORD dwEvent =		    WaitForMultipleObjects(sizeof(pkt_events) / sizeof(HANDLE),					   pkt_events,					   FALSE,					   100);	/* 100ms wait */		/* special exit case */		if (WAIT_OBJECT_0 + app_event_kill_all == dwEvent)			break;		switch (dwEvent) {		case WAIT_TIMEOUT:		case WAIT_OBJECT_0 + loop_time_tick:			/* timeout - run protocols */			if (mmrp_enable) {				if (mrpd_timer_timeout(MMRP_db->mrp_db.lva_timer))					mmrp_event(MRP_EVENT_LVATIMER, NULL);				if (mrpd_timer_timeout(MMRP_db->mrp_db.lv_timer))					mmrp_event(MRP_EVENT_LVTIMER, NULL);				if (mrpd_timer_timeout(MMRP_db->mrp_db.join_timer))					mmrp_event(MRP_EVENT_TX, NULL);			}			if (mvrp_enable) {				if (mrpd_timer_timeout(MVRP_db->mrp_db.lva_timer))					mvrp_event(MRP_EVENT_LVATIMER, NULL);				if (mrpd_timer_timeout(MVRP_db->mrp_db.lv_timer))					mvrp_event(MRP_EVENT_LVTIMER, NULL);				if (mrpd_timer_timeout(MVRP_db->mrp_db.join_timer))					mvrp_event(MRP_EVENT_TX, NULL);			}			if (msrp_enable) {				if (mrpd_timer_timeout(MSRP_db->mrp_db.lva_timer))					msrp_event(MRP_EVENT_LVATIMER, NULL);				if (mrpd_timer_timeout(MSRP_db->mrp_db.lv_timer))					msrp_event(MRP_EVENT_LVTIMER, NULL);				if (mrpd_timer_timeout(MSRP_db->mrp_db.join_timer))					msrp_event(MRP_EVENT_TX, NULL);			}//.........这里部分代码省略.........
开发者ID:isaraj82,项目名称:Open-AVB,代码行数:101,


示例22: main

void main (int argc, char *argv[]){	SOCKET sock;	char buffer[1000];	int i;	// ecrasement d'un saved EIP gr
C++ ExitProgram函数代码示例
C++ ExitOnNull函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。