TextOutA and TextOutW Functions

Source: Internet
Author: User

This is still introduced when learning character encoding.
The original intention is to feel that since character encoding is so common, how does the operating system do it? So I want to debug the textouta function to see how it handles character encoding when outputting text. The final result is:
Textouta actually encapsulates another function call. The process of textouta is like this:
Bool textouta (
HDCHdc, // Handle to DC
IntNXStart, // X-coordinate of starting position
IntNYStart, // Y-coordinate of starting position
LpctstrLpString, // Character string
IntCbString// Number of characters
){
If (cbstring <= 0 ){
JMP 77f0fd46h
}
If (lpString = NULL ){
Jmp 77F0FD46h
}
PROC lpFunc = (PROC) 0x77EF8E4E;
LpFunc (hdc, nXStart, nYStart, 0, 0, lpString, cbString, 0, 1 );
}
In the above pseudo code, lpFunc calls the GdiGetCodePage function and the MultiByteToWideChar function in turn, and then calls the code at an address (77EF664F on my computer, the next step is other work, while TextOutW directly calls the code at the 77EF664F address.

The above is the conclusion of debugging for several hours. In fact, all these things can be seen through static analysis, which is simpler. This conclusion is meaningless later. However, for a few hours of debugging, I will keep it down for the time being.

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.