Index: trunk/src/kernel32/HandleManager.cpp
===================================================================
--- trunk/src/kernel32/HandleManager.cpp	(revision 1855)
+++ trunk/src/kernel32/HandleManager.cpp	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: HandleManager.cpp,v 1.27 1999-11-26 21:10:51 phaller Exp $ */
+/* $Id: HandleManager.cpp,v 1.28 1999-11-27 12:48:25 achimha Exp $ */
 
 /*
@@ -2591,2 +2591,70 @@
   return (fResult);                                   /* deliver return code */
 }
+
+
+/*****************************************************************************
+ * Name      : HMSetupComm
+ * Purpose   : router function for SetupComm
+ * Parameters:
+ * Variables :
+ * Result    :
+ * Remark    :
+ * Status    :
+ *
+ * Author    : Achim Hasenmueller [Sat, 1999/11/27 13:13]
+ *****************************************************************************/
+
+BOOL HMSetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue)
+{
+  int       iIndex;                           /* index into the handle table */
+  BOOL      bResult;                /* result from the device handler's API */
+  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
+
+                                                          /* validate handle */
+  iIndex = _HMHandleQuery(hFile);              /* get the index */
+  if (-1 == iIndex)                                               /* error ? */
+  {
+    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
+    return (NULL);                                         /* signal failure */
+  }
+
+  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
+  bResult = pHMHandle->pDeviceHandler->SetupComm(&pHMHandle->hmHandleData,
+                                                 dwInQueue, dwOutQueue);
+
+  return (bResult);                                  /* deliver return code */
+}
+
+
+/*****************************************************************************
+ * Name      : HMGetCommState
+ * Purpose   : router function for GetCommState
+ * Parameters:
+ * Variables :
+ * Result    :
+ * Remark    :
+ * Status    :
+ *
+ * Author    : Achim Hasenmueller [Sat, 1999/11/27 13:40]
+ *****************************************************************************/
+
+BOOL HMGetCommState(INT hCommDev, LPDCB lpdcb)
+{
+  int       iIndex;                           /* index into the handle table */
+  BOOL      bResult;                /* result from the device handler's API */
+  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
+
+                                                          /* validate handle */
+  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
+  if (-1 == iIndex)                                               /* error ? */
+  {
+    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
+    return (NULL);                                         /* signal failure */
+  }
+
+  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
+  bResult = pHMHandle->pDeviceHandler->GetCommState(&pHMHandle->hmHandleData,
+                                                    lpdcb);
+
+  return (bResult);                                  /* deliver return code */
+}
Index: trunk/src/kernel32/comm.cpp
===================================================================
--- trunk/src/kernel32/comm.cpp	(revision 1855)
+++ trunk/src/kernel32/comm.cpp	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: comm.cpp,v 1.2 1999-06-10 20:47:54 phaller Exp $ */
+/* $Id: comm.cpp,v 1.3 1999-11-27 12:48:25 achimha Exp $ */
 
 /*
@@ -15,4 +15,5 @@
 #include <os2win.h>
 #include "unicode.h"
+#include "handlemanager.h"
 
 
@@ -109,6 +110,5 @@
 BOOL WIN32API SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue )
 {
-  dprintf(("SetupComm Not implemented (TRUE)\n"));
-  return(TRUE);
+  return HMSetupComm(hFile, dwInQueue, dwOutQueue);
 }
 
@@ -181,6 +181,5 @@
 BOOL WIN32API GetCommState(INT hCommDev, LPDCB lpdcb)
 {
-  dprintf(("OS2GetCommState Not implemented\n"));
-  return(FALSE);
+  return HMGetCommState(hCommDev, lpdcb);
 }
 
Index: trunk/src/kernel32/hmcomm.cpp
===================================================================
--- trunk/src/kernel32/hmcomm.cpp	(revision 1855)
+++ trunk/src/kernel32/hmcomm.cpp	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: hmcomm.cpp,v 1.2 1999-11-26 08:18:16 achimha Exp $ */
+/* $Id: hmcomm.cpp,v 1.3 1999-11-27 12:48:26 achimha Exp $ */
 
 /*
@@ -10,2 +10,69 @@
  */
 
