FAQ200412: Get information on the specified file

xiaoxiao2021-03-06  44

Char * szfilename = "c: //enochshen.exe";

DWORD dwsize = getFileVersionFosize (SZFileName, NULL);

LPVOID PBLOCK = Malloc (dwsize);

GetFileVersionInfo (SZFileName, 0, DWSIZE, PBLOCK);

Char * pvervalue = NULL;

Uint nsize = 0;

VERQUERYVALUE (PBLOCK, TEXT ("// varfileinfo // translation),

(LPVOID *) & PVERVALUE, & nsize);

CString strsubblock, startranslation, strtemp;

Strtemp.format ("000% x", * ((unsigned short int *) pVERVALUE));

Strtranslation = strTemp.right (4);

Strtemp.Format ("000% x", * ((unsigned short int *) & pvervalue [2]));

Strtranslation = strTemp.right (4);

// 080404B0 is Chinese, 040904E4 is in English

//File Description

STRSUBBLOCK.FORMAT ("// StringFileInfo //% S // FileDescription", Strtranslation;

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("file description:% s", pVERVALUE);

AfxMessageBox (Strtemp);

// internal name

strsubblock.format ("// StringFileInfo //% S // InternalName", Strtranslation);

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("file description:% s", pVERVALUE);

AfxMessageBox (Strtemp);

/ / Legal copyright

STRSUBBLOCK.FORMAT ("// StringFileInfo //% s // legaltrademarks", startranslation;

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("Legal Copyright:% S", PVERVALUE);

AfxMessageBox (Strtemp);

// Original file name

STRSUBBLOCK.FORMAT ("// StringFileInfo //% s // OriginalFileName", startranslation);

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("Original File Name:% S", PVERVALUE);

AfxMessageBox (Strtemp);

//product name

strsubblock.format ("// StringFileInfo //% S // ProductName", Strtranslation);

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("Product Name:% S", PVERVALUE);

AfxMessageBox (Strtemp);

//product version

STRSUBBLOCK.FORMAT ("// StringFileInfo //% S // ProductVersion", Strtranslation);

VERQUERYVALUE (PBLOCK, STRSUBBBBLOCK.GETBUFFERSETLENGTH (256), (LPVOID *) & PVERVALUE, & NSIZE

strsubblock.releasebuffer ();

Strtemp.Format ("Product Version:% S", PVERVALUE);

AfxMessageBox (Strtemp);

Free (PBLOCK);

转载请注明原文地址:https://www.9cbs.com/read-75217.html

New Post(0)