On Mar 25, 2013, at 8:51 PM, Hugh McMaster wrote:
I've written a function to determine the largest possible screen buffer that wineconsole is able to display. This function replaces the hard-coded constants listed in both instances of GetLargestConsoleWindowSize in dlls/kernel32/console.c.
[snip] #include <windows.h> #include <winuser.h>
[snip]
COORD GetLargestConsoleWindowSize_helper(HANDLE hConsoleOutput) { RECT workarea; COORD console_fontsize; COORD max_console;
SystemParametersInfoA(SPI_GETWORKAREA, 0, &workarea, 0); console_fontsize = GetConsoleFontSize(hConsoleOutput, 0);
max_console.X = (workarea.right / console_fontsize.X) - 6; max_console.Y = (workarea.bottom / console_fontsize.Y) - 6;
return max_console; }
While dlls/kernel32/console.c compiles, I'm having trouble with the final compile-time linking. It seems that SystemParametersInfoA is an undefined reference, but windows.h and winuser.h are included in console.c.
This won't be able to work. The linker error is telling you, effectively, that you're not importing user32. However, kernel32 can't import user32. Kernel32 is at a lower level than user32. And a console program especially can't rely on user32 being loaded and initialized to satisfy the request you're making.
Regards, Ken