bool ZmdUpdaterCore::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: catalogData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 1: identityData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 2: catalogSubData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 3: serviceData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 4: updateData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 5: patchData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 6: lockData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 7: infoData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 8: faultData((int)static_QUType_int.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QVariant&)static_QUType_QVariant.get(_o+3)); break;
    case 9: transactData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 10: timerSlot(); break;
    case 11: timerData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    case 12: abortData((const QValueList<QVariant>&)*((const QValueList<QVariant>*)static_QUType_ptr.get(_o+1)),(const QVariant&)static_QUType_QVariant.get(_o+2)); break;
    default:
	return QObject::qt_invoke( _id, _o );
    }
    return TRUE;
}
Example #2
0
//-----------------------------------------------------------------------------
MemPanel::MemPanel(QWidget *parent) : QWidget(parent)
{
	QHBoxLayout *h;
	QVBoxLayout *v;
	QToolButton *b;

	infoDlg = new InfoDialog(this);
	infoDlg->setModal(true);	infoDlg->allowRefresh=false;

	v = new QVBoxLayout(this);	h = new QHBoxLayout();	v->addLayout(h);
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/document-new.png"));
	b->setToolTip(tr("Create new data array"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(newTable()));
	b = new QToolButton(this);	b->setIcon(QPixmap(table_xpm));
	b->setToolTip(tr("Edit selected data array"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(editData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/edit-delete.png"));
	b->setToolTip(tr("Delete selected data array"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(delData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(preview_xpm));
	b->setToolTip(tr("Properties of selected data array"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(infoData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/view-refresh.png"));
	b->setToolTip(tr("Update list of data arrays"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(refresh()));
	h->addStretch(1);
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/edit-clear.png"));
	b->setToolTip(tr("Delete ALL data arrays"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(delAllData()));

	colSort = 0;
	tab = new QTableWidget(this);	tab->setColumnCount(3);	v->addWidget(tab);
	QStringList sl;	sl<<tr("Name")<<tr("Sizes")<<tr("Memory");
	tab->setHorizontalHeaderLabels(sl);
	connect(tab, SIGNAL(cellClicked(int,int)), this, SLOT(tableClicked(int,int)));
	connect(tab, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(tableDClicked(int,int)));

	setWindowTitle(tr("Memory"));
}
Example #3
0
bool PrintFile(const WCHAR *fileName, const WCHAR *printerName, bool displayErrors, const WCHAR *settings)
{
    if (!HasPermission(Perm_PrinterAccess))
        return false;

    ScopedMem<WCHAR> fileName2(path::Normalize(fileName));
    BaseEngine *engine = EngineManager::CreateEngine(!gUseEbookUI, fileName2);
    if (!engine || !engine->AllowsPrinting()) {
        if (displayErrors)
            MessageBox(NULL, _TR("Cannot print this file"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0));
        return false;
    }

    HANDLE printer;
    bool ok = OpenPrinter((WCHAR *)printerName, &printer, NULL);
    if (!ok) {
        if (displayErrors)
            MessageBox(NULL, _TR("Printer with given name doesn't exist"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0));
        return false;
    }

    // get printer driver information
    DWORD needed = 0;
    GetPrinter(printer, 2, NULL, 0, &needed);
    ScopedMem<PRINTER_INFO_2> infoData((PRINTER_INFO_2 *)AllocArray<BYTE>(needed));
    if (infoData)
        ok = GetPrinter(printer, 2, (LPBYTE)infoData.Get(), needed, &needed);
    if (!ok || !infoData || needed <= sizeof(PRINTER_INFO_2)) goto Exit;

    LONG structSize = DocumentProperties(NULL,
        printer,                /* Handle to our printer. */
        (WCHAR *)printerName,   /* Name of the printer. */ 
        NULL,                   /* Asking for size, so */
        NULL,                   /* these are not used. */
        0);                     /* Zero returns buffer size. */
    if (structSize < sizeof(DEVMODE)) {
        // If failure, inform the user, cleanup and return failure.
        if (displayErrors)
            MessageBox(NULL, _TR("Could not obtain Printer properties"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0));
        goto Exit;
    }
    LPDEVMODE devMode = (LPDEVMODE)malloc(structSize);
    if (!devMode) goto Exit;

    // Get the default DevMode for the printer and modify it for your needs.
    LONG returnCode = DocumentProperties(NULL,
        printer,
        (WCHAR *)printerName,
        devMode,        /* The address of the buffer to fill. */
        NULL,           /* Not using the input buffer. */
        DM_OUT_BUFFER); /* Have the output buffer filled. */
    if (IDOK != returnCode) {
        // If failure, inform the user, cleanup and return failure.
        if (displayErrors)
            MessageBox(NULL, _TR("Could not obtain Printer properties"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0));
        goto Exit;
    }

    ClosePrinter(printer);
    printer = NULL;

    {
        Print_Advanced_Data advanced;
        Vec<PRINTPAGERANGE> ranges;
        ApplyPrintSettings(settings, engine->PageCount(), ranges, advanced);

        PrintData pd(engine, infoData, devMode, ranges, advanced);
        ok = PrintToDevice(pd);
        if (!ok && displayErrors)
            MessageBox(NULL, _TR("Couldn't initialize printer"), _TR("Printing problem."),
                MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0));
    }

Exit:
    free(devMode);
    if (printer)
        ClosePrinter(printer);
    delete engine;
    return ok;
}
Example #4
0
static void infoEntity (pScene sc, pMesh mesh, int k, int type) {
	pMaterial pm;
	pTriangle pt;
	pTetra ptt;
	pHexa ph;
	pQuad pq;
	pPoint p0;
	int i;

	if (mesh->ne) fprintf(stdout, "\n Picking result :\n");

	pm = &sc->material[refmat];

	switch (type) {
	case LPoint:
		p0 = &mesh->point[k];
		if (mesh->ne)
			fprintf(stdout, "  Vertex %5d : %f, %f, %f    ref : %d\n",
			        k, p0->c[0] + mesh->xtra, p0->c[1] + mesh->ytra, p0->c[2] + mesh->ztra, p0->ref);

		if (mesh->nbb && mesh->typage == 2) infoData(sc, mesh, k, LPoint);

		break;

	case LTria:
		pt = &mesh->tria[k];
		fprintf(stdout, "  Triangle %5d : %d, %d, %d    ref : %d [%s]\n",
		        k, pt->v[0], pt->v[1], pt->v[2], pt->ref, pm->name);
		if (mesh->nbb && mesh->typage == 1) infoData(sc, mesh, k, LTria);

		for (i = 0; i < 3; i++) {
			p0 = &mesh->point[pt->v[i]];
			fprintf(stdout, "  vertex   %5d : %f %f %f   ref %d\n",
			        pt->v[i], p0->c[0] + mesh->xtra, p0->c[1] + mesh->ytra, p0->c[2] + mesh->ztra, p0->ref);
			if (mesh->nbb && mesh->typage == 2) infoData(sc, mesh, pt->v[i], LPoint);
		}

		break;

	case LQuad:
		pq = &mesh->quad[k];
		fprintf(stdout, "  Quad  %5d : %d, %d, %d, %d    ref : %d [%s]\n",
		        k, pq->v[0], pq->v[1], pq->v[2], pq->v[3], pq->ref, pm->name);
		if (mesh->nbb && mesh->typage == 1) infoData(sc, mesh, k, LQuad);

		for (i = 0; i < 4; i++) {
			p0 = &mesh->point[pq->v[i]];
			fprintf(stdout, "  vertex   %5d : %f %f %f   ref %d\n",
			        pq->v[i], p0->c[0] + mesh->xtra, p0->c[1] + mesh->ytra, p0->c[2] + mesh->ztra, p0->ref);
			if (mesh->nbb && mesh->typage == 2) infoData(sc, mesh, pq->v[i], LPoint);
		}

		break;

	case LTets:
		ptt = &mesh->tetra[k];
		fprintf(stdout, "  Tetra  %5d : %d, %d, %d, %d    ref : %d [%s]\n",
		        k, ptt->v[0], ptt->v[1], ptt->v[2], ptt->v[3], ptt->ref, pm->name);
		if (mesh->nbb && mesh->typage == 1) infoData(sc, mesh, k, LTets);

		for (i = 0; i < 4; i++) {
			p0 = &mesh->point[ptt->v[i]];
			fprintf(stdout, "  vertex   %5d : %f %f %f   ref %d\n",
			        ptt->v[i], p0->c[0] + mesh->xtra, p0->c[1] + mesh->ytra, p0->c[2] + mesh->ztra, p0->ref);
			if (mesh->nbb && mesh->typage == 2) infoData(sc, mesh, ptt->v[i], LPoint);
		}

		break;

	case LHexa:
		ph = &mesh->hexa[k];
		fprintf(stdout, "  Hexa   %5d : %d, %d, %d, %d, %d, %d, %d, %d    ref : %d [%s]\n",
		        k, ph->v[0], ph->v[1], ph->v[2], ph->v[3], ph->v[4], ph->v[5],
		        ph->v[6], ph->v[7], ph->ref, pm->name);
		if (mesh->nbb && mesh->typage == 1) infoData(sc, mesh, k, LHexa);

		for (i = 0; i < 8; i++) {
			p0 = &mesh->point[ph->v[i]];
			fprintf(stdout, "  vertex   %5d : %f %f %f   ref %d\n",
			        ph->v[i], p0->c[0] + mesh->xtra, p0->c[1] + mesh->ytra, p0->c[2] + mesh->ztra, p0->ref);
			if (mesh->nbb && mesh->typage == 2) infoData(sc, mesh, ph->v[i], LPoint);
		}

		break;
	}

	fflush(stdout);	/* add J. Morice 12/2008 */
}
Example #5
0
bool PrintFile(BaseEngine *engine, WCHAR *printerName, bool displayErrors, const WCHAR *settings)
{
    bool ok = false;
    if (!HasPermission(Perm_PrinterAccess))
        return false;

#ifndef DISABLE_DOCUMENT_RESTRICTIONS
    if (engine && !engine->AllowsPrinting())
        engine = NULL;
#endif
    if (!engine) {
        if (displayErrors)
            MessageBoxWarning(NULL, _TR("Cannot print this file"), _TR("Printing problem."));
        return false;
    }

    ScopedMem<WCHAR> defaultPrinter;
    if (!printerName) {
        defaultPrinter.Set(GetDefaultPrinterName());
        printerName = defaultPrinter;
    }

    HANDLE printer;
    BOOL res = OpenPrinter(printerName, &printer, NULL);
    if (!res) {
        if (displayErrors)
            MessageBoxWarning(NULL, _TR("Printer with given name doesn't exist"), _TR("Printing problem."));
        return false;
    }

    LPDEVMODE devMode = NULL;
    // get printer driver information
    DWORD needed = 0;
    GetPrinter(printer, 2, NULL, 0, &needed);
    ScopedMem<PRINTER_INFO_2> infoData((PRINTER_INFO_2 *)AllocArray<BYTE>(needed));
    if (infoData)
        res = GetPrinter(printer, 2, (LPBYTE)infoData.Get(), needed, &needed);
    if (!res || !infoData || needed <= sizeof(PRINTER_INFO_2))
        goto Exit;

    LONG structSize = DocumentProperties(NULL,
        printer,
        printerName,
        NULL,                   /* Asking for size, so */
        NULL,                   /* not used. */
        0);                     /* Zero returns buffer size. */
    if (structSize < sizeof(DEVMODE)) {
        // If failure, inform the user, cleanup and return failure.
        if (displayErrors)
            MessageBoxWarning(NULL, _TR("Could not obtain Printer properties"), _TR("Printing problem."));
        goto Exit;
    }
    devMode = (LPDEVMODE)malloc(structSize);
    if (!devMode)
        goto Exit;

    // Get the default DevMode for the printer and modify it for your needs.
    LONG returnCode = DocumentProperties(NULL,
        printer,
        printerName,
        devMode,        /* The address of the buffer to fill. */
        NULL,           /* Not using the input buffer. */
        DM_OUT_BUFFER); /* Have the output buffer filled. */
    if (IDOK != returnCode) {
        // If failure, inform the user, cleanup and return failure.
        if (displayErrors)
            MessageBoxWarning(NULL, _TR("Could not obtain Printer properties"), _TR("Printing problem."));
        goto Exit;
    }

    ClosePrinter(printer);
    printer = NULL;

    {
        Print_Advanced_Data advanced;
        Vec<PRINTPAGERANGE> ranges;
        ApplyPrintSettings(settings, engine->PageCount(), ranges, advanced, devMode);

        PrintData pd(engine, infoData, devMode, ranges, advanced);
        ok = PrintToDevice(pd);
        if (!ok && displayErrors)
            MessageBoxWarning(NULL, _TR("Couldn't initialize printer"), _TR("Printing problem."));
    }

Exit:
    free(devMode);
    if (printer)
        ClosePrinter(printer);
    return ok;
}
static NTSTATUS NTAPI
patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle)
{
  // We have UCS2 (UTF16?), we want ASCII, but we also just want the filename portion
#define DLLNAME_MAX 128
  char dllName[DLLNAME_MAX+1];
  wchar_t *dll_part;
  DllBlockInfo *info;

  int len = moduleFileName->Length / 2;
  wchar_t *fname = moduleFileName->Buffer;

  // The filename isn't guaranteed to be null terminated, but in practice
  // it always will be; ensure that this is so, and bail if not.
  // This is done instead of the more robust approach because of bug 527122,
  // where lots of weird things were happening when we tried to make a copy.
  if (moduleFileName->MaximumLength < moduleFileName->Length+2 ||
      fname[len] != 0)
  {
#ifdef DEBUG
    printf_stderr("LdrLoadDll: non-null terminated string found!\n");
#endif
    goto continue_loading;
  }

  dll_part = wcsrchr(fname, L'\\');
  if (dll_part) {
    dll_part = dll_part + 1;
    len -= dll_part - fname;
  } else {
    dll_part = fname;
  }

#ifdef DEBUG_very_verbose
  printf_stderr("LdrLoadDll: dll_part '%S' %d\n", dll_part, len);
#endif

  // if it's too long, then, we assume we won't want to block it,
  // since DLLNAME_MAX should be at least long enough to hold the longest
  // entry in our blocklist.
  if (len > DLLNAME_MAX) {
#ifdef DEBUG
    printf_stderr("LdrLoadDll: len too long! %d\n", len);
#endif
    goto continue_loading;
  }

  // copy over to our char byte buffer, lowercasing ASCII as we go
  for (int i = 0; i < len; i++) {
    wchar_t c = dll_part[i];

    if (c > 0x7f) {
      // welp, it's not ascii; if we need to add non-ascii things to
      // our blocklist, we'll have to remove this limitation.
      goto continue_loading;
    }

    // ensure that dll name is all lowercase
    if (c >= 'A' && c <= 'Z')
      c += 'a' - 'A';

    dllName[i] = (char) c;
  }

  dllName[len] = 0;

#ifdef DEBUG_very_verbose
  printf_stderr("LdrLoadDll: dll name '%s'\n", dllName);
#endif

  // then compare to everything on the blocklist
  info = &sWindowsDllBlocklist[0];
  while (info->name) {
    if (strcmp(info->name, dllName) == 0)
      break;

    info++;
  }

  if (info->name) {
    bool load_ok = false;

#ifdef DEBUG_very_verbose
    printf_stderr("LdrLoadDll: info->name: '%s'\n", info->name);
#endif

    if (info->maxVersion != ALL_VERSIONS) {
      // figure out the length of the string that we need
      DWORD pathlen = SearchPathW(filePath, fname, L".dll", 0, NULL, NULL);
      if (pathlen == 0) {
        // uh, we couldn't find the DLL at all, so...
        printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName);
        return STATUS_DLL_NOT_FOUND;
      }

      wchar_t *full_fname = (wchar_t*) malloc(sizeof(wchar_t)*(pathlen+1));
      if (!full_fname) {
        // couldn't allocate memory?
        return STATUS_DLL_NOT_FOUND;
      }

      // now actually grab it
      SearchPathW(filePath, fname, L".dll", pathlen+1, full_fname, NULL);

      DWORD zero;
      DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero);

      // If we failed to get the version information, we block.

      if (infoSize != 0) {
        nsAutoArrayPtr<unsigned char> infoData(new unsigned char[infoSize]);
        VS_FIXEDFILEINFO *vInfo;
        UINT vInfoLen;

        if (GetFileVersionInfoW(full_fname, 0, infoSize, infoData) &&
            VerQueryValueW(infoData, L"\\", (LPVOID*) &vInfo, &vInfoLen))
        {
          unsigned long long fVersion =
            ((unsigned long long)vInfo->dwFileVersionMS) << 32 |
            ((unsigned long long)vInfo->dwFileVersionLS);

          // finally do the version check, and if it's greater than our block
          // version, keep loading
          if (fVersion > info->maxVersion)
            load_ok = true;
        }
      }

      free(full_fname);
    }

    if (!load_ok) {
      printf_stderr("LdrLoadDll: Blocking load of '%s' -- see http://www.mozilla.com/en-US/blocklist/\n", dllName);
      return STATUS_DLL_NOT_FOUND;
    }
  }

continue_loading:
#ifdef DEBUG_very_verbose
  printf_stderr("LdrLoadDll: continuing load... ('%S')\n", moduleFileName->Buffer);
#endif

  NS_SetHasLoadedNewDLLs();

  return stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
}