@ChristopherWu
2017-03-06T22:53:49.000000Z
字数 2799
阅读 1283
Wine
Implementing functions from tr2 namespace
Abstract: All the functions from tr2 namespace are not implemented. This project plan to implement all of them, which would fix some bugs and benefit wine's behavior on many softwares.
Hi, all
I'm YongHao Hu, a college student majored in Computer Science from Guangdong Pharmaceutical University, China, GMT+08:00. I have studied wine developing for a year and submitted some patches1. I have enough understanding regarding the Wine community and msvcp module.
There are three parts in my plan:
In order to have a good understanding of the functions, currently I am designing test case for msvcp110, which was discussed on wine-dev. In order to finish a set of tests, I need to figure out all the unimplemented functions' dependences by reading MSDN2 and testing them on Windows.
For example, I can use create_directory to create a test directory, then use remove_directory to delete it. After creating a set of test files, we can test copy_file, last_write_time, and create_hard_link etc.
The hard part of this is guessing the origin function by demangle name and parameters, as some of them are not exactly matched at all. For example, a function like "@ stub -arch=win32 int __cdecl std::tr2::sys::_Link(char const *,char const *)" after demangling, it is hard to know whether it is create_hard_link function3 or create_symlink function4.
I come up with an idea which is compiling an exe on windows using a specific function like create hard link, then use Wine to execute it, and you can see an error which is "unimplemented function xxx". We can easily know that create hard link function's symbol is xxx.
After designing a set of tr2 tests, it is natural that I would have a good knowledge of the functions' usage. Then, I would implement the function from easy to hard.
Some troubles I might get in here:
1). The return value of function in MSDN is different from the one after demangle while the functions in MSDN are wrappers of stub functions in wine.
For example, copy_file5 function is a inline function which return void while "int __cdecl std::tr2::sys::_Copy_file(char const *,char const *,BOOL)" in WINE is int. Thus, I need to study what's the usage of _Copy_file's return value.
2). Deduce the function's code from its return value and parameter.
I have tried to implement file_size using ftell, finding that file_size's return value is unsigned long long while ftell is int, which implies that it's not correct to use ftell to implement file_size.
When I have finished the functions of char version, it's easy to finish their's wchar version.
From May to August, I will have plenty of time to finish my plan.Moreover,d I have strong confidence to finish it perfectly.
Since I have kept learning the Wine source code for a year, I know clearly how hard it is to develop on wine .
The above plan would keep me busy and Happy Hacking in Wine :-)
My schedule for GSoC project:
3 weeks for deeply studying the functions and designing test case
6 weeks for implementing functions of char version
2 weeks for implementing functions of wchar version
Thank you for reading my plan. I will be grateful for any advice you can provide.