- Timestamp:
- Oct 28, 2001, 1:48:04 PM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmdevio.cpp
r6086 r7245 1 /* $Id: hmdevio.cpp,v 1.1 4 2001-06-23 19:43:49sandervl Exp $ */1 /* $Id: hmdevio.cpp,v 1.15 2001-10-28 12:48:04 sandervl Exp $ */ 2 2 3 3 /* … … 130 130 //****************************************************************************** 131 131 //****************************************************************************** 132 BOOL WIN32API RegisterCustomDriver(PFNDRVOPEN pfnDriverOpen, PFNDRVCLOSE pfnDriverClose, 133 PFNDRVIOCTL pfnDriverIOCtl, LPCSTR lpDeviceName) 134 { 135 HMDeviceDriver *driver; 136 DWORD rc; 137 138 driver = new HMCustomDriver(pfnDriverOpen, pfnDriverClose, pfnDriverIOCtl, lpDeviceName); 139 if(driver == NULL) { 140 DebugInt3(); 141 return FALSE; 142 } 143 rc = HMDeviceRegister((LPSTR)lpDeviceName, driver); 144 if (rc != NO_ERROR) { /* check for errors */ 145 dprintf(("KERNEL32:RegisterDevices: registering %s failed with %u.\n", lpDeviceName, rc)); 146 return FALSE; 147 } 148 return TRUE; 149 } 150 //****************************************************************************** 151 //****************************************************************************** 132 152 HMDeviceDriver::HMDeviceDriver(LPCSTR lpDeviceName, LPSTR lpOS2DevName, BOOL fCreate, 133 153 WINIOCTL pDevIOCtl) … … 438 458 //****************************************************************************** 439 459 HMCustomDriver::HMCustomDriver(HINSTANCE hInstance, LPCSTR lpDeviceName) 440 : HMDeviceDriver(lpDeviceName) 460 : HMDeviceDriver(lpDeviceName), hDrvDll(0) 441 461 { 442 462 hDrvDll = hInstance ; … … 447 467 //****************************************************************************** 448 468 //****************************************************************************** 469 HMCustomDriver::HMCustomDriver(PFNDRVOPEN pfnDriverOpen, PFNDRVCLOSE pfnDriverClose, 470 PFNDRVIOCTL pfnDriverIOCtl, LPCSTR lpDeviceName) 471 : HMDeviceDriver(lpDeviceName), hDrvDll(0) 472 { 473 driverOpen = pfnDriverOpen; 474 driverClose = pfnDriverClose; 475 driverIOCtl = pfnDriverIOCtl; 476 } 477 //****************************************************************************** 478 //****************************************************************************** 449 479 HMCustomDriver::~HMCustomDriver() 450 480 { 451 FreeLibrary(hDrvDll);481 if(hDrvDll) FreeLibrary(hDrvDll); 452 482 } 453 483 //****************************************************************************** -
trunk/src/kernel32/hmdevio.h
r5905 r7245 1 /* $Id: hmdevio.h,v 1. 3 2001-06-04 21:18:40sandervl Exp $ */1 /* $Id: hmdevio.h,v 1.4 2001-10-28 12:48:04 sandervl Exp $ */ 2 2 3 3 #ifndef __DEVIO_H__ … … 11 11 #include "HMDevice.h" 12 12 #include "HMObjects.h" 13 #include <custombuild.h> 13 14 14 15 #ifndef _OS2WIN_H … … 103 104 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); 104 105 105 typedef HANDLE (* WIN32API DrvOpen)(DWORD dwAccess, DWORD dwShare);106 typedef void (* WIN32API DrvClose)(HANDLE hDevice);107 typedef BOOL (* WIN32API DrvIOCtl)(HANDLE hDevice, DWORD dwIoControlCode,108 LPVOID lpInBuffer, DWORD nInBufferSize,109 LPVOID lpOutBuffer, DWORD nOutBufferSize,110 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);111 112 106 typedef struct { 113 107 char szWin32Name[32]; … … 152 146 public: 153 147 HMCustomDriver(HINSTANCE hInstance, LPCSTR lpDeviceName); 148 HMCustomDriver(PFNDRVOPEN pfnDriverOpen, PFNDRVCLOSE pfnDriverClose, 149 PFNDRVIOCTL pfnDriverIOCtl, LPCSTR lpDeviceName); 150 154 151 virtual ~HMCustomDriver(); 155 152 … … 168 165 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); 169 166 private: 170 DrvOpendriverOpen;171 DrvClosedriverClose;172 DrvIOCtldriverIOCtl;167 PFNDRVOPEN driverOpen; 168 PFNDRVCLOSE driverClose; 169 PFNDRVIOCTL driverIOCtl; 173 170 HINSTANCE hDrvDll; 174 171 };
Note:
See TracChangeset
for help on using the changeset viewer.