CN103077066B - A kind of method and system of embedded product key message when compiling - Google Patents

A kind of method and system of embedded product key message when compiling Download PDF

Info

Publication number
CN103077066B
CN103077066B CN201310041380.9A CN201310041380A CN103077066B CN 103077066 B CN103077066 B CN 103077066B CN 201310041380 A CN201310041380 A CN 201310041380A CN 103077066 B CN103077066 B CN 103077066B
Authority
CN
China
Prior art keywords
key message
product key
file
compiling
product
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310041380.9A
Other languages
Chinese (zh)
Other versions
CN103077066A (en
Inventor
夏彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nantong Yuanyi New Material Technology Co.,Ltd.
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201310041380.9A priority Critical patent/CN103077066B/en
Publication of CN103077066A publication Critical patent/CN103077066A/en
Application granted granted Critical
Publication of CN103077066B publication Critical patent/CN103077066B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The method and system of embedded product key message when the invention discloses a kind of compiling, is applied to field of software development, and the method includes: product key message character string incoming for compiler directive passed in source file in compilation script file;By product key message by macrodefinition escape in source file, form the source code comprising product key message;The source code comprising product key message is individually created as a section in binary file by link script file.The method and system of the embodiment of the present invention is by compiling instruction embedded product key message in binary file automatically, safeguard for later product/rise in value and provide abundant effective information source, improve development efficiency, store in the product key message of embedding is individually stored in a section simultaneously, product key message needed for external tool software can be accessed by address, the motility that the information of improve is read.

Description

A kind of method and system of embedded product key message when compiling
Technical field
The present invention relates to field of software development, particularly to the side of embedded product key message during a kind of compiling Method and system.
Background technology
Built-in end software product release information the most only comprises this product current version information, name of product etc. A small amount of information, does not automatically insert the product key message of product, later product maintenance/value-added information Inadequate resource.In addition version information deposit position is data field, must take into the shadow to code area before compiling Ring, and external tool location impenetrably accesses, it is necessary to allow built-in end program be connect by appointment after running Mouth accesses, underaction.
Such as, when run into need edition upgrading time, owing to not automatically inserting the product key message of product, Manually must add required product key message, once product key message amount by the way of hard coded Increase to a certain degree, and artificial error probability can exponentially rise, and needs artificial necessity judging upgrading Property and reliability, efficiency is low.When the upgrading that human error causes mistake occurs, common product can only return Factory keeps in repair, and not only Consumer's Experience is bad, and brings high maintenance cost to company.
Summary of the invention
The technical problem to be solved be for built-in end software later product safeguard/value-added Information resources are not enough, it is provided that a kind of method and system of embedded product key message when compiling, and closed by product Key information embeds binary system and generates in software.
According to an aspect of the present invention, a kind of side of embedded product key message when compiling that the present invention provides Method comprises the following steps:
In compilation script file, product key message character string incoming for compiler directive is passed to source file In;
By product key message by macrodefinition escape in source file, formed and comprise product key message Source code;
The source code comprising product key message is individually created by link script file into binary system literary composition A section in part.
Preferably, above-mentioned in compilation script file by product key message character string incoming for compiler directive The step passed in source file farther includes:
Amendment compiler directive file, different by using command switch to control compilation script File Open Compiling option and compiler directive;Being obtained by compiling option and compiler directive needs the product key of compiling to believe Breath and the source file corresponding to product key message of needs compiling;The product key letter of compiling will be needed Breath passes to the source file of correspondence.
Preferably, above-mentioned link script file in the source code comprising product key message is individually created Step for a section in binary file farther includes:
Be individually created by the source code comprising product key message is a section;One is found not in internal memory The address that can be modified is deposited.
Preferably, also include after said method: by search in binary file to comprise product crucial Product key message needed for the section acquisition of information.
Further, institute is obtained above by the section comprising product key message searched in binary file The step of the product key message needed farther includes:
Resolve the section Store form of binary file;
Location binary file comprises the sector address of product key message;
Resolving according to the structure of the product key message defined in source file, the product needed for acquisition is crucial Information.
Preferably, product key message includes: name of product, hardware version, country's version, the softest Part version and/or history compatible version list.
According to a further aspect in the invention, a kind of embedded product key message when compiling that the present invention provides System includes compilation script file, source file and link script file, wherein:
Compilation script file, for passing to source file by product key message character string incoming for compiler directive In;
Source file, for comprising product key message by product key message by macrodefinition escape, formation Source code;
Link script file, for being individually created the source code comprising product key message as binary system literary composition A section in part.
Preferably, above-mentioned compilation script file specifically for:
Amendment compiler directive file, different by using command switch to control compilation script File Open Compiling option and compiler directive;Being obtained by compiling option and compiler directive needs the product key of compiling to believe Breath and the source file corresponding to product key message of needs compiling;The product key letter of compiling will be needed Breath passes to the source file of correspondence.
Preferably, above-mentioned link script file specifically for: the source code list of product key message will be comprised Only become a section;In internal memory, find an address that will not be modified deposit.
Preferably, said system also includes external tool software, and external tool software is for by searching two The product key message needed for the section acquisition comprising product key message in binary file.
By the method and system of the embodiment of the present invention, automatically embedding in binary file by compiling instruction Enter product key message, safeguard/rise in value providing abundant effective information source for later product, improve out Send out efficiency, store in the product key message of embedding is individually stored in a section simultaneously so that outside work Have the product key message needed for software can be accessed, the motility that the information of improve is read by address.
Accompanying drawing explanation
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the one of the present invention Part, the schematic description and description of the present invention is used for explaining the present invention, is not intended that the present invention Improper restriction.In the accompanying drawings:
Fig. 1 is a kind of method flow of embedded product key message when compiling that the embodiment of the present invention provides Figure;
Fig. 2 is a kind of system structure of embedded product key message when compiling that the embodiment of the present invention provides Figure;
Fig. 3 is a kind of version software upgrade method flow chart that the preferred embodiment of the present invention provides.
Detailed description of the invention
In order to make the technical problem to be solved, technical scheme and beneficial effect clearer, bright In vain, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that this Specific embodiment described by place only in order to explain the present invention, is not intended to limit the present invention.
It is a kind of method of embedded product key message when compiling of providing of the embodiment of the present invention as shown in Figure 1 Flow chart, in figure:
S101, in compilation script file, product key message character string incoming for compiler directive is passed to source In file;
Preferably, this step can be accomplished by: amendment compiler directive file, by using Command switch controls the different compiling option of compilation script File Open and compiler directive;Selected by compiling Item and compiler directive obtain product key message and the product key message of needs compiling needing compiling Corresponding source file;The product key message needing compiling is passed to the source file of correspondence.
S102, in source file by product key message by macrodefinition escape, form that to comprise product crucial The source code of information;
S103, to be individually created by the source code comprising product key message in link script file be two to enter A section in file processed.
Preferably, this step can be accomplished by: amendment link script file, will comprise product It is a section that the source code of product key message is individually created;The ground that will not be modified is found in internal memory Location is deposited.
Preferably, when specifically applying, in order to the product key message needed for Ti Quing is for being actually needed Used, also include after the method for the present embodiment: by search in binary file to comprise product crucial Product key message needed for the section acquisition of information.
Specifically, above-mentioned steps can be accomplished by: resolves the section compartment of binary file Formula;Position the sector address comprising product key message in described binary file;Defined in source file The structure of product key message resolve the product key message needed for acquisition.
It is a kind of system of embedded product key message when compiling of providing of the embodiment of the present invention as shown in Figure 2 Function structure chart, in figure: this system includes source file 21, compilation script file 22 and link script literary composition Part 23, wherein:
Compilation script file 22, for passing to source document by product key message character string incoming for compiler directive In part 21;
Source file 21, for product key message is passed through macrodefinition escape, is formed and comprises product key letter The source code of breath;
Link script file 23, for being individually created the source code comprising product key message as binary system A section in file.
Preferably, compilation script file 22 specifically for: amendment compiler directive file, ordered by use Order switch controls the different compiling option of compilation script File Open and compiler directive;By compiling option The product key message needing compiling and the product key message institute needing compiling is obtained with compiler directive Corresponding source file.
Preferably, link script file 23 specifically for: the source code that will comprise product key message is raw It is a section that the object code become is individually created;In internal memory, find an address that will not be modified deposit Put..
Preferably, when specifically applying, in order to the product key message needed for Ti Quing is for being actually needed Used, the system of the present embodiment also includes external tool software, for by searching in binary file Comprise the product key message needed for the section acquisition of product key message.Such as external tool software is version Upgrading software time, required product key message includes: name of product, hardware version, country version, Current software version and/or history compatible version list.
By the method and system of above-described embodiment, automatically embedded in binary file by compiling instruction Product key message, safeguards for later product/rises in value providing abundant effective information source, improve exploitation Efficiency, stores in the product key message of embedding is individually stored in a section simultaneously so that external tool Software can be accessed by address needed for product key message, the motility that the information of improve is read.
Preferred embodiment
It is the present invention method flow diagram that is applied to edition upgrading as shown in Figure 3, comprises the following steps:
Step S301, product key message needed for source file predefines edition upgrading.
Specifically, the structure of product key message defined in this step, and define each knot by macrodefinition Structure body member, in order to can substitute by outside incoming string variable when compiling.
The statement of product key message structure is exemplified below:
Definition hardware version escape grand example #define VER_VALUE_ASIC " QSC6085 "
Definition softwarecompatible list grand example #define VER_VALUE_SW_COMP_LIST "
LH8A7001;\LH8A7002;\”
Step S302, the version information character defined during compiling outside use variable transferring in compilation script String.
Step S303, in link script, the source code comprising product key message is individually created a section Leave in binary file.
Step S304, edition upgrading software are by searching the section comprising product key message in binary file Product key message needed for acquisition.
Specifically, binary file format analytical capabilities adds when edition upgrading software programming, So that the section comprising information needed can be parsed.This step needs to resolve the data of target binary file Form, resolves the section Store form of described binary file especially;After parsing the segment table of binary file, Search the section (can be judged) comprising product key message by the section name specified;Location comprises product The sector address of key message, then according to the structure of the product key message defined in source file is carried out Resolve, thus the product key message needed for extracting edition upgrading.
Can step S305, edition upgrading software judge upgrade according to the product key message obtained, if Upgrading can the most automatically upgrade, otherwise terminate flow process.
Specifically, the product key message of acquisition includes the comparison of version information when version software is upgraded automatically With the information required for the confirmation of product information, such as name of product, hardware version, country version, when Front software version and/or history compatible version list.Other information being necessary to comprise can also be comprised. This step implementation is such as: first judge that hardware and software version is the most consistent, more whether judges national version Unanimously, then judge that customized version is the most consistent, finally judge that software version number is the need of renewal.This Four conditions just allow upgrading in the case of all meeting, and the most do not allow upgrading.
By the present embodiment, built-in end software adds product key message necessary to edition upgrading, Automatically matching judgment is carried out according to rule file by upgrading tool software, to decide whether when edition upgrading Can upgrading.Reduce the incompatible upgrading risk of failure caused of software and hardware to greatest extent, reduce Company's after-sales service cost.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for this For the technical staff in field, the present invention can have various modifications and variations.All spirit in the present invention and Within principle, any modification, equivalent substitution and improvement etc. made, should be included in the protection of the present invention Within the scope of.

Claims (8)

1. the method for embedded product key message when compiling, it is characterised in that described method include with Lower step:
In compilation script file, product key message character string incoming for compiler directive is passed to source file In;
By described product key message by macrodefinition escape in source file, formed and comprise product key letter The source code of breath;
The described source code comprising product key message is individually created as binary system by link script file A section in file;
Described in compilation script file, product key message character string incoming for compiler directive is passed to source document Step in part farther includes:
Amendment compiler directive file, different by using command switch to control compilation script File Open Compiling option and compiler directive;
Obtained by described compiling option and compiler directive and need the product key message of compiling and described need Source file corresponding to product key message to be compiled;
The described product key message needing compiling is passed to the source file of correspondence.
Method the most according to claim 1, it is characterised in that described general in link script file The step that the described source code comprising product key message is individually created as a section in binary file is entered One step includes:
Being individually created by the described source code comprising product key message is a section;
In internal memory, find an address that will not be modified deposit.
Method the most according to claim 1, it is characterised in that also include after described method: logical Cross the product key letter needed for the section comprising product key message searching in described binary file obtains Breath.
Method the most according to claim 3, it is characterised in that described by searching described binary system The step of the product key message needed for the section comprising product key message acquisition in file is wrapped further Include:
Resolve the section Store form of described binary file;
Position the sector address comprising product key message in described binary file;
Resolving according to the structure of the product key message defined in source file, the product needed for acquisition is crucial Information.
5. according to the method described in claim 1-4 any one claim, it is characterised in that described Product key message includes: name of product, hardware version, country version, current software version and/or History compatible version list.
6. the system of embedded product key message when compiling, it is characterised in that described system includes compiling Translate script file, source file and link script file, wherein:
Described compilation script file, for passing to institute by product key message character string incoming for compiler directive State in source file;
Described source file, for comprising product by described product key message by macrodefinition escape, formation The source code of key message;
Described link script file, for the described source code comprising product key message is individually created into A section in binary file;
Described compilation script file specifically for:
Amendment compiler directive file, different by using command switch to control compilation script File Open Compiling option and compiler directive;
Obtained by described compiling option and compiler directive and need the product key message of compiling and described need Source file corresponding to product key message to be compiled;
The described product key message needing compiling is passed to the source file of correspondence.
System the most according to claim 6, it is characterised in that described link script file is specifically used In:
Being individually created by the described source code comprising product key message is a section;
In internal memory, find an address that will not be modified deposit.
8. according to the system described in claim 6 or 7, it is characterised in that described system also includes outside Tool software, described external tool software is for believing by the product key that comprises in lookup binary file Product key message needed for the section acquisition of breath.
CN201310041380.9A 2013-02-02 2013-02-02 A kind of method and system of embedded product key message when compiling Active CN103077066B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310041380.9A CN103077066B (en) 2013-02-02 2013-02-02 A kind of method and system of embedded product key message when compiling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310041380.9A CN103077066B (en) 2013-02-02 2013-02-02 A kind of method and system of embedded product key message when compiling

Publications (2)

Publication Number Publication Date
CN103077066A CN103077066A (en) 2013-05-01
CN103077066B true CN103077066B (en) 2016-08-31

Family

ID=48153603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310041380.9A Active CN103077066B (en) 2013-02-02 2013-02-02 A kind of method and system of embedded product key message when compiling

Country Status (1)

Country Link
CN (1) CN103077066B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765593A (en) * 2014-01-06 2015-07-08 北京深思数盾科技有限公司 Firmware customizing method and hardware apparatus for customizing firmware
CN103984566B (en) * 2014-02-21 2017-01-18 北京神舟航天软件技术有限公司 In-orbit fine-grained performance function addition method
CN105183507A (en) * 2015-08-24 2015-12-23 汉柏科技有限公司 Version matching method and system of application programs
CN107871066B (en) * 2016-09-28 2020-10-09 传化物流集团有限公司 Code compiling method and device based on android system
CN112650501B (en) * 2020-12-31 2023-07-07 重庆芯讯通无线科技有限公司 Compiling, terminal equipment and compiling linking and loading method of client application program of terminal equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1776620A (en) * 2004-11-15 2006-05-24 国际商业机器公司 Apparatus,system and method for identifying fixed memory address errors in source code
CN1783799A (en) * 2004-11-29 2006-06-07 中兴通讯股份有限公司 Automatic obtaining method for telecommunication trausmission systen unit soft and hard ware version
CN101963915A (en) * 2010-09-25 2011-02-02 中兴通讯股份有限公司 Building method of compilation and system thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030070160A1 (en) * 2001-10-04 2003-04-10 International Business Machines Corporation Embedding information in software

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1776620A (en) * 2004-11-15 2006-05-24 国际商业机器公司 Apparatus,system and method for identifying fixed memory address errors in source code
CN1783799A (en) * 2004-11-29 2006-06-07 中兴通讯股份有限公司 Automatic obtaining method for telecommunication trausmission systen unit soft and hard ware version
CN101963915A (en) * 2010-09-25 2011-02-02 中兴通讯股份有限公司 Building method of compilation and system thereof

Also Published As

Publication number Publication date
CN103077066A (en) 2013-05-01

Similar Documents

Publication Publication Date Title
CN103077066B (en) A kind of method and system of embedded product key message when compiling
TWI720724B (en) System and method for implementing different types of blockchain contracts
US20200218526A1 (en) Adaptive deployment of applications for mobile devices
US9430224B2 (en) Hot-update method and apparatus
CN100470480C (en) Hardware accelerator personality compiler
US9489189B2 (en) Dynamically generate and execute a context-specific patch installation procedure on a computing system
KR20040022451A (en) Embedded software update system
CN107391104B (en) Client and reactive native code update dependence management method, device and system
CN108139896A (en) EVM(extended virtual machine) instruction set framework
CN107506219A (en) A kind of general version upgrade method based on android system
US9460306B1 (en) System and method for controlling access of machine code to operating system resources
CN107924326A (en) The moving method of updated type is covered
CN104407863A (en) Abstract control model programming device and method
CN105224309B (en) A kind of method and apparatus for transferring function
CN105446725A (en) Method and system for model driven development
Prehofer et al. From internet of things mashups to model-based development
CN105786538A (en) Software upgrading method and device based on Android system
CN105183484A (en) Method and device for compatibility of multi-version application programming interface
CN108229148A (en) A kind of sandbox hulling method and system based on Android virtual machines
CN104375858A (en) Method and device for multiple browser platforms to execute javascript
CN101533454B (en) Compiling method
CN108415708A (en) Processing method, device, equipment and the storage medium of application program installation kit size
CN101650663A (en) Database system and upgrading method thereof
CN106295326A (en) A kind of inline hook method and system for obtaining video card content
CN107301347A (en) A kind of method that Hbuilder App calling figures are obtained based on static analysis

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
CB02 Change of applicant information

Address after: A District No. 9018 Han innovation building in Nanshan District high tech Zone in Shenzhen city of Guangdong Province, North Central Avenue, 518000 floor 10

Applicant after: Nubian Technologies Ltd.

Address before: A District No. 9018 Han innovation building in Nanshan District high tech Zone in Shenzhen city of Guangdong Province, North Central Avenue, 518000 floor 10

Applicant before: Shenzhen ZTE Mobile Tech Co., Ltd.

COR Change of bibliographic data
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200930

Address after: 226300 Jiangsu city of Nantong province Tongzhou District East Town Industrial Park

Patentee after: NANTONG HAIOU LIFT-SAVING & PROTECTION EQUIPMENT Co.,Ltd.

Address before: A District No. 9018 Han innovation building in Nanshan District high tech Zone in Shenzhen city of Guangdong Province, North Central Avenue, 518000 floor 10

Patentee before: NUBIA TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220325

Address after: 226345 group 20, Pinghe village, Dongshe Town, Tongzhou District, Nantong City, Jiangsu Province

Patentee after: Nantong Yuanyi New Material Technology Co.,Ltd.

Address before: 226300 Dongshe Town Industrial Park, Tongzhou District, Nantong City, Jiangsu Province

Patentee before: NANTONG HAIOU LIFT-SAVING & PROTECTION EQUIPMENT Co.,Ltd.