Пример #1
0
bool CreateFullMappingPath( char* dest, bool old )
{
	bool res = old ? CreateWorkPath(dest) : CreateConfigPath(dest);
	if(res)
		strcat( dest, INPUT_MAP_FILE );
	return res;
}
Пример #2
0
bool CreateFullIniPath( char* dest, bool old )
{
	bool res = old ? CreateWorkPath(dest) : CreateConfigPath(dest);
	if(res)
		strcat( dest, INI_FILE );
	return res;
}
Пример #3
0
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
	HANDLE hMutex;
	INITCOMMONCONTROLSEX icex;

	_wsetlocale(LC_ALL, L"JPN");

	hInst = hInstance;

	CreateConfigPath();

	hMutex = CreateMutexW(NULL, FALSE, cnfmutexname);
	if(hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
	{
		return 0;
	}

	icex.dwSize = sizeof(icex);
	icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_TAB_CLASSES | ICC_PROGRESS_CLASS;
	InitCommonControlsEx(&icex);

	CreateProperty();

	return 0;
}
Пример #4
0
static LONG WINAPI CreateMiniDump( EXCEPTION_POINTERS* pep ) 
{
	r3dOutToLog("Creating minidump!!\n");

	// Open the file 
	char miniDumpPath[1024];
	if(CreateConfigPath(miniDumpPath))
	{
		strcat( miniDumpPath, "MiniDump.dmp" );
		r3dOutToLog("Minidump path: %s\n", miniDumpPath);

		HANDLE hFile = CreateFile( miniDumpPath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); 
		if( ( hFile != NULL ) && ( hFile != INVALID_HANDLE_VALUE ) ) 
		{
			// Create the minidump 
			MINIDUMP_EXCEPTION_INFORMATION mdei; 
			mdei.ThreadId           = GetCurrentThreadId(); 
			mdei.ExceptionPointers  = pep; 
			mdei.ClientPointers     = FALSE; 

			MINIDUMP_CALLBACK_INFORMATION mci; 
			mci.CallbackRoutine     = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback; 
			mci.CallbackParam       = 0; 

			MINIDUMP_TYPE mdt       = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory); 

			BOOL rv = MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), 
				hFile, mdt, (pep != 0) ? &mdei : 0, 0, &mci ); 

			if( !rv ) 
				r3dOutToLog( "MiniDumpWriteDump failed. Error: %u \n", GetLastError() ); 
			else 
				r3dOutToLog( "Minidump created.\n" ); 

			// Close the file 
			CloseHandle( hFile ); 
		}
		else 
		{
			r3dOutToLog( "CreateFile failed. Error: %u \n", GetLastError() ); 
		}

		r3dOutToLog("\n!!!Crash!!!\nPlease send '%s' to support@localhost\nThank you.", miniDumpPath);
		// hide window, hopefully will work in fullscreen
		ShowWindow(win::hWnd, SW_FORCEMINIMIZE);
		
		// show message box to user
		char tempStr[2048];
		sprintf(tempStr, "Application crashed.\nPlease send '%s' and r3dLog.txt (in install folder of the game) to support@localhost along with description of what you were doing at the time of crash.\nThank you and sorry for inconvenience.", miniDumpPath);
		MessageBox(0, tempStr, "Crash", MB_OK);
	}
	r3dCloseLogFile(); 

	// call WINDOWS ERROR REPORTING, in case if user will not send us crashdump
	LONG lRet = EXCEPTION_CONTINUE_SEARCH;
	lRet = EXCEPTION_EXECUTE_HANDLER;
	return lRet ;
}
Пример #5
0
void r3dThreadEntryHelper(threadEntry_fn fn, DWORD in)
{
	/*if(!CheckCrashRptVersion())
	{
		// An invalid CrashRpt.dll loaded!
		MessageBox(NULL, "The version of CrashRpt.dll is invalid.", "CRASH RPT ERROR", MB_OK);
		return;
	}*/

	if(!IsDebuggerPresent())
	{
#ifdef DISABLE_CRASHRPT
		SetUnhandledExceptionFilter(CreateMiniDump);
#else
		// detect language file
		wchar_t curDir[MAX_PATH];
		wchar_t langFile[MAX_PATH];
		GetCurrentDirectoryW(sizeof(curDir), curDir);
		swprintf(langFile, MAX_PATH, L"%s\\%s", curDir, crashRpgGetLangFile());

		// use wide versino of structure, as pszLangFilePath *require* full path by some reasons
		CR_INSTALL_INFOW info;
		memset(&info, 0, sizeof(CR_INSTALL_INFOW));  
		info.cb = sizeof(CR_INSTALL_INFOW);
#ifdef FINAL_BUILD
		info.pszAppName = L"Undead Brasil";
#else
		info.pszAppName = L"Undead Brasil";
#endif
		info.pszAppVersion = L"1.0";
		info.pszEmailTo = NULL;
		
#ifndef HS_ENABLED
		info.pszUrl = L"http:///127.0.0.1/conexao/api/php/api_CrashRptDebug.php";
#else
		info.pszUrl = L"http:///127.0.0.1/conexao/api/api_CrashRpt.php";
#endif
		
		info.pszCrashSenderPath = NULL;
		info.pfnCrashCallback = &r3dCrashRptCallback;
		info.uPriorities[CR_HTTP] = 1;
		info.uPriorities[CR_SMTP] = CR_NEGATIVE_PRIORITY; // skip it
		info.uPriorities[CR_SMAPI] = CR_NEGATIVE_PRIORITY; // skip it
		info.dwFlags |= CR_INST_ALL_EXCEPTION_HANDLERS;
		info.dwFlags |= CR_INST_HTTP_BINARY_ENCODING;
		info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS;
		//we should not restart app, as GNA using command line to pass login info
		//info.dwFlags |= CR_INST_APP_RESTART;
		//info.pszRestartCmdLine   = __r3dCmdLine; 
		info.pszPrivacyPolicyURL = L"https://127.0.0.1/conexao/PrivacyPolicy_WarZ.htm";
		info.pszLangFilePath     = langFile;

		int res = crInstallW(&info);
		if(res !=0)
		{
			// Something goes wrong. Get error message.
			TCHAR szErrorMsg[512] = _T("");        
			crGetLastErrorMsg(szErrorMsg, 512);    
			r3dOutToLog(("%s\n"), szErrorMsg);    
			//return 1;
		}

		// add files to crash report
		char filePath[1024];
		res = crAddFile2(_T("crashdmp.dmp"), NULL, _T("Crash dump file"), CR_AF_MAKE_FILE_COPY|CR_AF_MISSING_FILE_OK);

		res = crAddFile2(_T("r3dlog.txt"), NULL, _T("Log file"), CR_AF_MAKE_FILE_COPY|CR_AF_MISSING_FILE_OK);
		//CreateConfigPath(filePath);
		//remove( "r3dlog.txt");
		DeleteFile("r3dlog.txt");
		strcat(filePath, "gameSettings.ini");
		res = crAddFile2(filePath, NULL, _T("Game Settings file"), CR_AF_MAKE_FILE_COPY|CR_AF_MISSING_FILE_OK);
		CreateConfigPath(filePath);
		strcat(filePath, "GPU.txt");
		res = crAddFile2(filePath, NULL, _T("GPU information file"), CR_AF_MAKE_FILE_COPY|CR_AF_MISSING_FILE_OK);
#endif
	}

	//crEmulateCrash(CR_CPP_NEW_OPERATOR_ERROR);
	
	fn(in);

#ifndef DISABLE_CRASHRPT
	if(!IsDebuggerPresent())
	{
		crUninstall();
	}
#endif
}
Пример #6
0
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
	MSG msg;
	WNDCLASSEXW wc;
	HWND hWnd;
	WSADATA wsaData;
	PSECURITY_DESCRIPTOR psd;
	SECURITY_ATTRIBUTES sa;

	_wsetlocale(LC_ALL, L"JPN");

	CreateConfigPath();

	if(ConvertStringSecurityDescriptorToSecurityDescriptorW(krnlobjsddl, SDDL_REVISION_1, &psd, NULL))
	{
		sa.nLength = sizeof(sa);
		sa.lpSecurityDescriptor = psd;
		sa.bInheritHandle = FALSE;

		hMutex = CreateMutexW(&sa, FALSE, mgrmutexname);
		if(hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
		{
			LocalFree(psd);
			return 0;
		}

		LocalFree(psd);
	}
	else
	{
		return 0;
	}

	WSAStartup(WINSOCK_VERSION, &wsaData);

	ZeroMemory(&ftConfig, sizeof(ftConfig));
	if(IsFileUpdated(pathconfigxml, &ftConfig))
	{
		LoadConfig();
	}

	ZeroMemory(&ftSKKDic, sizeof(ftSKKDic));
	if(IsFileUpdated(pathskkdic, &ftSKKDic))
	{
		MakeSKKDicPos();
	}

	InitLua();

	hInst = hInstance;

	ZeroMemory(&wc, sizeof(wc));
	wc.cbSize = sizeof(wc);
	wc.style = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc = WndProc;
	wc.hInstance = hInst;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
	wc.lpszClassName = DictionaryManagerClass;
	RegisterClassExW(&wc);

#ifdef _DEBUG
	hWnd = CreateWindowW(DictionaryManagerClass, TextServiceDesc,
		WS_OVERLAPPEDWINDOW, 0, 0, 600, 800, NULL, NULL, hInst, NULL);
#else
	hWnd = CreateWindowW(DictionaryManagerClass, TextServiceDesc,
		WS_POPUP, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
#endif

	if(!hWnd)
	{
		UninitLua();
		WSACleanup();
		return 0;
	}

#ifdef _DEBUG
	ShowWindow(hWnd, SW_MINIMIZE);
#else
	ShowWindow(hWnd, SW_HIDE);
#endif
	UpdateWindow(hWnd);

	while(GetMessageW(&msg, NULL, 0, 0))
	{
		if(!TranslateAcceleratorW(msg.hwnd, NULL, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessageW(&msg);
		}
	}

	UninitLua();
	WSACleanup();

	return (int) msg.wParam;
}