コード例 #1
0
/*++
  Function: OnInitDialog

  Parameters: none

  Purpose: initializes About dialog

  Returns: none
--*/
BOOL CAboutDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	m_appName.SetWindowTextW(GetVersionInfo(_T("ProductName")));
	m_appVersion.SetWindowTextW(GetVersionInfo(_T("FileVersion")));
	m_copyright.SetWindowTextW(GetVersionInfo(_T("LegalCopyright")));
	m_acknowledgements.SetBold(TRUE, FALSE);
	m_acknowledgements.SetFont(_T("Arial"), 16, FALSE);	// set font last, or it won't be used because font is recreated each SetXXX() call

	m_BsdLicenseLink.SetURL(_T("http://opensource.org/licenses/bsd-license.php"));
	m_ack1Link.SetURL(_T("http://www.mimec.org/components/mfc"));
	m_ack1LicenseLink.SetURL(_T("http://doc.mimec.org/articles/mfc/mctree/index.html"));
	m_ack2Link.SetURL(_T("http://www.codeproject.com/Articles/1657/EasySize-Dialog-resizing-in-no-time"));
	m_ack2LicenseLink.SetURL(_T("http://www.codeproject.com/info/EULA.aspx"));
	m_ack3Link.SetURL(_T("http://www.codeproject.com/Articles/29016/XGroupBox-an-MFC-groupbox-control-to-display-text"));
	m_ack3LicenseLink.SetURL(_T("http://www.codeproject.com/info/EULA.aspx"));
	m_ack4Link.SetURL(_T("http://www.codeproject.com/Articles/5242/XColorStatic-a-colorizing-static-control"));
	m_ack4LicenseLink.SetURL(_T("http://www.codeproject.com/info/EULA.aspx"));
	m_ack5Link.SetURL(_T("http://www.codeproject.com/KB/miscctrl/XProgressWnd.aspx"));
	m_ack5LicenseLink.SetURL(_T("http://www.codeproject.com/info/EULA.aspx"));
	m_ack6Link.SetURL(_T("http://msdn.microsoft.com/en-us/library/windows/desktop/ms646985%28v=vs.85%29.aspx"));
	m_ack6LicenseLink.SetURL(_T("http://msdn.microsoft.com/en-us/cc300389.aspx#D"));

	return TRUE;  // return TRUE unless you set the focus to a control
}
コード例 #2
0
ファイル: version.cpp プロジェクト: kryptBlue/WinMerge
/**
 * @brief Constructor for asking version infor when language is known.
 * This constructor creates instance which gets version-info matching
 * given language-ID. There can be several different language-codepage
 * combinations, but we use first version info block that matches the
 * given language. So even if codepage isn't correct, we get correct
 * version information.
 * @param [in] wLanguage Language-ID for which the version info is wanted.
 */
CVersionInfo::CVersionInfo(WORD wLanguage)
    : m_wLanguage(wLanguage)
    , m_bVersionOnly(FALSE)
    , m_bDllVersion(FALSE)
{
    GetVersionInfo();
}
コード例 #3
0
ファイル: SysInfo.cpp プロジェクト: 280185386/ChakraCore
//
// Returns the major and minor version of the loaded binary. If the version info has been fetched once, it will be cached
// and returned without any system calls to find the version number.
//
HRESULT AutoSystemInfo::GetJscriptFileVersion(DWORD* majorVersion, DWORD* minorVersion, DWORD *buildDateHash, DWORD *buildTimeHash)
{
    HRESULT hr = E_FAIL;
    if(AutoSystemInfo::Data.majorVersion == 0 && AutoSystemInfo::Data.minorVersion == 0)
    {
        // uninitialized state  - call the system API to get the version info.
        LPCWSTR jscriptDllName = GetJscriptDllFileName();
        hr = GetVersionInfo(jscriptDllName, majorVersion, minorVersion);

        AutoSystemInfo::Data.majorVersion = *majorVersion;
        AutoSystemInfo::Data.minorVersion = *minorVersion;
    }
    else if(AutoSystemInfo::Data.majorVersion != INVALID_VERSION)
    {
        // if the cached copy is valid, use it and return S_OK.
        *majorVersion = AutoSystemInfo::Data.majorVersion;
        *minorVersion = AutoSystemInfo::Data.minorVersion;
        hr = S_OK;
    }

    if (buildDateHash)
    {
        *buildDateHash = AutoSystemInfo::Data.buildDateHash;
    }

    if (buildTimeHash)
    {
        *buildTimeHash = AutoSystemInfo::Data.buildTimeHash;
    }
    return hr;
}
コード例 #4
0
ファイル: version.cpp プロジェクト: kryptBlue/WinMerge
/**
 * @brief Constructor for asking only numeric version info.
 * This constructor creates instance that only reads version numbers,
 * not several strings there are. This saves some time.
 * @param [in] bVersionOnly If TRUE only version numbers are read.
 */
CVersionInfo::CVersionInfo(BOOL bVersionOnly)
    : m_wLanguage(0)
    , m_bVersionOnly(bVersionOnly)
    , m_bDllVersion(FALSE)
{
    GetVersionInfo();
}
コード例 #5
0
std::string UpdateFieldDumper::FormatVersion(std::string const& partSeparator) const
{
    FileVersionInfo const& version = GetVersionInfo();
    std::ostringstream str;
    str << version.FileMajorPart << partSeparator << version.FileMinorPart << partSeparator
        << version.FileBuildPart << partSeparator << version.FilePrivatePart;

    return str.str();
}
コード例 #6
0
ファイル: version.cpp プロジェクト: kryptBlue/WinMerge
/**
 * @brief Constructor for asking version number from known module.
 * @param [in] hModule Handle to module for version info.
 */
CVersionInfo::CVersionInfo(HINSTANCE hModule)
    : m_wLanguage(0)
    , m_bVersionOnly(FALSE)
    , m_bDllVersion(FALSE)
{
    TCHAR szFileName[MAX_PATH];
    GetModuleFileName(hModule, szFileName, MAX_PATH);
    m_strFileName = szFileName;
    GetVersionInfo();
}
コード例 #7
0
ファイル: version.cpp プロジェクト: kryptBlue/WinMerge
/**
 * @brief Constructor.
 * @param [in] szFileToVersion Filename to read version from.
 * @param [in] bDllVersion If TRUE queries DLL version.
 */
CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion,
                           BOOL bDllVersion)
    : m_wLanguage(0)
    , m_bVersionOnly(FALSE)
    , m_bDllVersion(bDllVersion)
{
    if (szFileToVersion != NULL)
        m_strFileName = szFileToVersion;
    GetVersionInfo();
}
コード例 #8
0
ファイル: verinfo.cpp プロジェクト: 3rdexp/jezzitest
BOOL CFileVersionInfo::Open( IN LPCTSTR lpszFileName )
{
	if( lpszFileName == NULL )
		ASSERT_RETURN( FALSE );

	Close();
	if( !GetVersionInfo( lpszFileName ) || !QueryVersionTrans() )
		Close();

	return m_bValid;
};
コード例 #9
0
/******************************************************************
 * misc init
 *****************************************************************/
void init_a210_misc(void)
{
	DEBUGMSGTL((MODULE_NAME, "%s()\n", __FUNCTION__));
	REGISTER_MIB(
				MODULE_NAME,
				a210_misc_variables,
				variable2,
				a210_misc_variables_oid
				);
	GetVersionInfo();
}
コード例 #10
0
ファイル: CrashHandler.c プロジェクト: DisAsmCompany/DisAsm
void InfoModules()
{
	ModuleInfo * modules = NULL;
	uint32_t count = ModuleEnum(&modules);
	uint32_t i;
	ConsoleIOPrint("Modules : \n");
	for (i = 0; i < count; ++i)
	{
		VersionInfo info;
		GetVersionInfo(modules[i].path, &info);
		ConsoleIOPrintFormatted("%s, %s, %s, %s\n", modules[i].path, info.FileDescription, info.CompanyName, info.ProductVersion);
	}
	free(modules);
}
コード例 #11
0
ファイル: version.cpp プロジェクト: kryptBlue/WinMerge
/**
 * @brief Constructor.
 * @param [in] szFileToVersion Filename to read version from.
 * @param [in] szLanguage Language for version.
 * @param [in] szCodePage Codepage for version.
 */
CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion /* = NULL*/,
                           LPCTSTR szLanguage /* = NULL*/,
                           LPCTSTR szCodepage /* = NULL*/)
    : m_wLanguage(0)
    , m_bVersionOnly(FALSE)
    , m_bDllVersion(FALSE)
{
    if (szFileToVersion != NULL)
        m_strFileName = szFileToVersion;
    if (szLanguage != NULL)
        m_strLanguage = szLanguage;
    if (szCodepage != NULL)
        m_strCodepage = szCodepage;
    GetVersionInfo();
}
コード例 #12
0
ファイル: dumper.cpp プロジェクト: kmdtukl/miranda-ng
BOOL CALLBACK LoadedModules64(LPCSTR, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext)
{
	CMString& buffer = *(CMString*)UserContext;

	const HMODULE hModule = (HMODULE)ModuleBase;

	TCHAR path[MAX_PATH];
	GetModuleFileName(hModule, path, MAX_PATH);

	buffer.AppendFormat(TEXT("%s  %p - %p"), path, (LPVOID)ModuleBase, (LPVOID)(ModuleBase + ModuleSize));

	GetVersionInfo(hModule, buffer);

	TCHAR timebuf[30] = TEXT("");
	GetLastWriteTime(path, timebuf, 30);

	buffer.AppendFormat(TEXT(" [%s]\r\n"), timebuf);

	return TRUE;
}
コード例 #13
0
ファイル: PageWelcome.cpp プロジェクト: NikTh/ssr
DialogAbout::DialogAbout(PageWelcome* parent)
	: QDialog(parent) {

	setWindowTitle(tr("About SimpleScreenRecorder"));

	QString html_about;
	{
		QFile file(":/about.htm");
		if(file.open(QIODevice::ReadOnly | QIODevice::Text))
			html_about = file.readAll();
	}

	html_about.replace("%MOREINFO%", tr("For more information:"));
	html_about.replace("%SOURCECODE%", tr("The source code of this program can be found at:"));
	html_about.replace("%USES%", tr("This program uses:"));
	html_about.replace("%USES_QT4%", tr("%1 for the graphical user interface").arg("<a href=\"https://qt-project.org/\">Qt 4</a>"));
	html_about.replace("%USES_LIBAV_FFMPEG%", tr("%1 or %2 (depending on your distribution) for video/audio encoding").arg("<a href=\"http://libav.org/\">libav</a>").arg("<a href=\"http://ffmpeg.org/\">ffmpeg</a>"));
	html_about.replace("%USES_ELFHACKS%", tr("%1 for hooking system functions for OpenGL recording").arg("<a href=\"https://github.com/nullkey/elfhacks\">elfhacks</a>"));
	html_about.replace("%VERSION%", PACKAGE_VERSION);
	html_about.replace("%VERSIONINFO%", GetVersionInfo().replace("\n", "<br>\n"));

	QTextBrowser *textbrowser = new QTextBrowser(this);
	textbrowser->setHtml(html_about);
	textbrowser->setOpenExternalLinks(true);
	textbrowser->setMinimumSize(700, 500);

	QPushButton *pushbutton_close = new QPushButton("Close", this);

	connect(pushbutton_close, SIGNAL(clicked()), this, SLOT(accept()));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(textbrowser);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addStretch();
		layout2->addWidget(pushbutton_close);
		layout2->addStretch();
	}

}
コード例 #14
0
ファイル: PageWelcome.cpp プロジェクト: Half-Shot/ssr
DialogAbout::DialogAbout(PageWelcome* parent)
	: QDialog(parent) {

	setWindowTitle("About SimpleScreenRecorder");

	QString html_about;
	{
		QFile file(":/about.htm");
		if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
			html_about = "Error: Can't load about dialog text.";
		} else {
			html_about = file.readAll();
		}
	}

	html_about.replace("%VERSION%", SSR_VERSION);
	html_about.replace("%VERSIONINFO%", GetVersionInfo().replace("\n", "<br>\n"));

	QTextBrowser *textbrowser = new QTextBrowser(this);
	textbrowser->setHtml(html_about);
	textbrowser->setOpenExternalLinks(true);
	textbrowser->setMinimumSize(700, 500);

	QPushButton *pushbutton_close = new QPushButton("Close", this);

	connect(pushbutton_close, SIGNAL(clicked()), this, SLOT(accept()));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(textbrowser);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addStretch();
		layout2->addWidget(pushbutton_close);
		layout2->addStretch();
	}

}
コード例 #15
0
ファイル: DMSHelper.cpp プロジェクト: killbug2004/WSProf
HRESULT DMSHelper::GetLatestVersionInfo(const CStdStringW& sDocID, WSDocumentVersionNoCom &wsDocVersion)
{
	LOG_WS_FUNCTION_SCOPE_MSG(sDocID);

	CStdStringW sLatestVersion;
	HRESULT hRes = GetLatestVersion(sDocID, sLatestVersion);
	if(FAILED(hRes))
	{
		CStdString sErr;
		sErr.Format(L"Failed to get latest version for [%s]", sDocID);
		LOG_WS_ERROR(sErr.c_str());
		return hRes;
	}

	hRes = GetVersionInfo(sLatestVersion, wsDocVersion);
	if(FAILED(hRes))
	{
		CStdString sErr;
		sErr.Format(L"Failed to get latest version for [%s]", sDocID);
		LOG_WS_ERROR(sErr.c_str());
		return hRes;
	}
	return S_OK;
}
コード例 #16
0
/* Extract 'qcom,msm-id' 'qcom,board-id' parameter from DTB
   v1 format:
      qcom,msm-id = <x y z> [, <x2 y2 z2> ...];
   v2 format:
      qcom,msm-id = <x z> [, <x2 z2> ...;
      qcom,board-id = <y y'> [, <y2 y2'> ...;
   Fields:
      x  = chipset
      y  = platform
      y' = subtype
      z  = soc rev
 */
