http://bugs.winehq.org/show_bug.cgi?id=14855
Summary: Incorrect FindWindow/GetLastError error result when window not found Product: Wine Version: 1.1.2 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: vesselinpeev@hotmail.com
The following program (compiled to a Win32 binary) prints "Window not found (expected result)" under Microsoft Windows (tested with Vista), whereas it prints "Unexpected error, GetLastError() return value: 1407" when ran under Wine (tested with Wine 1.1.2).
It seems that FindWindow does not set the correct error value (ERROR_FILE_NOT_FOUND) when it doesn't find a window.
#include <windows.h> #include <stdio.h>
int main() { HWND hWnd = FindWindow("SomeWindowThatDoesNotExist", NULL); if(hWnd) { printf("hWnd not NULL"); } else { DWORD dwResult = GetLastError(); if(dwResult == ERROR_FILE_NOT_FOUND) { printf("Window not found (expected result)\n"); } else { printf("Unexpected error, GetLastError() return value: %lu\n", dwResult); } } return 0; }