Hello,
I am currently exploring Wine code base looking for low hanging fruits I can contribute to. I think CoInternetParseUrl and other URLMon stubs seemed easy enough I want to try and implement some. I also see many URLMon stubs when using Wine for games and applications.
In CoInternetParseUrl, you use a switch case depending on the parameters passed. These in turn call specific methods for each parameter, which most do the same thing, call IInternetProtocolInfo_ParseUrl with the desired parse option . This function is defined in urlmon header. It seems to call a saved This on runtime, derefencing a saved (?) virtual table calling ParseUrl. It is also implemented in the header (static FORCEINLINE) and also calls the ParseUrl.
There are some STDMETHODCALLTYPE pure virtual methods inside a IInternetProtocoleInfo class. A struct virtual table IInternetProtocolInfoVtbl O_o I cannot find the actual ParseUrl implementation, though in misc.c, there are many references to CHECK_CALLED(ParseUrl) and SET_EXPECT(ParseUrl). I have no clue what is going on here to be completely honest.
Finally, in misc.c there are some pCoInternetParseUrl and CoInternetParseUrl tests. But nothing that seems to implement what I need.
My question is, why go through all these hoops instead of implementing CoInternetParseUrl inside internet.c. I am sure there is good reasoning behind this, I would just like to understand why. Also, where do I implement ParseUrl or IInternetProtocolInfo_ParseUrl?
Thank you for any help in understanding what is going on here. Good day, Philippe
Hi Philippe,
On 04/05/15 22:04, Philippe Groarke wrote:
Hello,
I am currently exploring Wine code base looking for low hanging fruits I can contribute to. I think CoInternetParseUrl and other URLMon stubs seem*ed* easy enough I want to try and implement some. I also see many URLMon stubs when using Wine for games and applications.
In CoInternetParseUrl, you use a switch case depending on the parameters passed. These in turn call specific methods for each parameter, which most do the same thing, call IInternetProtocolInfo_ParseUrl with the desired parse option . This function is defined in urlmon header. It seems to call a saved This on runtime, derefencing a saved (?) virtual table calling ParseUrl. It is also implemented in the header (static FORCEINLINE) and also calls the ParseUrl.
You should learn about COM interfaces and how they are used in C.
There are some STDMETHODCALLTYPE pure virtual methods inside a IInternetProtocoleInfo class. A struct virtual table IInternetProtocolInfoVtbl O_o I cannot find the actual ParseUrl implementation, though in misc.c, there are many references to CHECK_CALLED(ParseUrl) and SET_EXPECT(ParseUrl). I have no clue what is going on here to be completely honest.
Finally, in misc.c there are some pCoInternetParseUrl and CoInternetParseUrl tests. But nothing that seems to implement what I need.
My question is, why go through all these hoops instead of implementing CoInternetParseUrl inside internet.c. I am sure there is good reasoning behind this, I would just like to understand why. Also, where do I implement ParseUrl or IInternetProtocolInfo_ParseUrl?
All this is for pluggable protocols. Applications may define and register their own protocols, other than standard ones like http or file protocols, and have them transparently used by urlmon, which abstracts protocol-specific tasks. In this case, default parsing action may not be the right thing to do for given custom protocol and may be changed by implementing protocol-specific IInternetProtocolInfo. You may read more about it on MSDN [1].
Cheers, Jacek
[1] https://msdn.microsoft.com/en-us/library/aa767743%28v=vs.85%29.aspx