int main(int argc, char **argv)
{
    char buf[COPY_BLK];
    struct chipInfo_t *chip, *t_chip;
    struct dirent *dp;
    FILE *pInputFile;
    char *filename;
    int padding;
    uint8_t *filler = NULL;
    int numBytesRead = 0;
    int totBytesRead = 0;
    int out_fd;
    int flen;
    int rc = RC_SUCCESS;
    int dtb_count = 0, dtb_offset = 0;
    size_t wrote = 0, expected = 0;
    struct stat st;
    uint32_t version = QCDT_VERSION;
    int num;
    uint32_t dtb_size;
    int msmversion = 0;

    log_info("DTB combiner:\n");

    if (parse_commandline(argc, argv) != RC_SUCCESS) {
        print_help();
        return RC_ERROR;
    }

    log_info("  Input directory: '%s'\n", input_dir);
    log_info("  Output file: '%s'\n", output_file);

    DIR *dir = opendir(input_dir);
    if (!dir) {
        log_err("Failed to open input directory '%s'\n", input_dir);
        return RC_ERROR;
    }

    filler = (uint8_t *)malloc(page_size);
    if (!filler) {
        log_err("Out of memory\n");
        closedir(dir);
        return RC_ERROR;
    }
    memset(filler, 0, page_size);

    /* Open the .dtb files in the specified path, decompile and
       extract "qcom,msm-id" parameter
     */
    while ((dp = readdir(dir)) != NULL) {

        flen = strlen(input_dir) + strlen(dp->d_name) + 1;
        filename = (char *)malloc(flen);
        if (!filename) {
            log_err("Out of memory\n");
            rc = RC_ERROR;
            break;
        }
        strncpy(filename, input_dir, flen);
        strncat(filename, dp->d_name, flen);

        if (stat(filename, &st) != 0 || !S_ISREG(st.st_mode)) {
            free(filename);
            continue;
        }

        flen = strlen(dp->d_name);
        if ((flen <= 4) || (strncmp(&dp->d_name[flen-4], ".dtb", 4) != 0)) {
            free(filename);
            continue;
        }

        log_info("Found file: %s ... ", dp->d_name);

        /* To identify the version number */
        msmversion = force_v2 ? GetVersionInfo(filename) : 1;

        num = 1;
        chip = getChipInfo(filename, &num, msmversion);

        if (msmversion == 1) {
            if (!chip) {
                log_err("skip, failed to scan for '%s' tag\n",
                        dt_tag);
                free(filename);
                continue;
            }
        }
        if (msmversion == 2) {
            if (!chip) {
                log_err("skip, failed to scan for '%s' or '%s' tag\n",
                        dt_tag, QCDT_BOARD_TAG);
                free(filename);
                continue;
            }
        }

        if (st.st_size == 0) {
            log_err("skip, failed to get DTB size\n");
            free(filename);
            continue;
        }

        log_info("chipset: %u, rev: %u, platform: %u, subtype: %u\n",
                 chip->chipset, chip->revNum, chip->platform, chip->subtype);

        for (t_chip = chip->t_next; t_chip; t_chip = t_chip->t_next) {
            log_info("   additional chipset: %u, rev: %u, platform: %u, subtype: %u\n",
                     t_chip->chipset, t_chip->revNum, t_chip->platform, t_chip->subtype);
        }

        rc = chip_add(chip);
        if (rc != RC_SUCCESS) {
            log_err("... duplicate info, skipped\n");
            free(filename);
            continue;
        }

        dtb_count++;

        chip->dtb_size = st.st_size +
                           (page_size - (st.st_size % page_size));
        chip->dtb_file = filename;

        for (t_chip = chip->t_next; t_chip; t_chip = t_chip->t_next) {
            rc = chip_add(t_chip);
            if (rc != RC_SUCCESS) {
                log_err("... duplicate info, skipped (chipset %u, rev: %u, platform: %u, subtype %u:\n",
                     t_chip->chipset, t_chip->revNum, t_chip->platform, t_chip->subtype);
                continue;
            }
            dtb_count++;
        }
    }
    closedir(dir);
    log_info("=> Found %d unique DTB(s)\n", dtb_count);

    if (!dtb_count)
        goto cleanup;


    /* Generate the master DTB file:

       Simplify write error handling by just checking for actual vs
       expected bytes written at the end.
     */

    log_info("\nGenerating master DTB... ");

    out_fd = open(output_file, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
    if (!out_fd < 0) {
        log_err("Cannot create '%s'\n", output_file);
        rc = RC_ERROR;
        goto cleanup;
    }

    if (force_v2) {
        version = QCDT_VERSION_NEW;
    }

    /* Write header info */
    wrote += write(out_fd, QCDT_MAGIC, sizeof(uint8_t) * 4); /* magic */
    wrote += write(out_fd, &version, sizeof(uint32_t));      /* version */
    wrote += write(out_fd, (uint32_t *)&dtb_count, sizeof(uint32_t));
                                                             /* #DTB */

    /* Calculate offset of first DTB block */
    dtb_offset = 12               + /* header */
                 ((force_v2 ? 24 : 20) * dtb_count) + /* DTB table entries */
                 4;                 /* end of table indicator */
    /* Round up to page size */
    padding = page_size - (dtb_offset % page_size);
    dtb_offset += padding;
    expected = dtb_offset;

    /* Write index table:
         chipset
         platform
         subtype
         soc rev
         dtb offset
         dtb size
     */
    for (chip = chip_list; chip; chip = chip->next) {
        wrote += write(out_fd, &chip->chipset, sizeof(uint32_t));
        wrote += write(out_fd, &chip->platform, sizeof(uint32_t));
        if (force_v2)
            wrote += write(out_fd, &chip->subtype, sizeof(uint32_t));
        wrote += write(out_fd, &chip->revNum, sizeof(uint32_t));
        if (chip->master->master_offset != 0) {
            wrote += write(out_fd, &chip->master->master_offset, sizeof(uint32_t));
        } else {
            wrote += write(out_fd, &expected, sizeof(uint32_t));
            chip->master->master_offset = expected;
            expected += chip->master->dtb_size;
        }
        wrote += write(out_fd, &chip->master->dtb_size, sizeof(uint32_t));
    }

    rc = RC_SUCCESS;
    wrote += write(out_fd, &rc, sizeof(uint32_t)); /* end of table indicator */
    if (padding > 0)
        wrote += write(out_fd, filler, padding);

    /* Write DTB's */
    for (chip = chip_list; chip; chip = chip->next) {
        if (chip->master->wroteDtb) {
            continue;
        }

        chip->master->wroteDtb = 1;
        filename = chip->master->dtb_file;
        dtb_size = chip->master->dtb_size;

        log_dbg("\n (writing '%s' - %u bytes) ", filename, dtb_size);
        pInputFile = fopen(filename, "r");
        if (pInputFile != NULL) {
            totBytesRead = 0;
            while ((numBytesRead = fread(buf, 1, COPY_BLK, pInputFile)) > 0) {
                wrote += write(out_fd, buf, numBytesRead);
                totBytesRead += numBytesRead;
            }
            fclose(pInputFile);
            padding = page_size - (totBytesRead % page_size);
            if ((uint32_t)(totBytesRead + padding) != dtb_size) {
                log_err("DTB size mismatch, please re-run: expected %d vs actual %d (%s)\n",
                        dtb_size, totBytesRead + padding,
                        filename);
                rc = RC_ERROR;
                break;
            }
            if (padding > 0)
                wrote += write(out_fd, filler, padding);
        } else {
            log_err("failed to open DTB '%s'\n", filename);
            rc = RC_ERROR;
            break;
        }
    }
    close(out_fd);

    if (expected != wrote) {
        log_err("error writing output file, please rerun: size mismatch %d vs %d\n",
                expected, wrote);
        rc = RC_ERROR;
    } else
        log_dbg("Total wrote %u bytes\n", wrote);

    if (rc != RC_SUCCESS)
        unlink(output_file);
    else
        log_info("completed\n");

cleanup:
    free(filler);
    chip_deleteall();
    return rc;
}
コード例 #17
0
ファイル: VMFExporter.cpp プロジェクト: Cre3per/hl2sdk-csgo
bool VMFExporter::ExportVMF( CMapLayout* pLayout, const char *mapname, bool bPopupWarnings )
{
    m_bPopupWarnings = bPopupWarnings;

    Init();

    m_pMapLayout = pLayout;

    if ( pLayout->m_PlacedRooms.Count() <= 0 )
    {
        Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to export: No rooms placed in the map layout!\n" );
        return false;
    }

    // see if we have a start room
    bool bHasStartRoom = false;
    for ( int i = 0 ; i < pLayout->m_PlacedRooms.Count() ; i++ )
    {
        if ( pLayout->m_PlacedRooms[i]->m_pRoomTemplate->IsStartRoom() )
        {
            int half_map_size = MAP_LAYOUT_TILES_WIDE * 0.5f;		// shift back so the middle of our grid is the origin
            m_vecStartRoomOrigin.x = ( pLayout->m_PlacedRooms[i]->m_iPosX - half_map_size ) * ASW_TILE_SIZE;
            m_vecStartRoomOrigin.y = ( pLayout->m_PlacedRooms[i]->m_iPosY - half_map_size ) * ASW_TILE_SIZE;
            bHasStartRoom = true;
            break;
        }
    }
    LoadUniqueKeyList();

    m_iNextNodeID = 0;

    m_pExportKeys = new KeyValues( "ExportKeys" );

    m_pExportKeys->AddSubKey( GetVersionInfo() );
    m_pExportKeys->AddSubKey( GetDefaultVisGroups() );
    m_pExportKeys->AddSubKey( GetViewSettings() );
    m_pExportWorldKeys = GetDefaultWorldChunk();
    if ( !m_pExportWorldKeys )
    {
        Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to save world chunk start\n");
        return false;
    }
    m_pExportKeys->AddSubKey( m_pExportWorldKeys );


    // save out the big cube the whole level sits in
    if ( !AddLevelContainer() )
    {
        Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to save level container\n");
        return false;
    }

    if ( tilegen_use_instancing.GetBool() )
    {
        int nLogicalRooms = m_pMapLayout->m_LogicalRooms.Count();
        int nPlacedRooms = m_pMapLayout->m_PlacedRooms.Count();

        m_pRoom = NULL;
        for ( int i = 0; i < nLogicalRooms; ++ i )
        {
            AddRoomInstance( m_pMapLayout->m_LogicalRooms[i] );
        }

        for ( int i = 0; i < nPlacedRooms; ++ i )
        {
            m_pRoom = m_pMapLayout->m_PlacedRooms[i];
            AddRoomInstance( m_pRoom->m_pRoomTemplate, i );
        }
    }
    else
    {
        // write out logical room solids
        int iLogicalRooms = m_pMapLayout->m_LogicalRooms.Count();
        m_pRoom = NULL;
        for ( int i = 0 ; i < iLogicalRooms ; i++ )
        {
            // start logical room IDs at 5000 (assumes we'll never place 5000 real rooms)
            m_iCurrentRoom = 5000 + i;
            CRoomTemplate *pRoomTemplate = m_pMapLayout->m_LogicalRooms[i];
            if ( !pRoomTemplate )
                continue;

            if ( !AddRoomTemplateSolids( pRoomTemplate ) )
                return false;
        }

        // go through each CRoom and write out its world solids
        int iRooms = m_pMapLayout->m_PlacedRooms.Count();
        for ( m_iCurrentRoom = 0 ; m_iCurrentRoom<iRooms ; m_iCurrentRoom++)
        {
            m_pRoom = m_pMapLayout->m_PlacedRooms[m_iCurrentRoom];
            if (!m_pRoom)
                continue;
            const CRoomTemplate *pRoomTemplate = m_pRoom->m_pRoomTemplate;
            if (!pRoomTemplate)
                continue;

            if ( !AddRoomTemplateSolids( pRoomTemplate ) )
                return false;
        }

        // write out logical room entities
        m_pRoom = NULL;
        for ( int i = 0 ; i < iLogicalRooms ; i++ )
        {
            // start logical room IDs at 5000 (assumes we'll never place 5000 real rooms)
            m_iCurrentRoom = 5000 + i;
            CRoomTemplate *pRoomTemplate = m_pMapLayout->m_LogicalRooms[i];
            if ( !pRoomTemplate )
                continue;

            if ( !AddRoomTemplateEntities( pRoomTemplate ) )
                return false;
        }

        // go through each CRoom and add its entities
        for ( m_iCurrentRoom = 0 ; m_iCurrentRoom<iRooms ; m_iCurrentRoom++)
        {
            m_pRoom = m_pMapLayout->m_PlacedRooms[m_iCurrentRoom];
            if (!m_pRoom)
                continue;
            const CRoomTemplate *pRoomTemplate = m_pRoom->m_pRoomTemplate;
            if (!pRoomTemplate)
                continue;

            if ( !AddRoomTemplateEntities( pRoomTemplate ) )
                return false;
        }
    }

    // add some player starts to the map in the tile the user selected
    if ( !bHasStartRoom )
    {
        m_pExportKeys->AddSubKey( GetPlayerStarts() );
    }

    m_pExportKeys->AddSubKey( GetGameRulesProxy() );
    m_pExportKeys->AddSubKey( GetDefaultCamera() );

    // save out the export keys
    char filename[512];
    Q_snprintf( filename, sizeof(filename), "maps\\%s", mapname );
    Q_SetExtension( filename, "vmf", sizeof( filename ) );
    CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
    for ( KeyValues *pKey = m_pExportKeys->GetFirstSubKey(); pKey; pKey = pKey->GetNextKey() )
    {
        pKey->RecursiveSaveToFile( buf, 0 );
    }
    if ( !g_pFullFileSystem->WriteFile( filename, "GAME", buf ) )
    {
        Msg( "Failed to SaveToFile %s\n", filename );
        return false;
    }

    // save the map layout there (so the game can get information about rooms during play)
    Q_snprintf( filename, sizeof( filename ), "maps\\%s", mapname );
    Q_SetExtension( filename, "layout", sizeof( filename ) );
    if ( !m_pMapLayout->SaveMapLayout( filename ) )
    {
        Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to save .layout file\n");
        return false;
    }

    return true;
}
コード例 #18
0
ファイル: Shader.cpp プロジェクト: joewan/fury3d
	bool Shader::Compile(const std::string &vsData, const std::string &fsData)
	{
		DeleteProgram();

		std::string defines;
		GetDefines(defines);

		std::string vsVersion, vsMain;
		GetVersionInfo(vsData, vsVersion, vsMain);
		vsVersion += "#define VERTEX_SHADER\n";

		// compile vertex shader
		unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);
		if (vertexShader != 0)
		{
			const char *sources[3] = { vsVersion.c_str(), defines.c_str(), vsMain.c_str() };
			const int counts[3] = { (int)vsVersion.size(), (int)defines.size(), (int)vsMain.size() };
			glShaderSource(vertexShader, 3, sources, counts);
			glCompileShader(vertexShader);

			GLint status;
			glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &status);
			if (status != GL_TRUE)
			{
				vertexShader = 0;
				FURYE << m_Name << "'s vertex shader compile failed!";
				return false;
			}
		}
		else
		{
			FURYE << "Failed to create vertex shader context!";
			return false;
		}

		std::string fsVersion, fsMain;
		GetVersionInfo(fsData, fsVersion, fsMain);
		fsVersion += "#define FRAGMENT_SHADER\n";

		// compile fragment shader
		unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
		if (fragmentShader != 0)
		{
			const char *sources[3] = { fsVersion.c_str(), defines.c_str(), fsMain.c_str() };
			const int counts[3] = { (int)fsVersion.size(), (int)defines.size(), (int)fsMain.size() };
			glShaderSource(fragmentShader, 3, sources, counts);
			glCompileShader(fragmentShader);

			GLint status;
			glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &status);
			if (status != GL_TRUE)
			{
				glDeleteShader(vertexShader);
				vertexShader = fragmentShader = 0;
				FURYE << m_Name << "'s fragment compile failed!";
				return false;
			}
		}
		else
		{
			FURYE << "Failed to create fragment shader context!";
			return false;
		}

		// link to program
		m_Program = glCreateProgram();
		if (m_Program != 0)
		{
			glAttachShader(m_Program, vertexShader);
			glAttachShader(m_Program, fragmentShader);
			glLinkProgram(m_Program);

			glDetachShader(m_Program, vertexShader);
			glDetachShader(m_Program, fragmentShader);
			glDeleteShader(vertexShader);
			glDeleteShader(fragmentShader);

			GLint status;
			glGetProgramiv(m_Program, GL_LINK_STATUS, &status);
			if (status != GL_TRUE)
			{
				glDeleteProgram(m_Program);
				m_Program = fragmentShader = vertexShader = 0;
				FURYE << m_Name << " link failed!";
				return false;
			}
		}
		else
		{
			FURYE << "Failed to create shader program context!";
			return false;
		}
		
		m_Dirty = false;
		FURYD << m_Name << " compile & link success!";
		return true;
	}