+#include <odin.h>
+#include <win32type.h>
+#include <misc.h>
+#include "handlemanager.h"
+#include "hmdevice.h"
+#include "hmcomm.h"
+#include "oslibdos.h"
+
+
+HMDeviceCommClass::HMDeviceCommClass(LPCSTR lpDeviceName) : HMDeviceHandler(lpDeviceName)
+{
+  dprintf(("HMDeviceCommClass: Register COM1 to COM4 with Handle Manager\n"));
+  HMDeviceRegister("COM1", this);
+  HMDeviceRegister("COM2", this);
+  HMDeviceRegister("COM3", this);
+  HMDeviceRegister("COM4", this);
+
+}
+
+
+
+DWORD HMDeviceCommClass::CreateFile(LPCSTR lpFileName,
+                                    PHMHANDLEDATA pHMHandleData,
+                                    PVOID lpSecurityAttributes,
+                                    PHMHANDLEDATA pHMHandleDataTemplate)
+{
+  dprintf(("HMComm: Serial communication port %s open request\n", lpFileName));
+
+  pHMHandleData->hHMHandle = 0;
+
+  //AH: TODO parse Win32 security handles   
+  pHMHandleData->hHMHandle = OSLibDosOpen((char*)lpFileName,
+                                          OSLIB_ACCESS_READWRITE |
+                                          OSLIB_ACCESS_SHAREDENYREAD |
+                                          OSLIB_ACCESS_SHAREDENYWRITE);
+  if (pHMHandleData->hHMHandle != 0)
+    return 0;
+  else
+    return  -1;
+}
+
+
+                      /* this is a handler method for calls to CloseHandle() */
+DWORD HMDeviceCommClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
+{
+  dprintf(("HMComm: Serial communication port close request\n"));
+  return OSLibDosClose(pHMHandleData->hHMHandle);
+}
+
+/*****************************************************************************
+ * Name      : DWORD HMDeviceHandler::SetupComm      
+ * Purpose   : set com port parameters (queue)
+ * Variables :
+ * Result    : 
+ * Remark    :
+ * Status    :
+ *
+ * Author    : Achim Hasenmueller
+ *****************************************************************************/
+
+BOOL HMDeviceCommClass::SetupComm(PHMHANDLEDATA pHMHandleData, DWORD dwInQueue, DWORD dwOutQueue)
+{
+  dprintf(("HMDeviceCommClass::SetupComm unimplemented stub!"));
+
+
+  return(TRUE);
+}
Index: trunk/src/kernel32/hmcomm.h
===================================================================
--- trunk/src/kernel32/hmcomm.h	(revision 1855)
+++ trunk/src/kernel32/hmcomm.h	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: hmcomm.h,v 1.3 1999-11-26 21:10:52 phaller Exp $ */
+/* $Id: hmcomm.h,v 1.4 1999-11-27 12:48:26 achimha Exp $ */
 
 /*
@@ -16,21 +16,21 @@
 {
   public:
-    HMDeviceCommClass(LPCSTR lpDeviceName) : HMDeviceHandler(lpDeviceName) {}
-  
-  /* @@@PH here go the API methods
-  virtual DWORD CreateEvent (PHMHANDLEDATA         pHMHandleData,
-                             LPSECURITY_ATTRIBUTES lpsa,
-                             BOOL                  fManualReset,
-                             BOOL                  fInitialState,
-                             LPCTSTR               lpszEventName);
-                             
-  - strings are ASCII
-  - HANDLEs are translated to a PHMHANDLEDATA pointer
-                             
-  */
+
+  HMDeviceCommClass(LPCSTR lpDeviceName);
+
+  /* this is the handler method for calls to CreateFile() */
+  virtual DWORD  CreateFile (LPCSTR        lpFileName,
+                             PHMHANDLEDATA pHMHandleData,
+                             PVOID         lpSecurityAttributes,
+                             PHMHANDLEDATA pHMHandleDataTemplate);
+
+  /* this is the handler method for calls to CloseHandle() */
+  virtual DWORD  CloseHandle(PHMHANDLEDATA pHMHandleData);
+
+  /* this is the handler method for SetComm() */
+  virtual BOOL SetupComm(PHMHANDLEDATA pHMHandleData, DWORD dwInQueue, DWORD dwOutQueue);
 
 };
 
 
