Preliminary attempt to modify PPC font

Source: Internet
Author: User
Tags 0xc0 what parameter
Now let's try to modify a software font. In fact, there is only one PPC font function (I know), that is, the createfontindirectw function, although there is also a createfont in MFC, but this is only the encapsulation of createfontindirectw. Isn't there a getstockobject in Win32? Unfortunately, it can only generate one font, namely system_font, and the display is normal, so getstockobject does not have to be considered. So it seems that the font problem is simple ......, However, some PPC programs use dynamic libraries such as the MFC library. There is no easy-to-use DEBUG. Therefore, it is difficult to modify many programs. I am still in the exploratory stage.

Let's first introduce the createfontindirectw function:

Hfont createfontindirect (
Const logfont * lplf
);
Parameters
Lplf

[In] Long pointer to a logfont structure that defines the characteristics of the logical font.

Return values
A handle to a logical font indicates success. null indicates failure. To get extended error information, call getlasterror.

The above is an introduction to the ppc2003 SDK, which is also available in msdn. This function has only one parameter, that is, the logfont struct. The return value is a font handle. If the call fails, null is returned. Logfont is a struct defined as follows:
This structure defines the attributes of a font.
Typedef struct taglogfont {
Long lfheight;
Long lfwidth;
Long lfescapement;
Long lforientation;
Long lfweight;
Byte lfitalic;
Byte lfunderline;
Byte lfstrikeout;
Byte lfcharset;
Byte lfoutprecision;
Byte lfclipprecision;
Byte lfquality;
Byte lfpitchandfamily;
Tchar lffacename [lf_facesize];
} Logfont;
Do you need to introduce these parameters? The first one is the font height. There is charset, which sets the character set, but it seems useless in PPC. The last one is the body name, such as "" and "tahoma. Next I tried to change the font of the next software.
The first passive knife is a big tree (who is a big tree? Of course, it's romantic, and Yushu ...... Go to bbs.hanzify.org and ask by yourself: hanhua funnysnake tkcreater is a very useful topic editing software. This software almost does not have a standard font on my PDA-_-B, of course, it is to first modify the standard font. I found that the font of the dialog box is tahoma 8, which may be the resolution of my PDA. Poor display. So I changed them to tahoma 9, and some of them showed better results. However, there are still many bad fonts on the interface, such as the main interface:


Open Ida pro disassembly, search for the font string, and find the following:

A total of seven items are found. Analyze the first part first:

We know that createfontindirectw has only one parameter. We will analyze the previous article. The first four parameters are passed through registers. So the address of logfont is in R0. Look at the figure above. IDA has marked it. The value in R0 is SP + #0xc0 + var_bc. The first parameter is the font height. We can go up and find the place to set the font height:

MoV R3, # 0xd

STR R3, [Sp, #0xc0 + var_bc]

Put 0d into R3, and then R3 into SP + #0xc0 + var_bc. So the font height is 0d. I tried to change the font height to 0e, and the others are also changed to 0e. It's just a little troublesome:

 


First, we can see that the parameter is in R4. Look at the front:

First, the font height is in R7, and the first line is from R2. R2 is the second parameter passed in by this function, so there are two ways to change it: first, change mov R7 and R2 to mov R7 and 0x0e. No matter what parameter is input, the result is the 0x0e font. Another method is to change it outside the function:

Double-click the yellow part in the figure and you will be directed to the call.

Modify it here. After all the modifications are completed, the results are as follows:

But ......


Is it true that the menu is like this? It turned out that there were two lines of fonts stacked. After the font size is changed, it turns into a purple sauce. And as long as the page is changed, the font of the main interface will be finished. After a while, the font will be changed. (This is too troublesome and I will not write it ). Unfortunately, the last line of time cannot be completed. It's not a perfect solution. Another weakness is the connection to the dialog box. I have not found any change.

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.