CN1949175A - Method of displacing data in software - Google Patents

Method of displacing data in software Download PDF

Info

Publication number
CN1949175A
CN1949175A CN 200610114295 CN200610114295A CN1949175A CN 1949175 A CN1949175 A CN 1949175A CN 200610114295 CN200610114295 CN 200610114295 CN 200610114295 A CN200610114295 A CN 200610114295A CN 1949175 A CN1949175 A CN 1949175A
Authority
CN
China
Prior art keywords
data
sign
binary file
replaceable
replaceable data
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
CN 200610114295
Other languages
Chinese (zh)
Other versions
CN100533383C (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.)
Feitian Technologies Co Ltd
Original Assignee
Beijing Feitian Technologies 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 Beijing Feitian Technologies Co Ltd filed Critical Beijing Feitian Technologies Co Ltd
Priority to CNB2006101142950A priority Critical patent/CN100533383C/en
Publication of CN1949175A publication Critical patent/CN1949175A/en
Application granted granted Critical
Publication of CN100533383C publication Critical patent/CN100533383C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses software data replacement method. It includes the following steps: using special mark to express replaced data length and position in binary file; replacing according to them while needs. The invention can directly process data replacement for the appointed binary file without in source program which can avoid renewing compilation. It also can be used in the occasion that the user needs data replacement; while program developer doesn't hope him to obtain source program.

Description

