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:

  1. write set of wrapper functions, e.g mycreatefile, myreadfile, etc, call corresponding api , pass same arguments along, unmodified.
  2. use text editor search calls original apis, , replace these calls new wrapper functions.
  3. test application still functions correctly.
  4. 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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -