CN103077066A - Method and system for embedding product key information during compiling - Google Patents

Method and system for embedding product key information during compiling Download PDF

Info

Publication number
CN103077066A
CN103077066A CN2013100413809A CN201310041380A CN103077066A CN 103077066 A CN103077066 A CN 103077066A CN 2013100413809 A CN2013100413809 A CN 2013100413809A CN 201310041380 A CN201310041380 A CN 201310041380A CN 103077066 A CN103077066 A CN 103077066A
Authority
CN
China
Prior art keywords
product key
key message
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.)
Granted
Application number
CN2013100413809A
Other languages
Chinese (zh)
Other versions
CN103077066B (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
Shenzhen ZTE Mobile Telecom 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 Shenzhen ZTE Mobile Telecom Co Ltd filed Critical Shenzhen ZTE Mobile Telecom 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

Images

Abstract

The invention discloses a method and a system for embedding product key information during compiling, which are applied to the field of software development. The method comprises the following steps of: transmitting a product key information character string in which a compiling command is transmitted into a source file in a compiling script file; escaping the product key information in the source file through macro definition to form a source code containing the product key information; and independently generating a segment in a binary file by the source code containing the product key information in a link script file. According to the method and the system provided by the embodiment according to the invention, the product key information is automatically embedded into the binary file through the compiling command, a rich and effective information source is provided for later product maintenance/increase in value, the development efficiency is increased, and meanwhile, the embedded product key information is independently stored in one segment, so that external tool software can access to required product key information through an address, and the flexibility for reading of the information is improved.

Description

The method and system of embedded product key message during a kind of the compiling
Technical field
The present invention relates to field of software development, particularly the method and system of embedded product key message during a kind of the compiling.
Background technology
Built-in end software product release information generally only comprises a small amount of information such as this product current version information, name of product, does not have the product key message of automatic embedded product, and later stage product maintenance/value-added information resources are not enough.The version information deposit position is the data field in addition, and the front impact that must consider the code area of compiling, and impenetrably location access of external tool must allow the operation of built-in end program rear by specified interface access, underaction.
Such as, when running into when needing edition upgrading, owing to there is not the product key message of automatic embedded product, must be manually mode by hard coded add required product key message, in case product key message amount increases to a certain degree, and artificial error probability can be index and rise, and needs artificial necessity and the reliability of judging upgrading, and efficient is low.When the upgrading that leads to errors when human error occured, common product can only depot repair, and not only the user experiences badly, and brings high maintenance cost to company.
Summary of the invention
Technical matters to be solved by this invention is that the later stage product maintenance/value-added information resources for built-in end software are not enough, and the method and system of embedded product key message when a kind of the compiling is provided embeds scale-of-two with the product key message and generates in the software.
According to an aspect of the present invention, the method for embedded product key message may further comprise the steps during a kind of compiling the provided by the invention:
The product key message character string of in the compilation script file compiler directive being imported into passes in the source file;
In source file, the product key message is passed through the macro definition escape, form the source code that comprises the product key message;
The source code that will comprise the product key message in the script file in link is generated as separately a section in the binary file.
Preferably, the step that passes in the source file of the above-mentioned product key message character string of in the compilation script file compiler directive being imported into further comprises:
Revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch; Obtain the product key message that needs compiling and the corresponding source file of product key message that needs compiling by compile option and compiler directive; The product key message of needs compiling is passed to corresponding source file.
Preferably, the above-mentioned source code that will comprise the product key message in the script file in the link step that is generated as separately a section in the binary file further comprises:
The source code that will comprise the product key message is generated as separately a section; Seeking the address that can not be modified in internal memory deposits.
Preferably, also comprise after the said method: obtain required product key message by the section that comprises the product key message of searching in the binary file.
Further, the above-mentioned step of obtaining required product key message by the section that comprises the product key message of searching in the binary file further comprises:
Resolve the section Store form of binary file;
The sector address that comprises the product key message in the binary file of location;
Structure according to the product key message that defines in the source file is resolved, and obtains required product key message.
Preferably, the product key message comprises: name of product, hardware version, national version, current software version and/or the tabulation of historical compatible version.
According to a further aspect in the invention, the system of embedded product key message comprises compilation script file, source file and link script file during a kind of compiling the provided by the invention, wherein:
The compilation script file, the product key message character string that is used for compiler directive is imported into passes to source file;
Source file is used for the product key message is passed through the macro definition escape, forms the source code that comprises the product key message;
Link script file, be generated as separately a section of binary file for the source code that will comprise the product key message.
Preferably, above-mentioned compilation script file specifically is used for:
Revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch; Obtain the product key message that needs compiling and the corresponding source file of product key message that needs compiling by compile option and compiler directive; The product key message of needs compiling is passed to corresponding source file.
Preferably, above-mentioned link script file specifically is used for: the source code that will comprise the product key message is generated as separately a section; Seeking the address that can not be modified in internal memory deposits.
Preferably, said system also comprises external tool software, and external tool software is used for obtaining required product key message by the section that comprises the product key message of searching binary file.
Method and system by the embodiment of the invention, by the automatic embedded product key message in binary file of compiler directive, the product maintenance for the later stage/increment provides enriches effective information source, improved development efficiency, simultaneously the product key message that embeds is left in separately in the section and store, so that external tool software can be accessed required product key message by the address, improved the dirigibility that information is read.
Description of drawings
Accompanying drawing described herein is used to provide a further understanding of the present invention, consists of a part of the present invention, and illustrative examples of the present invention and explanation thereof are used for explaining the present invention, do not consist of improper restriction of the present invention.In the accompanying drawings:
The method flow diagram of embedded product key message when Fig. 1 is a kind of compiling that the embodiment of the invention provides;
The system construction drawing of embedded product key message when Fig. 2 is a kind of compiling that the embodiment of the invention provides;
Fig. 3 is a kind of version software upgrade method process flow diagram that the preferred embodiment of the present invention provides.
Embodiment
In order to make technical matters to be solved by this invention, technical scheme and beneficial effect clearer, clear, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
The method flow diagram of embedded product key message when being as shown in Figure 1 a kind of compiling that the embodiment of the invention provides, among the figure:
S101, the product key message character string of in the compilation script file compiler directive being imported into pass in the source file;
Preferably, this step can realize in the following manner: revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch; Obtain the product key message that needs compiling and the corresponding source file of product key message that needs compiling by compile option and compiler directive; The product key message of needs compiling is passed to corresponding source file.
S102, in source file with the product key message by the macro definition escape, form the source code that comprises the product key message;
S103, the source code that will comprise the product key message in the script file in link are generated as separately a section in the binary file.
Preferably, this step can realize in the following manner: revise the link script file, the source code that will comprise the product key message is generated as separately a section; Seeking the address that can not be modified in internal memory deposits.
Preferably, when concrete the application, be that actual needs is used in order to extract required product key message, also comprise after the method for present embodiment: obtain required product key message by the section that comprises the product key message of searching in the binary file.
Particularly, above-mentioned steps can realize in the following manner: the section Store form of resolving binary file; Locate the sector address that comprises the product key message in the described binary file; Resolve according to the structure of the product key message that defines in the source file and to obtain required product key message.
The system module structural drawing of embedded product key message when being as shown in Figure 2 a kind of compiling that the embodiment of the invention provides, among the figure: this system comprises source file 21, compilation script file 22 and link script file 23, wherein:
Compilation script file 22, the product key message character string that is used for compiler directive is imported into passes to source file 21;
Source file 21 is used for the product key message is passed through the macro definition escape, forms the source code that comprises the product key message;
Link script file 23, be generated as separately a section of binary file for the source code that will comprise the product key message.
Preferably, compilation script file 22 specifically is used for: revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch; Obtain the product key message that needs compiling and the corresponding source file of product key message that needs compiling by compile option and compiler directive.
Preferably, link script file 23 specifically is used for: the object code that will comprise the source code generation of product key message is generated as separately a section; Seeking the address that can not be modified in internal memory deposits.。
Preferably, when concrete the application, be that actual needs is used in order to extract required product key message, the system of present embodiment also comprises external tool software, is used for obtaining required product key message by the section that comprises the product key message of searching binary file.When being edition upgrading software such as external tool software, required product key message comprises: name of product, hardware version, national version, current software version and/or the tabulation of historical compatible version.
Method and system by above-described embodiment, by the automatic embedded product key message in binary file of compiler directive, the product maintenance for the later stage/increment provides enriches effective information source, improved development efficiency, simultaneously the product key message that embeds is left in separately in the section and store, so that external tool software can be accessed required product key message by the address, improved the dirigibility that information is read.
Preferred embodiment
Be the method flow diagram that the present invention is applied to edition upgrading as shown in Figure 3, may further comprise the steps:
Step S301, at the required product key message of source file predefine edition upgrading.
Particularly, define the structure of product key message in this step, and define each structure member with macro definition, in order to when compiling, can substitute with the string variable that the outside is imported into.
The statement of product key message structure is exemplified below:
Figure BDA00002811740700061
Definition hardware version escape grand example #define VER_VALUE_ASIC " QSC6085 "
The definition softwarecompatible tabulate grand example #define VER_VALUE_SW_COMP_LIST "
LH8A7001;\LH8A7002;\”
The version information character string of step S302, definition when in compilation script, transmitting outside compiling with variable.
Step S303, the source code that will comprise the product key message in the script in link generate separately a section and leave in the binary file.
Step S304, edition upgrading software obtain required product key message by searching the section that comprises the product key message in the binary file.
Specifically, the binary file format analytical capabilities adds when the edition upgrading software programming, in order to can parse the section that comprises information needed.Need to resolve the data layout of target binary file in this step, resolve especially the section Store form of described binary file; After parsing the segment table of binary file, search the section (can judge by the section name of appointment) that comprises the product key message; The location comprises the sector address of product key message, then resolves according to the structure of the product key message that defines in the source file, thereby extracts the required product key message of edition upgrading.
Can step S305, edition upgrading software upgrade according to the product key message judgement of obtaining, if can upgrade then auto-update, otherwise process ends.
Particularly, the needed information of affirmation of the comparison of version information and product information when the product key message that obtains comprises the version software auto-update is such as name of product, hardware version, national version, current software version and/or the tabulation of historical compatible version.Can also comprise other and be necessary the information that comprises.This step implementation such as: judge first whether the hardware and software version consistent, judge again whether national version consistent, judge then whether customized version consistent, judge at last whether software version number needs to upgrade.Just allow upgrading in the situation that these four conditions all satisfy, otherwise do not allow upgrading.
By present embodiment, in built-in end software, add the necessary product key message of edition upgrading, when edition upgrading, automatically carry out matching judgment according to rule file by upgrading tool software, to determine whether can upgrade.Reduce to greatest extent the incompatible upgrading risk of failure that causes of software and hardware, reduced company's after-sales service cost.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. the method for the key message of embedded product when compiling is characterized in that, said method comprising the steps of:
The product key message character string of in the compilation script file compiler directive being imported into passes in the source file;
In source file, described product key message is passed through the macro definition escape, form the source code that comprises the product key message;
In the link script file, the described source code that comprises the product key message is generated as separately a section in the binary file.
2. method according to claim 1 is characterized in that, the step that the described product key message character string of in the compilation script file compiler directive being imported into passes in the source file further comprises:
Revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch;
Obtain product key message and the described corresponding source file of product key message that needs compiling that needs compiling by described compile option and compiler directive;
The described product key message of compiling that needs is passed to corresponding source file.
3. method according to claim 1 is characterized in that, the described step that in the link script file the described source code that comprises the product key message is generated as separately a section in the binary file further comprises:
The described source code that comprises the product key message is generated as separately a section;
Seeking the address that can not be modified in internal memory deposits.
4. method according to claim 1 is characterized in that, also comprises after the described method: obtain required product key message by the section that comprises the product key message of searching in the described binary file.
5. method according to claim 4 is characterized in that, the described step of obtaining required product key message by the section that comprises the product key message of searching in the described binary file further comprises:
Resolve the section Store form of described binary file;
Locate the sector address that comprises the product key message in the described binary file;
Structure according to the product key message that defines in the source file is resolved, and obtains required product key message.
6. the described method of any one claim is characterized in that according to claim 1-5, and described product key message comprises: name of product, hardware version, national version, current software version and/or the tabulation of historical compatible version.
7. the system of the key message of embedded product when compiling is characterized in that described system comprises compilation script file, source file and link script file, wherein:
Described compilation script file, the product key message character string that is used for compiler directive is imported into passes to described source file;
Described source file is used for described product key message is passed through the macro definition escape, forms the source code that comprises the product key message;
Described link script file is for a section that the described source code that comprises the product key message is generated as separately binary file.
8. system according to claim 7 is characterized in that, described compilation script file specifically is used for:
Revise the compiler directive file, control the different compile option of compilation script File Open and compiler directive by the utility command switch;
Obtain product key message and the described corresponding source file of product key message that needs compiling that needs compiling by described compile option and compiler directive;
The described product key message of compiling that needs is passed to corresponding source file.
9. system according to claim 7 is characterized in that, described link script file specifically is used for:
The described source code that comprises the product key message is generated as separately a section;
Seeking the address that can not be modified in internal memory deposits.
10. the described system of any one claim according to claim 7-9, it is characterized in that, described system also comprises external tool software, and described external tool software is used for obtaining required product key message by the section that comprises the product key message of searching binary file.
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 true CN103077066A (en) 2013-05-01
CN103077066B 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)