-
 #endif // _HM_COMM_H_
Index: trunk/src/kernel32/hmdevice.cpp
===================================================================
--- trunk/src/kernel32/hmdevice.cpp	(revision 1855)
+++ trunk/src/kernel32/hmdevice.cpp	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: hmdevice.cpp,v 1.9 1999-11-12 14:57:13 sandervl Exp $ */
+/* $Id: hmdevice.cpp,v 1.10 1999-11-27 12:48:26 achimha Exp $ */
 
 /*
@@ -1082,2 +1082,44 @@
   return(FALSE);
 }
+
+
+/*****************************************************************************
+ * Name      : DWORD HMDeviceHandler::SetupComm      
+ * Purpose   : set com port parameters (queue)
+ * Variables :
+ * Result    : 
+ * Remark    :
+ * Status    :
+ *
+ * Author    : Achim Hasenmueller
+ *****************************************************************************/
+
+BOOL HMDeviceHandler::SetupComm(PHMHANDLEDATA pHMHandleData, DWORD dwInQueue, DWORD dwOutQueue)
+{
+  dprintf(("KERNEL32: HandleManager::DeviceHandler::SetupComm(%08xh,%08xh,%08xh)\n",
+           pHMHandleData->hHMHandle,
+           dwInQueue, dwOutQueue));
+
+  return(FALSE);
+}
+
+
+/*****************************************************************************
+ * Name      : DWORD HMDeviceHandler::GetCommState   
+ * Purpose   : query com port control block   
+ * Variables :
+ * Result    : 
+ * Remark    :
+ * Status    :
+ *
+ * Author    : Achim Hasenmueller
+ *****************************************************************************/
+BOOL HMDeviceHandler::GetCommState(PHMHANDLEDATA pHMHandleData, LPDCB lpdcb)
+{
+  dprintf(("KERNEL32: HandleManager::DeviceHandler::GetCommState(%08xh,%08xh)\n",
+           pHMHandleData->hHMHandle,
+           lpdcb));
+
+  return(FALSE);
+}
+
Index: trunk/src/kernel32/hmdevice.h
===================================================================
--- trunk/src/kernel32/hmdevice.h	(revision 1855)
+++ trunk/src/kernel32/hmdevice.h	(revision 1858)
@@ -1,3 +1,3 @@
-/* $Id: hmdevice.h,v 1.10 1999-11-12 14:57:14 sandervl Exp $ */
+/* $Id: hmdevice.h,v 1.11 1999-11-27 12:48:26 achimha Exp $ */
 
 /*
@@ -287,4 +287,9 @@
                                      LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
 
+ /* COM ports */
+ virtual BOOL SetupComm(PHMHANDLEDATA pHMHandleData, DWORD dwInQueue, DWORD dwOutQueue);
+
+ virtual BOOL GetCommState(PHMHANDLEDATA pHMHandleData, LPDCB lpdcb);
+
 };
 
Index: trunk/src/kernel32/kernel32exp.def
===================================================================
--- trunk/src/kernel32/kernel32exp.def	(revision 1855)
+++ trunk/src/kernel32/kernel32exp.def	(revision 1858)
@@ -591,4 +591,5 @@
     _lstrncmpA@12                             @785
     _lstrncmpW@12                             @786
+    _IsProcessorFeaturePresent@4              @880
     _GetFileAttributesExA@12                  @874
     _GetFileAttributesExW@12                  @875
@@ -654,2 +655,3 @@
     _smalloc__FUi                             @1271
     _wsnprintfA                               @2000
+    IsExeStarted__Fv                          @2001
