Saveliy Tretiakov <saveliyt@mail.ru>:

serialui returns error codes directly.

svn path=/trunk/; revision=16862
This commit is contained in:
Thomas Bluemel 2005-07-29 13:50:05 +00:00
parent 91ae1adf27
commit 7fdc3cb55b
3 changed files with 32 additions and 30 deletions

View file

@ -834,7 +834,7 @@ STDCALL
CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
{ {
PWCHAR NameW; PWCHAR NameW;
BOOL result; DWORD result;
/* don't use the static thread buffer so operations in serialui /* don't use the static thread buffer so operations in serialui
don't overwrite the string */ don't overwrite the string */
@ -858,9 +858,9 @@ BOOL
STDCALL STDCALL
CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
{ {
BOOL (STDCALL *drvCommDlgW)(LPCWSTR, HWND, LPCOMMCONFIG); DWORD (STDCALL *drvCommDlgW)(LPCWSTR, HWND, LPCOMMCONFIG);
HMODULE hSerialuiDll; HMODULE hSerialuiDll;
BOOL result; DWORD result;
//FIXME: Get dll name from registry. (setupapi needed) //FIXME: Get dll name from registry. (setupapi needed)
if(!(hSerialuiDll = LoadLibraryW(L"serialui.dll"))) if(!(hSerialuiDll = LoadLibraryW(L"serialui.dll")))
@ -869,7 +869,8 @@ CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
return FALSE; return FALSE;
} }
drvCommDlgW = GetProcAddress(hSerialuiDll, "drvCommConfigDialogW"); drvCommDlgW = (DWORD (STDCALL *)(LPCWSTR, HWND, LPCOMMCONFIG))
GetProcAddress(hSerialuiDll, "drvCommConfigDialogW");
if(!drvCommDlgW) if(!drvCommDlgW)
{ {
@ -879,8 +880,10 @@ CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC)
} }
result = drvCommDlgW(lpszName, hWnd, lpCC); result = drvCommDlgW(lpszName, hWnd, lpCC);
SetLastError(result);
FreeLibrary(hSerialuiDll); FreeLibrary(hSerialuiDll);
return result;
return (result == ERROR_SUCCESS ? TRUE : FALSE);
} }

View file

