Win32Dll.cpp
上传用户:salebz
上传日期:2013-04-17
资源大小:207k
文件大小:2k
源码类别:

并口编程

开发平台:

Visual C++

  1. // Win32Dll.cpp : Defines the entry point for the DLL application.
  2. //
  3. #include "stdafx.h"
  4. #include "Win32Dll.h"
  5. BOOL APIENTRY DllMain( HANDLE hModule, 
  6.                        DWORD  ul_reason_for_call, 
  7.                        LPVOID lpReserved
  8.  )
  9. {
  10.     switch (ul_reason_for_call)
  11. {
  12. case DLL_PROCESS_ATTACH:
  13. case DLL_THREAD_ATTACH:
  14. case DLL_THREAD_DETACH:
  15. case DLL_PROCESS_DETACH:
  16. break;
  17.     }
  18.     return TRUE;
  19. }
  20. WIN32DLL_API unsigned long GS_QADog(PQA_DLL_PARA pmdp)
  21. {            
  22. MHSTATUS resu;
  23. DogAddr1 = pmdp->DogAddr1;
  24. DogAddr2 = pmdp->DogAddr2;
  25. DogBytes = pmdp->DogBytes;
  26. DogPassword = pmdp->DogPassword;
  27. DogData = (void*)&pmdp->DogData[0];
  28. OperationNo = pmdp->OperationNo;
  29. DogCascade = pmdp->DogCascade;
  30. switch(pmdp->Command)
  31. {
  32. case DOGCHECK:          
  33. resu = DogCheck();
  34. break;
  35. case READDOG:
  36. resu = ReadDog();
  37. break;
  38. case WRITEDOG:                           
  39. resu = WriteDog();
  40. break;
  41. case BOGUSREAD:
  42. resu = BogusRead();
  43. break;
  44. case BOGUSWRITE:
  45. resu = BogusWrite();
  46. break;
  47. case WRITEEXPRESSIONS:
  48. resu = WriteExpressions();
  49. break;
  50. case COMPARE:
  51. resu = Compare();
  52. break;
  53. case OPERATION:
  54. resu = Operation();
  55. break;
  56. case GETCURRENTNO:
  57. resu = GetCurrentNo();
  58. break;
  59. case WRITEONLY:
  60. resu = WriteOnly();
  61. break;
  62. case DISABLESHARE:
  63. resu = DisableShare();
  64. break;
  65. case ENABLESHARE:
  66. resu = EnableShare();
  67. break;
  68. default:
  69. resu = 18000;
  70. break;
  71. }
  72. pmdp->DogResult = DogResult;
  73. return resu;
  74. }