Skip to content

Commit

Permalink
GetProcAddress() returns a FARPROC, which is a very generic function …
Browse files Browse the repository at this point in the history
…pointer. Casting it is unnecessary (except when looking at the return value, I think) and can generate warnings and errors. My thanks to Arnold Tremblay and Chuck Haatvedt for testing this out on other forks of Windows.
  • Loading branch information
Bill-Gray committed Apr 16, 2023
1 parent b9d7b07 commit bbae4bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Defined by this header:
#define PDC_VER_CHANGE 6
#define PDC_VER_YEAR 2023
#define PDC_VER_MONTH 04
#define PDC_VER_DAY 12
#define PDC_VER_DAY 15

#define PDC_STRINGIZE( x) #x
#define PDC_stringize( x) PDC_STRINGIZE( x)
Expand Down
11 changes: 5 additions & 6 deletions wingui/pdcscrn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,8 @@ an exact number of rows/columns results in cascading resize attempts.
So we check on initialization to see if we're in Wine; if we are,
resizes are skipped. */

typedef const char *(CDECL *wine_version_func)(void);

static wine_version_func wine_version;
static FARPROC wine_version;

static void HandleSize( const WPARAM wParam, const LPARAM lParam)
{
Expand Down Expand Up @@ -2221,13 +2220,13 @@ int PDC_scr_open(void)
PDC_LOG(("PDC_scr_open() - called\n"));

if( hntdll)
wine_version = (wine_version_func)GetProcAddress(hntdll, "wine_get_version");
wine_version = GetProcAddress(hntdll, "wine_get_version");

if ( shcoredll) {
typedef HRESULT(STDAPICALLTYPE *set_process_dpi_awareness_t)(int);
static set_process_dpi_awareness_t set_process_dpi_awareness_func;
static int ADJUST_DPI_PER_MONITOR = 2;
set_process_dpi_awareness_func = (set_process_dpi_awareness_t)GetProcAddress(shcoredll, "SetProcessDpiAwareness");
FARPROC set_process_dpi_awareness_func =
GetProcAddress(shcoredll, "SetProcessDpiAwareness");

if ( set_process_dpi_awareness_func) {
set_process_dpi_awareness_func(ADJUST_DPI_PER_MONITOR);
}
Expand Down

0 comments on commit bbae4bb

Please sign in to comment.