A kind of method that data in the software are replaced
Technical field
The present invention relates to software programming technique, specifically, relate to a kind of method that data in the software are replaced.
Background technology
Comprise operational order and data in the computer software.During software developer's making software, often have the essentially identical software of many functions each other, it is basic identical that these softwares are carried out functions, therefore has the identical operations order, and still, the operated data object of same operational order is often also inequality.At above-mentioned situation, software development manufacturer has taked some measures to realize the data division of same software is replaced for avoiding repeating work, so that make same software can be use repeatedly.
For example, a kind of widely used substitute mode is to utilize external software to replace in the prior art.Corresponding to replaceable software, has corresponding resource index in the external software.When needs read replaceable data in the replaceable software, only need transfer corresponding external software, obtain corresponding data according to described index and get final product.For example: replaceable software A, its replaceable data are character display a, b, c, corresponding index is 001,002,003, external software is B, C, be respectively Chinese edition and English edition, index 001 representative " I " among the B, 002 representative " you ", 003 representative " he ", index 001 representative " me " among the C, 002 representative: " you ", 003 representative " him ".When needs read replaceable content a in this replaceable software, b during c, only needs according to B being called in the selection of language or C gets final product.The defective of above-mentioned prior art is, this substitute mode realizes in source program, and program ultimate demand compiling becomes the executable file of binary mode and could carry out, therefore, this substitute mode need compile again to program, can not directly utilize and compile the binary file of finishing, cause resource and waste of time.
When under the Windows environment, carrying out the replacement work of resource data; the developer finishes based on the principle of Resource Hack usually; the principle of Resource Hack is: under the Windows environment; binary file in the software is the PE form; after reading binary file, can resolve, split wherein specific data.Based on this principle, Resource Hack can directly check, revise data resources such as the menu, dialog box, string table of software.But Resource Hack can only be used for replacing the data relevant with operation interface, and can only be at the binary file of PE form.Therefore, this mode has significant limitation.
Summary of the invention
At above-mentioned defective, the technical matters that the present invention solves is, provide a kind of can self-defined replaceable content and directly binary file is carried out the method that data in the software that data replace are replaced.
A kind of method that data in the software are replaced of the present invention may further comprise the steps:
11) compiling obtains the binary file that replaceable data are provided with sign;
12) according to described sign, retrieval obtains the position of replaceable data in binary file;
13) according to the position of described replaceable data in binary file, desired data is replaced former data.
Preferably, described step 11) comprises:
When the establishment source program, described sign and replaceable data are connected on the source program statement;
Compile described source program, obtain the binary file that replaceable data are provided with sign.
Preferably, described sign is the self-defining character string of being made up of a plurality of bytes, or the self-defining identification string of being made up of the data of certain-length.
Preferably, described sign has overall uniqueness.
Preferably, described sign with overall uniqueness specifically is to adopt the self-defining sign of the unified identifier of the overall situation.
Preferably, described replaceable data are a plurality of, and each replaceable data has independently overall separately unified identifier respectively as sign.
Preferably, described replaceable data are a plurality of, and wherein continuous replaceable data can adopt the unified identifier of the same overall situation as sign.
Preferably, described replaceable data can adopt a table of comparisons to come record with the relation of the unified identifier of the overall situation.
Preferably, described step 12) comprises:
Open the binary file that has replaceable Data Identification;
Read described binary file, and in this document, retrieve the sign of described replaceable data;
According to the sign of described acquisition, determine the position of replaceable data in this binary file.
Basic ideas of the present invention are for the data that need in the binary file to replace, to adopt specific identifier to express its length and position in binary file.When needs were replaced, then described replacement was carried out in length and the position of data in binary file that will replace according to this sign acquisition.Described sign can once adopt the unified identifier of the overall situation to replace.
Compared with prior art, technical scheme provided by the invention can directly be carried out the data replacement at binary file, and need not to carry out in source program, has so just removed the process that compiles again from; Be applicable to that the user need carry out data and replace, and program developer is not wished the occasion that it knows source program yet.The mode of comparing and adopt Resource Hack principle to replace, this method is not subjected to the restriction of the form of binary file, is not subjected to the restriction of data content yet.
Description of drawings
Fig. 1 is the overview flow chart of first embodiment of the invention;
Fig. 2 is the binary coding file of the standard software of first embodiment of the invention;
Fig. 3 is the process flow diagram of first embodiment of the invention step S1;
Fig. 4 is the process flow diagram of first embodiment of the invention step S2;
Fig. 5 is that first embodiment of the invention is carried out the binary coding file that data are replaced the back acquisition.
Embodiment
Software data replacement method provided by the invention, its basic ideas are: in standard software, the data that adopt the only identity marking of the overall situation to replace can define position and the length of these data in binary file by this sign.Need to generate when replacing software,, find the data that need replacement, and use new data to replace described data according to the described sign that is provided with in the binary file.
Please, be the overview flow chart of first embodiment of the invention referring to Fig. 1.
As shown in Figure 1, the method that provides of this embodiment comprises two big steps:
Step S1 compiles the binary file that replaceable data have sign.
Step S2 carries out data according to the described sign in the binary file and replaces.
" this embodiment of program description.Below be the source program of this program, Fig. 2 is the binary coding file that obtains after this program compilation, and reads this binary-coded content with ASCII character.
//Replace.cpp:Defines?the?entry?point?for?the?console?application...........1
// 2
#include″stdafx.h″ 3
#include<Windows.h> 4
typedef?struct_ES_REPLACE_DATA 5
{ 6
GUID?Loc_flag; 7
DWORD?ulStructSize; 8
char?szString[40]; 9
}ES_REPLACE_DATA; 10
ES_REPLACE_DATA?ReplaceData= 11
{ // GUID?Loc_flag; 12
//{CD6A1906-400B-46c2-9DCB-918C135BA910} 13
{0xcd6a1906,0x400b,0x46c2,0x9d,0xcb,0x91,0x8c,0x13,0x5b,0xa9,0x10},14
//DWORD?ulStructSize; 15
sizeof(ES_REPLACE_DATA), 16
// string?to?print; 17
(″Hello?World!\n″), 18
}; 19
int?main(int?argc,char*argv[]) 20
{ 21
printf(ReplaceData.szString); 22
return?0; 23
} 24
" be the data that need replacement. " on screen, export.
As shown in Figure 3, this figure is the concrete steps of step S1.Describe below in conjunction with this process flow diagram.For convenient explanation, this embodiment provides corresponding to said procedure.
Step S101 determines the replaceable data that need replace.
".
Step S102 determines user-defined identification.
" sign.In the present embodiment, by using the character string CD6A1906-400B-46c2-9DCB-918C135BA910 in the unified identifier function G of the overall situation UID acquisition source program.The English of the unified identifier of the overall situation is Globally Unique Identifier, is abbreviated as GUID.This identifier produces 128 number by a special algorithm, adopts this kind algorithm can guarantee not produce the sign of repetition.So just can avoid owing to identifying the replacement that repetition makes a mistake.
Step S103 when writing source code, writes the user-defined identification symbol before the code of replaceable data. " code before write user-defined identification symbol " CD6A1906-400B-46c2-9DCB-918C135BA910 " as user-defined identification.
The the 5th to the 10th row at source program defines a data type ES_REPLACE_DATA, and this data type comprises three data, and data 1 are the unified identifiers of the overall situation; Data 2 are two-octet types, the length of sign notebook data; Data 3 are character types.
The the 11st to the 19th row at source program uses above-mentioned data type ES_REPLACE_DATA defining variable ReplaceDate, and is this variable assignments.Wherein, the 14th line program is exactly the unified identifier " CD6A1906-400B-46c2-9DCB-918C135BA910 " of the overall situation.The 18th row content be need to print " Hello Word! ". " the unified identifier " CD6A1906-400B-46c2-9DCB-918C135BA910 " of the overall situation appears before.As long as in source program, the unified identifier of the overall situation can be connected with replaceable data, be compiled as binary code after, both binary codes will connect, the effect of generation sign.
Step S104, compiled code, the standard software of generation binary mode.
When compiled code, the program segment of defining variable ReplaceDate can be compiled line by line in the source program, like this, in the binary file after compiling, the described unified identifier of the overall situation " CD6A1906-400B-46c2-9DCB-918C135BA910 " will be at the replaceable data of needs " Hello World! " occur before.
" the ASCII character symbol.Obtain through above-mentioned processing in the standard software of binary mode, just can need the content of replacement by described identifier identification.In described binary file because when storage low level preceding, high-order after, and be high-order preceding when showing, low level after, so the unified identifier of the described overall situation look with source program in the overall situation data bit of unifying identifier have staggeredly, but be actually consistent.
Following description of step S2 promptly carries out the step that data are replaced according to the mark in the binary file. ".Please, be the process flow diagram of this step referring to Fig. 4.
Step S201 opens and reads the binary file of above-mentioned standard software.
Step S202 retrieves user-defined identification in binary file, in described program, this sign is exactly the unified identifier CD6A1906-400B-46c2-9DCB-918C135BA910 of the overall situation.
Because CD6A1906-400B-46c2-9DCB-918C135BA910 is that the overall situation that impossible repeat is unified identifier, therefore, must have only a position to have this variable in this binary file, as long as retrieve this variable, just must be identifier.
Step S203 unifies the position of identifier according to retrieving the overall situation that obtains, and determines replaceable Data Position.
Because during the compiling standard software, position relation between this string token and the replaceable content is determined, therefore, after retrieval obtains the position of the unified identifier CD6A1906-400B-46c2-9DCB-918C135BA910 of the described overall situation, just can obtain the position of described replaceable data.
", obtain replacing software.
Fig. 5 illustrates the binary file coded file that this replacement back obtains. " the position on replace by " Replace String ".
In the foregoing description, just in fact the process that a data variable is replaced, may exist a plurality of replacement variablees.The Globally Unique Identifier of corresponding each replaceable data in the standard software can be recorded in retrieval use when supply and demand will be replaced in the data library file.Like this, just can set up the mapping table of whole Globally Unique Identifier and replaceable data, when needs carry out the data replacement, obtain the globally unique identifier of the data correspondence of needs replacement according to this table search, thereby carry out described replacement.
Should illustrate that a Globally Unique Identifier can also can as long as these continuous datas need be replaced together, just can adopt same Globally Unique Identifier corresponding to a plurality of continuous replaceable data corresponding to replaceable data.Replaceable data for disperseing then are necessary for each data special Globally Unique Identifier are set.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (9)