@ -98,7 +98,7 @@ DllMain(HINSTANCE hInstance,
/* /*
* @implemented * @implemented
*/ */
BOOL WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice, DWORD WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice,
HWND hWnd, HWND hWnd,
LPCOMMCONFIG lpCommConfig) LPCOMMCONFIG lpCommConfig)
{ {
@ -106,7 +106,7 @@ BOOL WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice,
if(!lpszDevice || !lpCommConfig) if(!lpszDevice || !lpCommConfig)
{ {
return FALSE; return ERROR_INVALID_PARAMETER;
} }
DialogInfo.lpszDevice = lpszDevice; DialogInfo.lpszDevice = lpszDevice;
@ -119,7 +119,7 @@ BOOL WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice,
/* /*
* @implemented * @implemented
*/ */
BOOL WINAPI drvCommConfigDialogA(LPCSTR lpszDevice, DWORD WINAPI drvCommConfigDialogA(LPCSTR lpszDevice,
HWND hWnd, HWND hWnd,
LPCOMMCONFIG lpCommConfig) LPCOMMCONFIG lpCommConfig)
{ {
@ -136,13 +136,13 @@ BOOL WINAPI drvCommConfigDialogA(LPCSTR lpszDevice,
return result; return result;
} }
else else
return FALSE; return ERROR_NOT_ENOUGH_MEMORY;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI drvSetDefaultCommConfigW(LPCWSTR lpszDevice, DWORD WINAPI drvSetDefaultCommConfigW(LPCWSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
DWORD dwSize) DWORD dwSize)
{ {
@ -152,7 +152,7 @@ BOOL WINAPI drvSetDefaultCommConfigW(LPCWSTR lpszDevice,
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI drvSetDefaultCommConfigA(LPCSTR lpszDevice, DWORD WINAPI drvSetDefaultCommConfigA(LPCSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
DWORD dwSize) DWORD dwSize)
{ {
@ -162,7 +162,7 @@ BOOL WINAPI drvSetDefaultCommConfigA(LPCSTR lpszDevice,
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI drvGetDefaultCommConfigW(LPCWSTR lpszDevice, DWORD WINAPI drvGetDefaultCommConfigW(LPCWSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
LPDWORD lpdwSize) LPDWORD lpdwSize)
{ {
@ -172,7 +172,7 @@ BOOL WINAPI drvGetDefaultCommConfigW(LPCWSTR lpszDevice,
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL WINAPI drvGetDefaultCommConfigA(LPCSTR lpszDevice, DWORD WINAPI drvGetDefaultCommConfigA(LPCSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
LPDWORD lpdwSize) LPDWORD lpdwSize)
{ {
@ -231,7 +231,7 @@ LRESULT CommDlgProc(HWND hDlg,
/* Initialize baud rate combo */ /* Initialize baud rate combo */
if(!(hBox = GetDlgItem(hDlg, IDC_BAUDRATE))) if(!(hBox = GetDlgItem(hDlg, IDC_BAUDRATE)))
EndDialog(hDlg, 0); EndDialog(hDlg, ERROR_CANCELLED);
for(i = 0; Bauds[i]; i++) for(i = 0; Bauds[i]; i++)
{ {
@ -246,7 +246,7 @@ LRESULT CommDlgProc(HWND hDlg,
/* Initialize byte size combo */ /* Initialize byte size combo */
if(!(hBox = GetDlgItem(hDlg, IDC_BYTESIZE))) if(!(hBox = GetDlgItem(hDlg, IDC_BYTESIZE)))
EndDialog(hDlg, 0); EndDialog(hDlg, ERROR_CANCELLED);
for(i = 0; ByteSizes[i]; i++) for(i = 0; ByteSizes[i]; i++)
{ {
@ -261,7 +261,7 @@ LRESULT CommDlgProc(HWND hDlg,
/* Initialize parity combo */ /* Initialize parity combo */
if(!(hBox = GetDlgItem(hDlg, IDC_PARITY))) if(!(hBox = GetDlgItem(hDlg, IDC_PARITY)))
EndDialog(hDlg, 0); EndDialog(hDlg, ERROR_CANCELLED);
for(i = 0; Parities[i].StrId; i++) for(i = 0; Parities[i].StrId; i++)
{ {
@ -278,7 +278,7 @@ LRESULT CommDlgProc(HWND hDlg,
/* Initialize stop bits combo */ /* Initialize stop bits combo */
if(!(hBox = GetDlgItem(hDlg, IDC_STOPBITS))) if(!(hBox = GetDlgItem(hDlg, IDC_STOPBITS)))
EndDialog(hDlg, 0); EndDialog(hDlg, ERROR_CANCELLED);
for(i = 0; StopBits[i].StrId; i++) for(i = 0; StopBits[i].StrId; i++)
{ {
@ -295,7 +295,7 @@ LRESULT CommDlgProc(HWND hDlg,
/* Initialize flow control combo */ /* Initialize flow control combo */
if(!(hBox = GetDlgItem(hDlg, IDC_FLOW))) if(!(hBox = GetDlgItem(hDlg, IDC_FLOW)))
EndDialog(hDlg, 0); EndDialog(hDlg, ERROR_CANCELLED);
if(LoadStringW(hDllInstance, IDS_FC_NO, wstr, sizeof(wstr) / sizeof(wstr[0]))) if(LoadStringW(hDllInstance, IDS_FC_NO, wstr, sizeof(wstr) / sizeof(wstr[0])))
{ {
@ -337,11 +337,11 @@ LRESULT CommDlgProc(HWND hDlg,
switch(wParam) switch(wParam)
{ {
case IDC_CANCELBTN: case IDC_CANCELBTN:
EndDialog(hDlg, FALSE); EndDialog(hDlg, ERROR_CANCELLED);
break; break;
case IDC_OKBTN: case IDC_OKBTN:
OkButton(hDlg); OkButton(hDlg);
EndDialog(hDlg, TRUE); EndDialog(hDlg, ERROR_SUCCESS);
break; break;
} }
return TRUE; return TRUE;
@ -349,11 +349,11 @@ LRESULT CommDlgProc(HWND hDlg,
case WM_CLOSE: case WM_CLOSE:
{ {
EndDialog(hDlg, FALSE); EndDialog(hDlg, ERROR_CANCELLED);
return TRUE; return TRUE;
} /* WM_CLOSE */ } /* WM_CLOSE */
default: default:
return FALSE; return FALSE;
} }

View file

@ -11,8 +11,7 @@
#include "resource.h" #include "resource.h"
#define UNIMPLEMENTED \ #define UNIMPLEMENTED \
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ return ERROR_CALL_NOT_IMPLEMENTED ;
return FALSE;
#define DEFAULT_BAUD_INDEX 6 #define DEFAULT_BAUD_INDEX 6
#define DEFAULT_BYTESIZE_INDEX 3 #define DEFAULT_BYTESIZE_INDEX 3
@ -45,27 +44,27 @@ typedef struct _STOPBIT_INFO
* *
************************************/ ************************************/
BOOL WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice, DWORD WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice,
HWND hWnd, HWND hWnd,
LPCOMMCONFIG lpCommConfig); LPCOMMCONFIG lpCommConfig);
BOOL WINAPI drvCommConfigDialogA(LPCSTR lpszDevice, DWORD WINAPI drvCommConfigDialogA(LPCSTR lpszDevice,
HWND hWnd, HWND hWnd,
LPCOMMCONFIG lpCommConfig); LPCOMMCONFIG lpCommConfig);
BOOL WINAPI drvSetDefaultCommConfigW(LPCWSTR lpszDevice, DWORD WINAPI drvSetDefaultCommConfigW(LPCWSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
DWORD dwSize); DWORD dwSize);
BOOL WINAPI drvSetDefaultCommConfigA(LPCSTR lpszDevice, DWORD WINAPI drvSetDefaultCommConfigA(LPCSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
DWORD dwSize); DWORD dwSize);
BOOL WINAPI drvGetDefaultCommConfigW(LPCWSTR lpszDevice, DWORD WINAPI drvGetDefaultCommConfigW(LPCWSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
LPDWORD lpdwSize); LPDWORD lpdwSize);
BOOL WINAPI drvGetDefaultCommConfigA(LPCSTR lpszDevice, DWORD WINAPI drvGetDefaultCommConfigA(LPCSTR lpszDevice,
LPCOMMCONFIG lpCommConfig, LPCOMMCONFIG lpCommConfig,
LPDWORD lpdwSize); LPDWORD lpdwSize);