SKEL32.C
上传用户:lx1888888
上传日期:2007-01-04
资源大小:136k
文件大小:2k
源码类别:

驱动编程

开发平台:

Visual C++

  1. #include <windows.h>
  2. #include "..16skeleton.h"
  3. DEVICECONTEXT Device1 = { 0 };
  4. DRIVERPARAMS DefaultParams = { 1024 };
  5. BOOL WINAPI SKELETON_ThunkConnect32(LPSTR pszDll16,
  6.     LPSTR pszDll32, HINSTANCE hInst, DWORD dwReason);
  7.  
  8. BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD dwReason, LPVOID lpvReserved)
  9. {
  10.     if (!(SKELETON_ThunkConnect32("SKELETON.DLL", // name of 16-bit DLL
  11.             "SKEL32.DLL",                   // name of 32-bit DLL 
  12.             hDllInst, dwReason))) {
  13.         return FALSE; 
  14.     } 
  15.     return TRUE; 
  16. }
  17. #define DLLEXPORT __declspec( dllexport )
  18. DLLEXPORT HDEVICE APIENTRY DeviceOpen32( void )
  19. {
  20.    return DeviceOpen();
  21. }
  22. DLLEXPORT int APIENTRY DeviceClose32( HDEVICE hDevice )
  23. {
  24.    return DeviceClose( hDevice );
  25. }
  26. DLLEXPORT int APIENTRY DeviceGetWriteStatus32( HDEVICE hDevice, LPWORD pusStatus )
  27. {
  28.    return DeviceGetWriteStatus( hDevice, pusStatus );
  29. }
  30. DLLEXPORT int APIENTRY DeviceGetReadStatus32( HDEVICE hDevice, LPWORD pusStatus )
  31. {
  32.    return DeviceGetReadStatus( hDevice, pusStatus );
  33. }
  34. DLLEXPORT int APIENTRY DeviceWrite32( HDEVICE hDevice, LPBYTE lpData, LPWORD pcBytes )
  35. {
  36.    return DeviceWrite( hDevice, lpData, pcBytes );
  37. }
  38. DLLEXPORT int APIENTRY DeviceRead32( HDEVICE hDevice, LPBYTE lpData, LPWORD pcBytes )
  39. {
  40.    return DeviceRead( hDevice, lpData, pcBytes );
  41. }
  42. DLLEXPORT int APIENTRY DeviceSetDriverParams32( HDEVICE hDevice, PDRIVERPARAMS pParms )
  43. {
  44.    return DeviceSetDriverParams( hDevice, pParms );
  45. }
  46. DLLEXPORT int APIENTRY DeviceGetDriverParams32( HDEVICE hDevice, PDRIVERPARAMS pParms )
  47. {
  48.    return DeviceGetDriverParams( hDevice, pParms );
  49. }
  50. DLLEXPORT int APIENTRY DeviceGetDriverCapabilities32( HDEVICE hDevice, PPDRIVERCAPS ppDriverCaps )
  51. {
  52.    return DeviceGetDriverCapabilities( hDevice, ppDriverCaps );
  53. }