1, a kind of method that data in the software are replaced is characterized in that, comprising:
11) compiling obtains the binary file that replaceable data are provided with sign;
12) according to described sign, retrieval obtains the position of replaceable data in binary file;
13) according to the position of described replaceable data in binary file, desired data is replaced former data.
2, method according to claim 1 is characterized in that, described step 11) comprises:
When the establishment source program, described sign and replaceable data are connected on the source program statement;
Compile described source program, obtain the binary file that replaceable data are provided with sign.
3, method according to claim 1 is characterized in that, described sign is the self-defining character string of being made up of a plurality of bytes, or the self-defining identification string of being made up of the data of certain-length.
4, method according to claim 3 is characterized in that, described sign has overall uniqueness.
5, method according to claim 4 is characterized in that, described sign with overall uniqueness specifically is to adopt the self-defining sign of the unified identifier of the overall situation.
6, method according to claim 5 is characterized in that, described replaceable data are a plurality of, and each replaceable data has independently overall separately unified identifier respectively as sign.
7, method according to claim 5 is characterized in that, described replaceable data are a plurality of, and wherein continuous replaceable data can adopt the unified identifier of the same overall situation as sign.
8, according to claim 6 or 7 described methods, it is characterized in that, adopt a table of comparisons, write down the relation of described replaceable data and the unified identifier of the overall situation.
9, method according to claim 1 and 2 is characterized in that, described step 12) comprises:
Open the binary file that has replaceable Data Identification;
Read described binary file, and in this document, retrieve the sign of described replaceable data;
According to the sign of described acquisition, determine the position of replaceable data in this binary file.
CNB2006101142950A 2006-11-03 2006-11-03 Method of displacing data in software Active CN100533383C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101142950A CN100533383C (en) 2006-11-03 2006-11-03 Method of displacing data in software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101142950A CN100533383C (en) 2006-11-03 2006-11-03 Method of displacing data in software

Publications (2)

Publication Number Publication Date
CN1949175A true CN1949175A (en) 2007-04-18
CN100533383C CN100533383C (en) 2009-08-26

Family

ID=38018703

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101142950A Active CN100533383C (en) 2006-11-03 2006-11-03 Method of displacing data in software

