Obtain by VC and modify the file version

Source: Internet
Author: User
Struct vs_fixedfileinfo {DWORD dwsignature; // = 0xfeefo4bd DWORD dwstrucversion; // version information of the structure, in DWORD dwfileversionms; // The main file version DWORD dwfileversionls; // file version DWORD dwproductversionms; // main product version DWORD dwproductversionls; // product version DWORD dwfileflagsmask; // file flag mask DWORD dwfileflags; // file flag (whether to include the debugging version, dynamic version structure ...) DWORD dwfileos; // the original file operating system (vos_dos, vos_nt, vos0000windows16 ...) DWORD dwfiletype; // file type (vft_unknown, vft_app, vft_dll ...) DWORD dwfilesubtype; // when dwfiletype is vft_app or vft_dll, this value is 0. When it is driver information vft_app or font information, this value contains its specific information DWORD dwfiledatems; // primary timestamp DWORD dwfiledatels; // timestamp }; ========================================================== ======= struct st_language {word wlanguageid; word wcodepage ;}; cstring STR ("d :\\ test \ test.exe"); DWORD dwsize = getfileversioninfosize (STR, null); If (0 = dwsize) return; lpbyte pblock = (byte *) malloc (dwsize); bool B = getfileversioninfo (STR, 0, dwsize, pblock); char * pvervalue = NULL; uint nlen1 = 0; verqueryvalue (pblock, text ("file: // varfileinfo // translation"), (lpvoid *) & pvervalue, & nlen1); // obtain the language char * planvalue = NULL; uint nlen2 = 0; verqueryvalue (pblock, "varfileinfo \ translation", (lpvoid *) & planvalue, & nlen2 ); // 080404b0 is the Chinese st_language stlang = * (st_language *) planvalue); // gets the verqueryvalue (pblock, text ("file: // % 22 ), (lpvoid *) % 26 pvervalue, % 26nlen1/); vs_fixedfileinfo * pfixfileinfo = (vs_fixedfileinfo *) pvervalue; // you can modify the attributes of pfixfileinfo-> dwfileversionls = 1234; pfixfileinfo-> dwfileversionms = 4321; pfixfileinfo-> dwproductversionls = 101; pfixfileinfo-> dwproductversionms = 1010; // modify the resource handle = beginupdateresource (STR, false ); bool result = updateresource (handle, rt_version, makeintresource (1), stlang. wlanguageid, pblock, dwsize); If (result = false) {afxmessagebox ("updata resource false. ");} endupdateresource (handle, false); free (pblock );

Post: http://www.cppblog.com/kyelin/archive/2007/08/20/30433.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.