Saveliy Tretiakov wrote:
Maybe this is because you pressed cancel button and ERROR_CALL_NOT_IMPLEMENTED was set somewhere else? It returns FALSE when cancel button is pressed.
no, in my copy of win XP calling drvCommConfigDialogA always returns ERROR_CALL_NOT_IMPLEMENTED. Calling the unicode version works, it returns FALSE/0/ERROR_SUCCESS or ERROR_CANCELLED when correct parameters are passed to it.
From CommConfig dialog description: If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call *GetLastError*.
I'm talking about drvCommConfigDialog, not CommConfig. However CommConfig calls drvCommConfigDialog, which appears to return ERROR_SUCCESS, ERROR_CANCELLED or another win32 error code, which is not a BOOL.
I think drvCommConfigDialog should return the same.
As i mentioned above, it appears to return a win32 error code, not a BOOL in windows XP, which leads to the conclusion that drvCommConfigDialog doesn't have the exact same prototype as CommConfig.
Maybe adding SetLastError(ERROR_CANCELLED) and SetLastError(ERROR_SUCCESS) will solve the problem?
I propose only CommConfig should set the last error, if drvCommConfigDialog didn't return ERROR_SUCCESS or ERROR_CANCELLED. Then returning TRUE from CommConfig when drvCommConfigDialog returned ERROR_SUCCESS and returning FALSE in all other cases should implement it correctly. Instead of setting the last error code in drvCommConfigDialog, the function should return it directly.
Best Regards, Thomas