Cited By (5)

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

Citations (4)

* 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
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

Patent Citations (4)

* 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
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

Cited By (7)

* 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
CN103984566A (en) * 2014-02-21 2014-08-13 北京神舟航天软件技术有限公司 In-orbit fine-grained performance function addition method
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
CN107871066A (en) * 2016-09-28 2018-04-03 传化物流集团有限公司 code compiling method and device based on Android system
CN107871066B (en) * 2016-09-28 2020-10-09 传化物流集团有限公司 Code compiling method and device based on android system
CN112650501A (en) * 2020-12-31 2021-04-13 重庆芯讯通无线科技有限公司 Compiling, terminal equipment and compiling link and loading method of client application program thereof

Also Published As

Publication number Publication date
CN103077066B (en) 2016-08-31

Similar Documents

Publication Publication Date Title
CN109523383B (en) Intelligent contract conversion system and method
CN106796522B (en) System and method for updating source code file
CN110704063B (en) Method and device for compiling and executing intelligent contract
CN110870249A (en) System and method for compiling high-level language code into scripts executable on a blockchain platform
CN111095338A (en) System and method for executing different types of blockchain contracts
CN108139896A (en) EVM(extended virtual machine) instruction set framework
CN101253478A (en) Type inference and type-directed late binding
CN106598556A (en) User interface generation method and device
CN101169718A (en) System and method for instantiating abstract class
CN105446725A (en) Method and system for model driven development
CN103077066A (en) Method and system for embedding product key information during compiling
JP2007141173A (en) Compiling system, debug system and program development system
CN108139891A (en) Include suggesting for the missing of external file
JP4638484B2 (en) Data integrity in data processing equipment
CN108874438A (en) Patch generation method, device, electronic equipment and computer program product
CN102375778A (en) Method and system for automatically testing digital signal processor (DSP)
KR20080008969A (en) System and method for change logging in a firmware over the air development environment
KR20090064397A (en) Register-based instruction optimization for facilitating efficient emulation of an instruction stream
US8612951B2 (en) Method of determining which computer program functions are changed by an arbitrary source code modification
CN101185116A (en) Using strong data types to express speech recognition grammars in software programs
CN101533454B (en) Compiling method
CN106055375A (en) Application program installation method and device
CN114327477A (en) Intelligent contract execution method and device, electronic device and storage medium
US20090187897A1 (en) Compiling method and compiling program
CN102236573A (en) Name binding extensibility for typed programming language

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

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.

TR01 Transfer of patent right