コード例 #1
0
ファイル: boot.c プロジェクト: fmccabe/l-and-o
void bootstrap(char * entry, char * bootPkg, char * version) {
  char errorMsg[MAX_MSG_LEN];

  defineExitProg();
  defineDieProg();
//  defineTrapProg();
//  defineObjectProg(kmain);
  defineResumeProgs();                  /* define the resume entry points */

  ptrI mainThread = newThread();

  processPo root = rootProcess(mainThread, bootPkg); // We create the root with a early death code - updated later

  switch (loadPackage(bootPkg, version, errorMsg, NumberOf(errorMsg), NULL)) {
    default:
      logMsg(logFile, "corrupt or no boot package found in %s:%s", bootPkg, errorMsg);
      lo_exit(EXIT_FAIL);
      return;
    case Eof:
      logMsg(logFile, "short boot package %s", bootPkg);
      lo_exit(EXIT_FAIL);
      return;
    case Ok: {
      ptrI prog = newProgramLbl(entry, 0);

      if (!IsProgram(prog)) {
        logMsg(logFile, "%U entry point not found", entry);
        lo_exit(EXIT_FAIL);
      } else {
        root->proc.PROG = ProgramOf(prog); /* this is where we establish the program */
        root->proc.PC = FirstInstruction(root->proc.PROG);
        root->proc.thread = kmainThread;

        runGo(root);
      }
    }
  }
}
コード例 #2
0
ファイル: gl3.cpp プロジェクト: arnochiu/OpenGLES-sim
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program)
{
	CONTEXT_EXEC_RETURN(IsProgram(program));
}
コード例 #3
0
ファイル: Startup.cpp プロジェクト: hibive/sjmt6410pm090728
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	HANDLE hEtc = INVALID_HANDLE_VALUE;
	BOOL bIsMassStorage = FALSE;
	TCHAR szProgram[MAX_PATH] = {0,};
	BOOL bDispUpdate = FALSE;

	hEtc = CreateFile(ETC_DRIVER_NAME,
			GENERIC_READ | GENERIC_WRITE,
			FILE_SHARE_READ | FILE_SHARE_WRITE,
			NULL, OPEN_EXISTING, 0, 0);
	if (INVALID_HANDLE_VALUE != hEtc)
		CheckWifiMacAddress(hEtc);

	bIsMassStorage = (1 == ufnGetCurrentClientName()) ? TRUE : FALSE;
	if (bIsMassStorage)
	{
		ufnChangeCurrentClient(0);	// Serial_Class
		Sleep(1000);
		ufnChangeCurrentClient(1);	// Mass_Storage_Class
	}

	sndPlaySound(_T("\\Windows\\Startup.wav"), SND_FILENAME | SND_ASYNC);

	if (FALSE == RegOpenCreateStr(OMNIBOOK_REG_KEY, APP_STARTUP_REG_STRING, szProgram, MAX_PATH, FALSE))
	{
		RETAILMSG(1, (_T("RegOpenCreateStr(%s), Default(%s)\r\n"),
			APP_STARTUP_REG_STRING, APP_STARTUP_REG_DEFAULT));
		_tcscpy(szProgram, APP_STARTUP_REG_DEFAULT);
	}
	if (IsProgram(szProgram))
	{
		if (RunProgram(szProgram, NULL, 0))
		{
			RETAILMSG(1, (_T("RunProgram(%s)\r\n"), szProgram));
			bDispUpdate = TRUE;
		}
		else
		{
			RETAILMSG(1, (_T("ERROR : RunProgram(%s)\r\n"), szProgram));
		}
	}
	if (FALSE == bDispUpdate)
	{
		HDC hDC = GetDC(HWND_DESKTOP);
		DirtyRectUpdate(hDC);
		InvalidateRect(HWND_DESKTOP, NULL, TRUE);
		ReleaseDC(HWND_DESKTOP, hDC);

		if (FALSE == RegOpenCreateStr(OMNIBOOK_REG_KEY, APP_UPDATE_REG_STRING, szProgram, MAX_PATH, FALSE))
		{
			RETAILMSG(1, (_T("RegOpenCreateStr(%s), Default(%s)\r\n"),
				APP_UPDATE_REG_STRING, APP_UPDATE_REG_DEFAULT));
			_tcscpy(szProgram, APP_UPDATE_REG_DEFAULT);
		}
		if (IsProgram(szProgram))
		{
			if (RunProgram(szProgram, NULL, 0))
				RETAILMSG(1, (_T("RunProgram(%s)\r\n"), szProgram));
			else
				RETAILMSG(1, (_T("ERROR : RunProgram(%s)\r\n"), szProgram));
		}
		else
		{
			RETAILMSG(1, (_T("ERROR : Not Found - %s\r\n"), szProgram));
		}
	}

	if (FALSE == RegOpenCreateStr(OMNIBOOK_REG_KEY, APP_SIPSYMBOL_REG_STRING, szProgram, MAX_PATH, FALSE))
	{
		RETAILMSG(1, (_T("RegOpenCreateStr(%s), Default(%s)\r\n"),
			APP_SIPSYMBOL_REG_STRING, APP_SIPSYMBOL_REG_DEFAULT));
		_tcscpy(szProgram, APP_SIPSYMBOL_REG_DEFAULT);
	}
	if (IsProgram(szProgram))
	{
		RunProgram(szProgram, NULL, 0);
		RETAILMSG(1, (_T("RunProgram : %s\r\n"), szProgram));
	}
	else
	{
		RETAILMSG(1, (_T("ERROR : Not Found - %s\r\n"), szProgram));
	}

	HDC hDC = GetDC(HWND_DESKTOP);
	BOOL bDirtyRect = (BOOL)ExtEscape(hDC, DRVESC_GET_DIRTYRECT, 0, NULL, 0, NULL);
	for (int i=0; (FALSE==bDirtyRect && i<5); i++)
	{
		Sleep(1000);
		bDirtyRect = (BOOL)ExtEscape(hDC, DRVESC_GET_DIRTYRECT, 0, NULL, 0, NULL);
		if (bIsMassStorage)
			bDirtyRect = DeviceIoControl(hEtc, IOCTL_IS_ATTACH_UFN, NULL, 0, NULL, 0, NULL, NULL);
	}
	if (FALSE == bDirtyRect)
		DirtyRectUpdate(hDC);
	ReleaseDC(HWND_DESKTOP, hDC);

	HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("PowerManager/ReloadActivityTimeouts"));
	if (hEvent)
	{
		SetEvent(hEvent);
		CloseHandle(hEvent);
		RETAILMSG(0, (_T("SetEvent(PowerManager/ReloadActivityTimeouts)\r\n")));
	}

	if (INVALID_HANDLE_VALUE != hEtc)
	{
		DeviceIoControl(hEtc, IOCTL_SET_POWER_WLAN, NULL, FALSE, NULL, 0, NULL, NULL);
		CloseHandle(hEtc);
	}

	return 0;
}