Menu

#375 C/DllSecur.c compilation fix for Mingw32 GCC

open
nobody
gcc (1)
3
2021-11-11
2021-11-11
Charlie Lin
No

Small compilation patch:

When compiling with Mingw32 GCC, it complains:
../../../../C/DllSecur.c:69:50: error: cast between incompatible function types from 'FARPROC' {aka 'long long int ()()'} to 'BOOL ()(DWORD)' {aka 'int (*)(long unsigned int)'} [-Werror=cast-function-type]
69 | Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)

The attachted file fixes the issue by calling SetDefaultDllDirectories directly, instead of getting the function's address via getprocaddress.

1 Attachments

Discussion

  • Anders

    Anders - 2021-11-11

    This obviously changes the behavior of the program and it would refuse to run on Windows 7 without KB2533623 installed.

     
  • Igor Pavlov

    Igor Pavlov - 2021-11-11

    Your code will not work in Windows XP system that don't support SetDefaultDllDirectories() function..

     
  • Igor Pavlov

    Igor Pavlov - 2021-11-11

    I tried to google that problem.
    And there is such suggestion there:

    (void(*)())GetProcAddress
    

    Please try it, and write here about results.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.