コード例 #19
0
ファイル: inffile.cpp プロジェクト: Bobfrat/coi-services
const char *InfFile::Class(BOOL showErrors) const
{
  GetVersionInfo(pPath, "Class", &(char *)pClass, showErrors);

  return pClass;
}
コード例 #20
0
ファイル: dtbitmap.c プロジェクト: conioh/os-design
BOOL
xxxDesktopPaintCallback(
    PMONITOR        pMonitor,
    HDC             hdc,
    LPRECT          lprcMonitorClip,
    LPARAM          dwData)
{
    BOOL            f;
    PWND            pwnd;

    CheckLock(pMonitor);

    pwnd = (PWND)dwData;


    if (**((PULONG *)&InitSafeBootMode)) {
        FillRect(hdc, lprcMonitorClip, ghbrBlack );
        f = TRUE;
    } else {
        /*
         * if this is the disconnected desktop, skip the bitmap paint
         */
        if (!gbDesktopLocked) {

            /*
             * Paint the desktop with a color or the wallpaper.
             */
            if (ghbmWallpaper) {
                f = xxxDrawWallpaper(
                        pwnd,
                        hdc,
                        pMonitor,
                        lprcMonitorClip);
            } else {
                FillRect(hdc, lprcMonitorClip, SYSHBR(DESKTOP));
                f = TRUE;
            }
        }
    }

    if (**((PULONG *)&InitSafeBootMode)
            || gDrawVersionAlways
            || gdwCanPaintDesktop) {
        static BOOL fInit = TRUE;
        SIZE        size;
        int         imode;
        COLORREF    oldColor;
        HFONT       oldFont = NULL;


        /*
         * Grab the stuff from the registry
         */
        if (fInit) {
            if (**((PULONG *)&InitSafeBootMode)) {
                ServerLoadString( hModuleWin, STR_SAFEMODE, SafeModeStr, ARRAY_SIZE(SafeModeStr) );
                SafeModeStrLen = wcslen(SafeModeStr);
            }
            GetVersionInfo(**((PULONG *)&InitSafeBootMode) == 0);
            fInit = FALSE;
        }

        if (**((PULONG *)&InitSafeBootMode)) {
            if (gpsi != NULL && gpsi->hCaptionFont != NULL) {
                oldFont = GreSelectFont(hdc, gpsi->hCaptionFont);
            }
    
            GreGetTextExtentW(hdc, wszT, wcslen(wszT), &size, GGTE_WIN3_EXTENT);
            imode = GreSetBkMode(hdc, TRANSPARENT);

            oldColor = GreSetTextColor( hdc, RGB(255,255,255) );

            GreExtTextOutW(
                hdc,
                (pMonitor->rcWork.left + pMonitor->rcWork.right - size.cx) / 2,
                pMonitor->rcWork.top,
                0,
                (LPRECT)NULL,
                wszT,
                wcslen(wszT),
                (LPINT)NULL
                );

            GreGetTextExtentW(hdc, SafeModeStr, SafeModeStrLen, &size, GGTE_WIN3_EXTENT);

            GreExtTextOutW(
                hdc,
                pMonitor->rcWork.left,
                pMonitor->rcWork.top,
                0,
                (LPRECT)NULL,
                SafeModeStr,
                SafeModeStrLen,
                (LPINT)NULL
                );

            GreExtTextOutW(
                hdc,
                pMonitor->rcWork.right - size.cx,
                pMonitor->rcWork.top,
                0,
                (LPRECT)NULL,
                SafeModeStr,
                SafeModeStrLen,
                (LPINT)NULL
                );

            GreExtTextOutW(
                hdc,
                pMonitor->rcWork.right - size.cx,
                pMonitor->rcWork.bottom - gpsi->tmSysFont.tmHeight,
                0,
                (LPRECT)NULL,
                SafeModeStr,
                SafeModeStrLen,
                (LPINT)NULL
                );

            GreExtTextOutW(
                hdc,
                pMonitor->rcWork.left,
                pMonitor->rcWork.bottom - gpsi->tmSysFont.tmHeight,
                0,
                (LPRECT)NULL,
                SafeModeStr,
                SafeModeStrLen,
                (LPINT)NULL
                );

            GreSetBkMode(hdc, imode);
            GreSetTextColor(hdc, oldColor);
    
            if (oldFont) {
                GreSelectFont(hdc, oldFont);
            }
        } else {
            DesktopBuildPaint(hdc, pMonitor);
        }
    }

    return f;
}
コード例 #21
0
ファイル: GnucleusDoc.cpp プロジェクト: swax/Gnucleus
CGnucleusDoc::CGnucleusDoc(CGnucleusApp* pApp)
{
	m_pApp = pApp;

	m_pViewConnect	 = NULL;
	m_pViewShare	 = NULL;
	m_pViewTransfers = NULL;
	m_pViewChat		 = NULL;

	// Mark if XP
	OSVERSIONINFO osv;
	osv.dwOSVersionInfoSize = sizeof(osv);
	GetVersionEx(&osv);
	
	m_RunningXP = (osv.dwMajorVersion == 5 && osv.dwMinorVersion == 1);

	// Load main core
	ConnectCore();

	// Get Gnucleus version info from resource file
	m_GnuVersion = GetVersionInfo();

	m_autCore->SetClientName("Gnucleus");
	m_autCore->SetClientVersion(m_GnuVersion); 
	m_autCore->SetClientCode("GNUC");

	m_RunPath = m_autCore->GetRunPath();

	// Load Meta data schemas
	m_autMeta->LoadSchemaDir(m_RunPath + "\\Schemas");


	// Load preferences
	m_autPrefs->LoadConfig( m_RunPath + "Data\\GnuConfig.ini");
	m_autPrefs->LoadBlocked( m_RunPath + "Data\\GnuBlocked.net");


	// Load Gnuc specific prefs
	m_pPrefsEx = new CPrefsEx;
	m_pPrefsEx->LoadPrefsEx( m_RunPath + "Data\\GnuConfigEx.ini");


	// Load node caches
	m_autCache->LoadCache(m_RunPath + "Data\\GnuCache.net");
	

	// Load web caches
	//m_autCache->LoadWebCache(m_RunPath + "Data\\WebCache.net");
	
	if(!m_autCache->GetWebCacheSize())
	{
		// HARDCODED: a few default caches, sites down
		//m_autCache->AddWebCache("http://www.zero-g.net/gcache/gcache.php");
		//m_autCache->AddWebCache("http://www.gnucleus.net/gcache/gcache.php");
	}


	
	// Load update servers and check for update
	//m_autUpdate->AddServer("http://gnucleus.gnutelliums.com:80/update2/update.xml");
	m_autUpdate->AddServer("http://www.gnucleus.com/update2/update.xml");
	m_autUpdate->Check();


	// Load Chat
	m_pChat  = new CChatControl(this);


	// Display LAN setup dialog
	if(m_autPrefs->GetLanMode())
	{
		m_autNetwork->LanModeOn();

		m_autCache->LoadWebCache(m_RunPath + "Data\\LanWebCache.net");
		
		if( !(m_pApp->m_Min && !m_autPrefs->GetLanName().IsEmpty()) )
		{		
			CNetSetup NetSetup(this);
			NetSetup.DoModal();
		}
	}

	// Start connecting
	if(m_pPrefsEx->m_AutoConnect)
	{
		if(m_pPrefsEx->m_ConnectGnutella)
			m_autCore->Connect2(NETWORK_GNUTELLA);
	   
		if(m_pPrefsEx->m_ConnectG2)
		   m_autCore->Connect2(NETWORK_G2);
		
		m_pChat->m_AutoConnect = true;
	}

	if(m_pPrefsEx->m_ForceGnuUltra)
		m_autNetwork->ForceUltrapeer2(true, NETWORK_GNUTELLA);

	if(m_pPrefsEx->m_ForceG2Hub)
		m_autNetwork->ForceUltrapeer2(true, NETWORK_G2);

	// this tries the centralized cache for gnucleus
	m_autCache->AddWebCache("http://gcache.c0re.net/");
	m_autCache->TryWebCache("gnutella");

	// Connect to chat
	if(m_autPrefs->GetLanMode() && m_pChat->m_pPrefs->m_InternalIRC)
		m_pChat->GetConnect();

	m_pDiagEvolve = NULL;
	m_nLastPref	  = PREF_LOCAL;
}
コード例 #22
0
ファイル: CrashHandler.c プロジェクト: DisAsmCompany/DisAsm
void InfoDrivers()
{
	HMODULE hPSAPI = LoadLibraryA("psapi.dll");
	if (NULL != hPSAPI)
	{
		pfnEnumDeviceDrivers EnumDeviceDrivers = (pfnEnumDeviceDrivers) GetProcAddress(hPSAPI, "EnumDeviceDrivers");
		pfnGetDeviceDriverNameA GetDeviceDriverBaseNameA = (pfnGetDeviceDriverNameA) GetProcAddress(hPSAPI, "GetDeviceDriverBaseNameA");
		pfnGetDeviceDriverNameA GetDeviceDriverFileNameA = (pfnGetDeviceDriverNameA) GetProcAddress(hPSAPI, "GetDeviceDriverFileNameA");
		if (NULL != EnumDeviceDrivers && NULL != GetDeviceDriverBaseNameA && NULL != GetDeviceDriverFileNameA)
		{
			LPVOID * drivers = NULL;
			DWORD needed = 0;
			EnumDeviceDrivers(NULL, 0, &needed);
			drivers = (LPVOID*) malloc(needed);

			if (EnumDeviceDrivers(drivers, needed, &needed))
			{
				DWORD i;
				char windir[NtfsMaxPath] = {0};
				if (!GetWindowsDirectoryA(windir, NtfsMaxPath))
				{
					xstrcat(windir, NtfsMaxPath, "C:\\Windows");
				}
				ConsoleIOPrint("Drivers : \n");
				for (i = 0; i < needed / sizeof(LPVOID); ++i)
				{
					char name[NtfsMaxPath] = {0};
					
					if (GetDeviceDriverFileNameA(drivers[i], name, NtfsMaxPath) || GetDeviceDriverBaseNameA(drivers[i], name, NtfsMaxPath))
					{
						VersionInfo info;
						char full[NtfsMaxPath] = {0};
						char * path = name;
						if (0 == memcmp(path, "\\??\\", 4))
						{
							path += 4;
						}
						if (0 == memcmp(path, "\\SystemRoot\\", xstrlen("\\SystemRoot\\")))
						{
							xstrcat(full, NtfsMaxPath, windir);
							xstrcat(full, NtfsMaxPath, path + xstrlen("\\SystemRoot\\") - 1);
						}
						else if (0 == memcmp(path, "\\WINDOWS\\", xstrlen("\\WINDOWS\\")) ||
							0 == memcmp(path, "\\Windows\\", xstrlen("\\Windows\\")))
						{
							xstrcat(full, NtfsMaxPath, windir);
							xstrcat(full, NtfsMaxPath, path + xstrlen("\\WINDOWS\\") - 1);
						}
						else
						{
							if (NULL == xstrchr(path, '\\'))
							{
								xstrcat(full, NtfsMaxPath, windir);
								xstrcat(full, NtfsMaxPath, "\\system32\\drivers\\");
								xstrcat(full, NtfsMaxPath, path);
							}
							else
							{
								xstrcat(full, NtfsMaxPath, path);
							}
						}
						GetVersionInfo(full, &info);
						ConsoleIOPrintFormatted("%s, %s, %s, %s\n", full, info.FileDescription, info.CompanyName, info.ProductVersion);
					}
				}
			}
		}
		FreeLibrary(hPSAPI);
	}
}
コード例 #23
0
ファイル: inffile.cpp プロジェクト: Bobfrat/coi-services
const char *InfFile::Provider(BOOL showErrors) const
{
  GetVersionInfo(pPath, "Provider", &(char *)pProvider, showErrors);

  return pProvider;
}
コード例 #24
0
ファイル: nCore.cpp プロジェクト: corrideat/lossywav
void nCore_Init()
{
    int32_t nt_i, nt_j;

    for (nt_i = 0; nt_i <= 3; ++nt_i)
    {
        AudioData.WAVEPTR[nt_i] = AudioData.WAVEDATA[nt_i];
        AudioData.BTRDPTR[nt_i] = AudioData.BTRDDATA[nt_i];
        AudioData.CORRPTR[nt_i] = AudioData.CORRDATA[nt_i];
        AudioData.Rev_LUT[nt_i] = nt_i;
    }

    AudioData.Size.Prev = 0;
    AudioData.Size.Last = 0;
    AudioData.Size.This = 0;
    AudioData.Size.Next = 0;

    settings.scaling_factor = 1;
    settings.scaling_factor_inv = 1;
    GetVersionInfo();

    /*with version do*/
    if (version.Build < 27)
    {
        strings.version_short = IntToStr(version.Major) + '.' +  IntToStr(version.Minor) + '.' +  IntToStr(version.Release);

        if (version.Build > 0)
        {
            strings.version_short = strings.version_short + char(version.Build + 96);
        }
    }
    else
    {
        strings.version_short = strings.version;
    }

    timer.StartTime = std::time(nullptr);
#ifdef IS_WINDOWS
    QueryPerformanceFrequency(&timer.Frequency);
    QueryPerformanceCounter(&timer.Start);
    timer.Period = 1.0 / timer.Frequency64;
#elif defined(IS_POSIX)
    clock_gettime(CLOCK_MONOTONIC, &timer.ts[0]);
#endif

    for (nt_i = 0; nt_i < int(MAX_FFT_LENGTH); ++nt_i)
    {
        FFT_unity_result[nt_i] = 0;
        FFT_root_result[nt_i] = 0;
    }

    for (nt_j = 0; nt_j < MAX_CHANNELS; nt_j ++)
    {
        for (nt_i = 0; nt_i <= MAX_HIST_FFT_SHORT_LENGTH / 2 + 1; ++nt_i)
        {
            history.WAVE_results[nt_j][nt_i] = 0;
            history.BTRD_results[nt_j][nt_i] = 0;
            history.CORR_results[nt_j][nt_i] = 0;
            history.Last_Results[nt_j][nt_i] = 0;
        }

        for (nt_i = 0; nt_i <= MAX_FFT_LENGTH_HALF + 1; ++nt_i)
        {
            LongDist.WAVE_results[nt_j][nt_i] = 0;
            LongDist.BTRD_results[nt_j][nt_i] = 0;
            LongDist.CORR_results[nt_j][nt_i] = 0;
        }

        for (nt_i = 0; nt_i <= 33; ++nt_i)
        {
            Stats.bits_removed[nt_j][nt_i] = 0;
            Stats.bits_lost[nt_j][nt_i] = 0;
        }

        for (nt_i = 1; nt_i <= PRECALC_ANALYSES + 2; ++nt_i)
        {
            results.minima[nt_j][nt_i] = 0;
        }
    }

    Stats.Incidence.eclip = 0;
    Stats.Incidence.sclip = 0;
    Stats.Incidence.rclip = 0;
    Stats.Incidence.aclip = 0;
    Stats.Incidence.round = 0;
    Stats.Incidence.noise = 0;

    Stats.Count.eclips = 0;
    Stats.Count.sclips = 0;
    Stats.Count.rclips = 0;
    Stats.Count.aclips = 0;

    Stats.total_bits_removed = 0;
    Stats.total_bits_lost = 0;

    for (nt_i = 0; nt_i <= 1025; ++nt_i)
    {
        history.Histogram_DATA[nt_i] = 0;
        history.Histogram_BTRD[nt_i] = 0;
        history.Histogram_CORR[nt_i] = 0;
    }

    PowersOf.TwoInt64[0] = 1;
    PowersOf.TwoM1[0] = 0;

    for (nt_i = 1; nt_i <= 62; ++nt_i)
    {
        PowersOf.TwoInt64[nt_i] = PowersOf.TwoInt64[nt_i - 1] + PowersOf.TwoInt64[nt_i - 1];
        PowersOf.TwoM1[nt_i] = PowersOf.TwoInt64[nt_i] - 1;
    }

    for (nt_i = 0; nt_i < 32; ++nt_i)
        PowersOf.TwoInt32[nt_i] = PowersOf.TwoInt64[nt_i];

    for (nt_i = -1024; nt_i <= 1023; ++nt_i)
    {
        PowersOf.Two[nt_i] = std::pow(2.0, nt_i);
    }

    for (nt_i = -308; nt_i <= 307; ++nt_i)
    {
        PowersOf.Ten[nt_i] = std::pow(10.0, nt_i);
    }

    OneOver[0] = 1;

    for (nt_i = 1; nt_i <= MAX_FFT_LENGTH + 1; ++nt_i)
    {
        OneOver[nt_i] = 1.0 / nt_i;
    }
}