Country Status (1)

Country Link
CN (1) CN100533383C (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102511033A (en) * 2009-09-25 2012-06-20 国际商业机器公司 Object level compatibility and class resizing utilizing semantic values
CN103677821A (en) * 2013-12-05 2014-03-26 金蝶软件(中国)有限公司 Method and device for publishing software development tool code
CN104281443A (en) * 2013-07-12 2015-01-14 重庆重邮信科通信技术有限公司 Methods for implementing code and data replacement by TCM (tightly coupled memory)
CN105867953A (en) * 2015-01-21 2016-08-17 中国移动通信集团云南有限公司 Application upgrading package generation method, application upgrading method and corresponding apparatuses
US10019240B2 (en) 2012-11-30 2018-07-10 Huawei Technologies Co., Ltd. Method and apparatus for detecting code change
CN108388548A (en) * 2018-02-24 2018-08-10 浪潮软件集团有限公司 Method and device for realizing script parameterization

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102511033A (en) * 2009-09-25 2012-06-20 国际商业机器公司 Object level compatibility and class resizing utilizing semantic values
US8813045B2 (en) 2009-09-25 2014-08-19 International Business Machines Corporation Object level compatibility and class resizing utilizing semantic values
CN102511033B (en) * 2009-09-25 2014-09-03 国际商业机器公司 Object level compatibility and class resizing utilizing semantic values
US10019240B2 (en) 2012-11-30 2018-07-10 Huawei Technologies Co., Ltd. Method and apparatus for detecting code change
CN104281443A (en) * 2013-07-12 2015-01-14 重庆重邮信科通信技术有限公司 Methods for implementing code and data replacement by TCM (tightly coupled memory)
CN103677821A (en) * 2013-12-05 2014-03-26 金蝶软件(中国)有限公司 Method and device for publishing software development tool code
CN105867953A (en) * 2015-01-21 2016-08-17 中国移动通信集团云南有限公司 Application upgrading package generation method, application upgrading method and corresponding apparatuses
CN105867953B (en) * 2015-01-21 2019-04-26 中国移动通信集团云南有限公司 Application program updating packet generation method and application program updating method and corresponding intrument
CN108388548A (en) * 2018-02-24 2018-08-10 浪潮软件集团有限公司 Method and device for realizing script parameterization
CN108388548B (en) * 2018-02-24 2021-08-31 浪潮软件股份有限公司 Method and device for realizing script parameterization

Also Published As

Publication number Publication date
CN100533383C (en) 2009-08-26

Similar Documents

Publication Publication Date Title
CN1297936C (en) Method and system for comparing files of two computers
CN1949175A (en) Method of displacing data in software
CN1190053C (en) Off-line data configuration method for communication equipment
CN1278231C (en) Method and system for converting abstract syntax notation 1 data model to object model
CN105069033A (en) Method and device for creating database table model
CN1851667A (en) Graphic user interface test method and system
CN1371499A (en) Object property meta model emulator for legacy data structures
CN1885265A (en) System and method for localizing JAVA GUI application without modifying source code
CN1821964A (en) Method and apparatus for inlining native functions into compiled java code
CN1967476A (en) Pseudo translation within integrated development environment
CN105183476B (en) A kind of construction method and device of cross-platform program
CN1858717A (en) Data coding and decoding method and its coding and decoding device
CN1848851A (en) Computer and method for establishing light weight catalog access data protocol exchange format fragment
CN1877531A (en) Embedded compiled system scanner accomplishing method
CN1645372A (en) Universal constraining realizing method for real-time internal memory database
CN1869926A (en) Method and system for generating artificial equipment panel
CN1658159A (en) Configurable and dynamically alterable object model
CN1525317A (en) System and method for defining and using subclasses declaratively within markup
CN100346308C (en) Automatic test method based on database operation
CN1462938A (en) Debuging device and debuging method
CN1896954A (en) Method for realizing structural dynamic compiler of complicated multi-service
CN101059758A (en) Screen transition program generating method and device
CN100343819C (en) Method for traversing and accessing object in tested application program
CN1276350C (en) System and method for updating BIOS via buffer area
CN1667610A (en) XML fast decoding method based on tags

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: FEITIAN TECHNOLOGIES CO., LTD.

Free format text: FORMER NAME: BEIJING FEITIAN CHENGXIN TECHNOLOGY CO., LTD.

CP03 Change of name, title or address

Address after: 100085 Beijing city Haidian District Xueqing Road No. 9 Ebizal building B block 17 layer

Patentee after: Feitian Technologies Co., Ltd.

Address before: 100083, Haidian District, Xueyuan Road, Beijing No. 40 research, 7A building, 5 floor

Patentee before: Beijing Feitian Chengxin Science & Technology Co., Ltd.