Example #1
0
// Launch ErrorReporter Application
LONG minidump_launcherrorreporter(LPCTSTR pszDumpFile)
{
	LONG lReturnVal = EXCEPTION_CONTINUE_SEARCH;
	TCHAR szModuleName[MAX_PATH];
	TCHAR szCommandLine[MAX_PATH];
	TCHAR szCrashReportExe[MAX_PATH];

	ZeroMemory(szModuleName, sizeof(szModuleName));
	if (GetModuleFileName(0, szModuleName, _countof(szModuleName) - sizeof(TCHAR)) <= 0)
		lstrcpy(szModuleName, _T("Unknown"));

	TCHAR *pszFilePart = lstrrchr(szModuleName, _T('\\'));
	if (pszFilePart)
		pszFilePart++;
	else
		pszFilePart = (TCHAR *)szModuleName;

	lstrcpy(pszFilePart, "ErrorReporter.exe");
	ZeroMemory(szCrashReportExe, sizeof(szCrashReportExe));
	lstrcpy(szCrashReportExe, szModuleName);

	// Append dump file name wrapped with quotes
	lstrcat(szCommandLine, _T(" \""));
	if (FALSE == IsBadStringPtr(pszDumpFile, MAX_PATH))
		lstrcat(szCommandLine, pszDumpFile);
	else
		lstrcat(szCommandLine, MINIDUMP_FILE);
	lstrcat(szCommandLine, _T("\""));

	STARTUPINFO si;
	ZeroMemory(&si, sizeof(si));
	si.cb = sizeof(si);
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_SHOW;

	PROCESS_INFORMATION pi;
	ZeroMemory(&pi, sizeof(pi));
	if (CreateProcess(
		szCrashReportExe,		// name of executable module
		szCommandLine,			// command line string
		NULL,					// process attributes
		NULL,					// thread attributes
		FALSE,					// handle inheritance option
		0,						// creation flags
		NULL,					// new environment block
		NULL,					// current directory name
		&si,					// startup information
		&pi))					// process information
	{
		// CrashReport.exe was successfully started, so
		// suppress the standard crash dialog
		lReturnVal =  EXCEPTION_EXECUTE_HANDLER;
	}
	else
	{
		// CrashReport.exe was not started - let
		// the standard crash dialog appear
		lReturnVal = EXCEPTION_CONTINUE_SEARCH;
	}
	return lReturnVal;
}
Example #2
0
void LoadPreferences()
{
  /* Set preferences */
#ifndef WCE_PREFERENCES
  int size;

  /* make ini file name based on executable file name */
  lstrcpy(squeakIniName, vmName);
  size = lstrlen(squeakIniName);
  lstrcpy(squeakIniName + (size-3), TEXT("ini"));

  /* get image file name from ini file */
  size = GetPrivateProfileString(U_GLOBAL, TEXT("ImageFile"), 
			 TEXT(""), imageName, MAX_PATH, squeakIniName);
  if(size > 0) {
    if( !(imageName[0] == '\\' && imageName[1] == '\\') && !(imageName[1] == ':' && imageName[2] == '\\')) {
      /* make the path relative to VM directory */
      lstrcpy(imageName, vmName);
      (lstrrchr(imageName,U_BACKSLASH[0]))[1] = 0;
      size = lstrlen(imageName);
      size = GetPrivateProfileString(U_GLOBAL, TEXT("ImageFile"), 
			 TEXT(""), imageName + size, MAX_PATH - size, squeakIniName);
	}
  }

  /* get window title from ini file */
  GetPrivateProfileString(U_GLOBAL, TEXT("WindowTitle"), 
			 TEXT(""), windowTitle, MAX_PATH, squeakIniName);

  /* get the window class name from the ini file */
  GetPrivateProfileString(U_GLOBAL, TEXT("WindowClassName"), 
			  TEXT("SqueakWindowClass"), windowClassName, 
			  MAX_PATH, squeakIniName);
  fRunSingleApp =
    GetPrivateProfileInt(U_GLOBAL, TEXT("RunSingleApp"),
			 fRunSingleApp, squeakIniName);
  fDeferredUpdate = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("DeferUpdate"), 
			 fDeferredUpdate,squeakIniName);
  fShowConsole = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("ShowConsole"),
			 fShowConsole,squeakIniName);
  fDynamicConsole = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("DynamicConsole"),
			 fDynamicConsole,squeakIniName);
  fReduceCPUUsage = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("ReduceCPUUsage"),
			 fReduceCPUUsage,squeakIniName);
  fReduceCPUInBackground = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("ReduceCPUInBackground"),
			 fReduceCPUInBackground,squeakIniName);
  f1ButtonMouse   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("1ButtonMouse"),
			 f1ButtonMouse,squeakIniName);
  f3ButtonMouse   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("3ButtonMouse"),
			 f3ButtonMouse,squeakIniName);

  fPriorityBoost   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("PriorityBoost"),
			 fPriorityBoost,squeakIniName);

  fUseDirectSound   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("UseDirectSound"),
			 fUseDirectSound,squeakIniName);
  fUseOpenGL   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("B3DXUsesOpenGL"),
			 fUseOpenGL,squeakIniName);
  caseSensitiveFileMode   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("CaseSensitiveFileMode"),
			 caseSensitiveFileMode,squeakIniName);
  fEnableAltF4Quit   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("EnableAltF4Quit"),
			 fEnableAltF4Quit,squeakIniName);

  fEnableF2Menu   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("EnableF2Menu"),
			 fEnableF2Menu,squeakIniName);

  fEnablePrefsMenu   = 
    GetPrivateProfileInt(U_GLOBAL,TEXT("EnablePrefsMenu"),
			 fEnablePrefsMenu,squeakIniName);
# if STACKVM
  { sqInt nStackPagesPref;
    nStackPagesPref = GetPrivateProfileInt(U_GLOBAL,TEXT("SqueakNumStackPages"),0,squeakIniName);
    if (nStackPagesPref) {
		extern sqInt desiredNumStackPages;
		desiredNumStackPages = nStackPagesPref;
	}
  }
  { sqInt nEdenBytesPref;
    nEdenBytesPref = GetPrivateProfileInt(U_GLOBAL,TEXT("SqueakEdenBytes"),0,squeakIniName);
    if (nEdenBytesPref) {
		extern sqInt desiredEdenBytes;
		desiredEdenBytes = nEdenBytesPref;
	}
  }
# endif
#endif
}