diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in index a3f0683fc28..7d0ec924080 100644 --- a/dlls/kernel/Makefile.in +++ b/dlls/kernel/Makefile.in @@ -7,6 +7,7 @@ SOVERSION = 1.0 ALTNAMES = comm kernel stress system toolhelp windebug win87em wprocs C_SRCS = \ + comm.c \ debugger.c \ format_msg.c \ kernel_main.c \ diff --git a/misc/comm.c b/dlls/kernel/comm.c similarity index 98% rename from misc/comm.c rename to dlls/kernel/comm.c index c792be84ed9..1aa40e27f6e 100644 --- a/misc/comm.c +++ b/dlls/kernel/comm.c @@ -52,7 +52,6 @@ #include #include "windef.h" -#include "comm.h" #ifdef HAVE_SYS_MODEM_H # include #endif @@ -90,10 +89,31 @@ DEFAULT_DEBUG_CHANNEL(comm); #define CMSPAR 0x40000000 /* stick parity */ #endif -struct DosDeviceStruct COM[MAX_PORTS]; -struct DosDeviceStruct LPT[MAX_PORTS]; +#define MAX_PORTS 9 + +struct DosDeviceStruct { + char *devicename; /* /dev/cua1 */ + int fd; + int suspended; + int unget,xmit; + int baudrate; + int evtchar; + /* events */ + int commerror, eventmask; + /* buffers */ + char *inbuf,*outbuf; + unsigned ibuf_size,ibuf_head,ibuf_tail; + unsigned obuf_size,obuf_head,obuf_tail; + /* notifications */ + int wnd, n_read, n_write; + HANDLE s_read, s_write; +}; + + +static struct DosDeviceStruct COM[MAX_PORTS]; +static struct DosDeviceStruct LPT[MAX_PORTS]; /* pointers to unknown(==undocumented) comm structure */ -LPCVOID *unknown[MAX_PORTS]; +static LPCVOID *unknown[MAX_PORTS]; /* save terminal states */ static struct termios m_stat[MAX_PORTS]; @@ -2844,30 +2864,3 @@ BOOL WINAPI GetDefaultCommConfigW( LPCWSTR lpszName,LPCOMMCONFIG lpCC, return ret; } -/************************************************************************** - * COMM_CreatePort INTERNAL - */ -HANDLE COMM_CreatePort(LPCSTR name, DWORD access) -{ - struct create_serial_request *req = get_req_buffer(); - DWORD r; - char devname[40]; - - TRACE("%s %lx\n", name, access); - - PROFILE_GetWineIniString("serialports",name,"",devname,sizeof devname); - if(!devname[0]) - return 0; - - TRACE("opening %s as %s\n", devname, name); - - req->handle = 0; - req->access = access; - req->sharing = FILE_SHARE_READ|FILE_SHARE_WRITE; - lstrcpynA( req->name, devname, server_remaining(req->name) ); - SetLastError(0); - r = server_call( REQ_CREATE_SERIAL ); - TRACE("create_port_request return %08lX handle = %08X\n",r,req->handle); - return req->handle; -} - diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index 0e546a58e83..a3a0130a479 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c @@ -10,13 +10,13 @@ #include "neexe.h" #include "module.h" #include "task.h" -#include "comm.h" #include "selectors.h" #include "miscemu.h" #include "global.h" extern void CODEPAGE_Init(void); extern BOOL THUNK_Init(void); +extern void COMM_Init(void); /*********************************************************************** diff --git a/files/dos_fs.c b/files/dos_fs.c index 73d9954ffa3..2b21acc9f57 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -29,7 +29,6 @@ #include "winerror.h" #include "drive.h" #include "file.h" -#include "comm.h" #include "heap.h" #include "msdos.h" #include "syslevel.h" @@ -694,6 +693,33 @@ const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile ) } +/************************************************************************** + * DOSFS_CreateCommPort + */ +static HANDLE DOSFS_CreateCommPort(LPCSTR name, DWORD access) +{ + struct create_serial_request *req = get_req_buffer(); + DWORD r; + char devname[40]; + + TRACE("%s %lx\n", name, access); + + PROFILE_GetWineIniString("serialports",name,"",devname,sizeof devname); + if(!devname[0]) + return 0; + + TRACE("opening %s as %s\n", devname, name); + + req->handle = 0; + req->access = access; + req->sharing = FILE_SHARE_READ|FILE_SHARE_WRITE; + lstrcpynA( req->name, devname, server_remaining(req->name) ); + SetLastError(0); + r = server_call( REQ_CREATE_SERIAL ); + TRACE("create_port_request return %08lX handle = %08X\n",r,req->handle); + return req->handle; +} + /*********************************************************************** * DOSFS_OpenDevice * @@ -746,7 +772,7 @@ HFILE DOSFS_OpenDevice( const char *name, DWORD access ) return FILE_CreateDevice( i, access, NULL ); } - if( (handle=COMM_CreatePort(name,access)) ) + if( (handle=DOSFS_CreateCommPort(name,access)) ) return handle; FIXME("device open %s not supported (yet)\n",DOSFS_Devices[i].name); diff --git a/include/comm.h b/include/comm.h deleted file mode 100644 index 540f2b21cc3..00000000000 --- a/include/comm.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __WINE_COMM_H -#define __WINE_COMM_H - -#include "windef.h" -#include "winbase.h" - -#define MAX_PORTS 9 - -struct DosDeviceStruct { - char *devicename; /* /dev/cua1 */ - int fd; - int suspended; - int unget,xmit; - int baudrate; - int evtchar; - /* events */ - int commerror, eventmask; - /* buffers */ - char *inbuf,*outbuf; - unsigned ibuf_size,ibuf_head,ibuf_tail; - unsigned obuf_size,obuf_head,obuf_tail; - /* notifications */ - int wnd, n_read, n_write; - HANDLE s_read, s_write; -}; - -extern void COMM_Init(void); -extern HANDLE COMM_CreatePort(LPCSTR name, DWORD access); - -#endif /* __WINE_COMM_H */ diff --git a/include/msdos.h b/include/msdos.h index 0a9d3c6af12..1eb9fd8fff6 100644 --- a/include/msdos.h +++ b/include/msdos.h @@ -2,7 +2,6 @@ #define __WINE_MSDOS_H #include "winnt.h" -#include "comm.h" struct fcb { BYTE drive; @@ -100,9 +99,6 @@ typedef struct _DOS_LISTOFLISTS #define MAX_DOS_DRIVES 26 -extern struct DosDeviceStruct COM[MAX_PORTS]; -extern struct DosDeviceStruct LPT[MAX_PORTS]; - #define setword(a,b) do { *(BYTE*)(a) = (b) & 0xff; \ *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\ } while(0) diff --git a/misc/Makefile.in b/misc/Makefile.in index 2810f04aa08..e39a6d2f6ee 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -8,7 +8,6 @@ MODULE = misc C_SRCS = \ cdrom.c \ - comm.c \ cpu.c \ debugstr.c \ error.c \ diff --git a/msdos/int11.c b/msdos/int11.c index d8c3cae7309..d3179998431 100644 --- a/msdos/int11.c +++ b/msdos/int11.c @@ -52,7 +52,7 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context ) if (DRIVE_IsValid(1)) diskdrives++; if (diskdrives) diskdrives--; - for (x=0; x!=MAX_PORTS; x++) + for (x=0; x < 9; x++) { char temp[16],name[16];