Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.1 KiB

  1. #include "isapi.h"
  2. #pragma hdrstop
  3. BOOL
  4. IsapiFaxGetRoutingInfo(
  5. LPEXTENSION_CONTROL_BLOCK Ecb
  6. )
  7. {
  8. PIFAX_GET_ROUTINGINFO iFaxGetRoutingInfo = (PIFAX_GET_ROUTINGINFO) Ecb->lpbData;
  9. LPBYTE RoutingInfoBuffer = NULL;
  10. DWORD RoutingInfoBufferSize = 0;
  11. if (!FaxGetRoutingInfoW(
  12. iFaxGetRoutingInfo->FaxPortHandle,
  13. iFaxGetRoutingInfo->RoutingGuid,
  14. &RoutingInfoBuffer,
  15. &RoutingInfoBufferSize
  16. ))
  17. {
  18. SendError( Ecb, GetLastError() );
  19. return FALSE;
  20. }
  21. SendResponseWithData( Ecb, (LPBYTE) &RoutingInfoBufferSize, sizeof(DWORD) );
  22. SendResponseWithData( Ecb, (LPBYTE) RoutingInfoBuffer, RoutingInfoBufferSize );
  23. FaxFreeBuffer( RoutingInfoBuffer );
  24. return TRUE;
  25. }
  26. static
  27. DWORD
  28. BufferSize(
  29. PFAX_ROUTING_METHODW RoutingMethod,
  30. DWORD MethodCount
  31. )
  32. {
  33. DWORD i;
  34. DWORD Size = 0;
  35. for (i=0; i<MethodCount; i++) {
  36. Size += sizeof(FAX_ROUTING_METHODW);
  37. Size += StringSize( RoutingMethod[i].DeviceName );
  38. Size += StringSize( RoutingMethod[i].Guid );
  39. Size += StringSize( RoutingMethod[i].FriendlyName );
  40. Size += StringSize( RoutingMethod[i].FunctionName );
  41. Size += StringSize( RoutingMethod[i].ExtensionImageName );
  42. Size += StringSize( RoutingMethod[i].ExtensionFriendlyName );
  43. }
  44. return Size;
  45. }
  46. BOOL
  47. IsapiFaxEnumRoutingMethods(
  48. LPEXTENSION_CONTROL_BLOCK Ecb
  49. )
  50. {
  51. PIFAX_GENERAL iFaxGeneral = (PIFAX_GENERAL) Ecb->lpbData;
  52. PFAX_ROUTING_METHODW RoutingMethod = NULL;
  53. DWORD MethodsReturned = 0;
  54. if (!FaxEnumRoutingMethodsW( iFaxGeneral->FaxHandle, (LPBYTE*)&RoutingMethod, &MethodsReturned )) {
  55. SendError( Ecb, GetLastError() );
  56. return FALSE;
  57. }
  58. DWORD Size = BufferSize( RoutingMethod, MethodsReturned );
  59. for (DWORD i=0; i<MethodsReturned; i++) {
  60. RoutingMethod[i].DeviceName = (LPWSTR) ((DWORD)RoutingMethod[i].DeviceName - (DWORD)RoutingMethod);
  61. RoutingMethod[i].Guid = (LPWSTR) ((DWORD)RoutingMethod[i].Guid - (DWORD)RoutingMethod);
  62. RoutingMethod[i].FriendlyName = (LPWSTR) ((DWORD)RoutingMethod[i].FriendlyName - (DWORD)RoutingMethod);
  63. RoutingMethod[i].FunctionName = (LPWSTR) ((DWORD)RoutingMethod[i].FunctionName - (DWORD)RoutingMethod);
  64. RoutingMethod[i].ExtensionImageName = (LPWSTR) ((DWORD)RoutingMethod[i].ExtensionImageName - (DWORD)RoutingMethod);
  65. RoutingMethod[i].ExtensionFriendlyName = (LPWSTR) ((DWORD)RoutingMethod[i].ExtensionFriendlyName - (DWORD)RoutingMethod);
  66. }
  67. SendResponseWithData( Ecb, (LPBYTE) &MethodsReturned, sizeof(DWORD) );
  68. SendResponseWithData( Ecb, (LPBYTE) RoutingMethod, Size );
  69. FaxFreeBuffer( RoutingMethod );
  70. return TRUE;
  71. }
  72. BOOL
  73. IsapiFaxEnableRoutingMethod(
  74. LPEXTENSION_CONTROL_BLOCK Ecb
  75. )
  76. {
  77. PIFAX_ENABLE_ROUTING_METHOD iFaxEnableRouting = (PIFAX_ENABLE_ROUTING_METHOD) Ecb->lpbData;
  78. if (!FaxEnableRoutingMethodW(
  79. iFaxEnableRouting->FaxPortHandle,
  80. iFaxEnableRouting->RoutingGuid,
  81. iFaxEnableRouting->Enabled))
  82. {
  83. SendError( Ecb, GetLastError() );
  84. return FALSE;
  85. }
  86. return TRUE;
  87. }