Commit ade9fd64 authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

kernel32: Remove duplicate code (use serialui instead).

parent 9258c401
...@@ -1388,35 +1388,23 @@ BOOL WINAPI GetDefaultCommConfigW( ...@@ -1388,35 +1388,23 @@ BOOL WINAPI GetDefaultCommConfigW(
afterwards the number of bytes copied to the buffer or afterwards the number of bytes copied to the buffer or
the needed size of the buffer. */ the needed size of the buffer. */
{ {
LPDCB lpdcb = &(lpCC->dcb); FARPROC pGetDefaultCommConfig;
WCHAR temp[40]; HMODULE hConfigModule;
static const WCHAR comW[] = {'C','O','M',0}; DWORD res = ERROR_INVALID_PARAMETER;
static const WCHAR formatW[] = {'C','O','M','%','c',':','3','8','4','0','0',',','n',',','8',',','1',0};
TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 ); TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 );
hConfigModule = LoadLibraryW(lpszSerialUI);
if (strncmpiW(lpszName,comW,3)) { if (hConfigModule) {
ERR("not implemented for <%s>\n", debugstr_w(lpszName)); pGetDefaultCommConfig = GetProcAddress(hConfigModule, "drvGetDefaultCommConfigW");
return FALSE; if (pGetDefaultCommConfig) {
res = pGetDefaultCommConfig(lpszName, lpCC, lpdwSize);
} }
FreeLibrary(hConfigModule);
if (*lpdwSize < sizeof(COMMCONFIG)) {
*lpdwSize = sizeof(COMMCONFIG);
return FALSE;
} }
*lpdwSize = sizeof(COMMCONFIG); if (res) SetLastError(res);
return (res == ERROR_SUCCESS);
lpCC->dwSize = sizeof(COMMCONFIG);
lpCC->wVersion = 1;
lpCC->dwProviderSubType = PST_RS232;
lpCC->dwProviderOffset = 0L;
lpCC->dwProviderSize = 0L;
sprintfW( temp, formatW, lpszName[3]);
FIXME("setting %s as default\n", debugstr_w(temp));
return BuildCommDCBW( temp, lpdcb);
} }
/************************************************************************** /**************************************************************************
...@@ -1443,7 +1431,7 @@ BOOL WINAPI GetDefaultCommConfigA( ...@@ -1443,7 +1431,7 @@ BOOL WINAPI GetDefaultCommConfigA(
if(lpszName) RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName); if(lpszName) RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
else lpszNameW.Buffer = NULL; else lpszNameW.Buffer = NULL;
if(lpszNameW.Buffer) ret = GetDefaultCommConfigW(lpszNameW.Buffer,lpCC,lpdwSize); ret = GetDefaultCommConfigW(lpszNameW.Buffer,lpCC,lpdwSize);
RtlFreeUnicodeString(&lpszNameW); RtlFreeUnicodeString(&lpszNameW);
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment