Page MenuHome GnuPG

Fix assignment of GetProcAddress to func
Needs RevisionPublic

Authored by CarlSchwan on Thu, Jun 6, 4:36 PM.

Details

Summary
  • src/gpgme-w32spawn.c: Change func signature to FARPROC --

GetProcAddress is documented as returning a FARPROC. Assigning it to a
BOOL (WINAPI * )(DWORD) won't compile with -Wincompatible-pointer-types

Test Plan

Compiles

Diff Detail

Repository
rM GPGME
Branch
work/carl/fixGetProcAddress
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

CarlSchwan created this revision.

The compile error:

../../gpgme-1.24.0-beta566/src/gpgme-w32spawn.c:252:20: error: assignment to 'BOOL (*)(DWORD)' {aka 'int (*)(long unsigned int)'} from incompatible pointer type 'FARPROC' {aka 'long long int (*)()'} [-Wincompatible-pointer-types]
  252 |               func = GetProcAddress (handle, "AllowSetForegroundWindow")

I think the correct fix is to C-cast the return value of GetProcAddress to the type of func which we would have to define with a typedef as in the example for GetProcAddress: https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress

This revision now requires changes to proceed.Wed, Jun 12, 1:45 PM