c++ - How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parameters set are the same)? -
i need replace winapi calls of the
- createfile,
- readfile,
- setfilepointer,
- closehandle
with own implementation (which use low-level file reading via bluetooth). code, functions replaced, video file player , works regular hdd files. needed, video player still can play files hdd, if file in videoplayer input regular hdd file.
what best practice such task?
i suggest follow these steps:
- write set of wrapper functions, e.g mycreatefile, myreadfile, etc, call corresponding api , pass same arguments along, unmodified.
- use text editor search calls original apis, , replace these calls new wrapper functions.
- test application still functions correctly.
- modify wrapper functions suit own purposes.
note createfile macro expands either createfilew or createfilea, depending on whether unicode defined. consider using lpctstr , tchar functions application can built either ansi or unicode.
please don't use #define, suggested in other responses here, lead maintenance problems, , maximilian correctly points out, it's not best-practice.
Comments
Post a Comment