Annotation of ntddk/src/vdd/appints/fax32/fax32.c, revision 1.1

1.1     ! root        1: /*++
        !             2:  *
        !             3:  *  VDD v1.0
        !             4:  *
        !             5:  *  Copyright (c) 1991, Microsoft Corporation
        !             6:  *
        !             7:  *  VDD.C - Sample VDD for NT-MVDM
        !             8:  *
        !             9: --*/
        !            10: #include "fax32.h"
        !            11: #include "vddsvc.h"
        !            12: 
        !            13: 
        !            14: USHORT Sub16CS;
        !            15: USHORT Sub16IP;
        !            16: 
        !            17: BOOL
        !            18: VDDInitialize(
        !            19:     IN PVOID DllHandle,
        !            20:     IN ULONG Reason,
        !            21:     IN PCONTEXT Context OPTIONAL
        !            22:     )
        !            23: 
        !            24: /*++
        !            25: 
        !            26: Routine Description:
        !            27: 
        !            28: 
        !            29: Arguments:
        !            30: 
        !            31:     DllHandle - Not Used
        !            32: 
        !            33:     Reason - Attach or Detach
        !            34: 
        !            35:     Context - Not Used
        !            36: 
        !            37: Return Value:
        !            38: 
        !            39:     SUCCESS - TRUE
        !            40:     FAILURE - FALSE
        !            41: 
        !            42: --*/
        !            43: 
        !            44: {
        !            45: 
        !            46:     switch ( Reason ) {
        !            47: 
        !            48:     case DLL_PROCESS_ATTACH:
        !            49:        // Allocate VDD's local heap if needed. Check that NT FAX driver
        !            50:        // is available by opening that device.
        !            51:        //....
        !            52:        // Install user hook for callback service.
        !            53: 
        !            54:        if(!VDDInstallUserHook (DllHandle,&FAXVDDCreate, &FAXVDDTerminate,
        !            55:                    &FAXVDDBlock, &FAXVDDResume))
        !            56:            OutputDebugString("FAX32: UserHook not installed\n");
        !            57:        else
        !            58:            OutputDebugString("FAX32: UserHook installed!\n");
        !            59: 
        !            60:        // UserHook # 2
        !            61:        if(!VDDInstallUserHook (DllHandle,&FAXVDDCreate, NULL,
        !            62:                    NULL, &FAXVDDResume))
        !            63:            OutputDebugString("FAX32: UserHook #2 not installed\n");
        !            64:        else
        !            65:            OutputDebugString("FAX32: UserHook #2 installed!\n");
        !            66: 
        !            67:        break;
        !            68: 
        !            69:     case DLL_PROCESS_DETACH:
        !            70:        // Deallocate VDD's local heap if needed
        !            71:        // communicate to appropriate Device driver about your departure
        !            72:        //...
        !            73:        // Deinstall user hook for callback service.
        !            74:        if(!VDDDeInstallUserHook (DllHandle))
        !            75:            OutputDebugString("FAX32: UserHook not deinstalled\n");
        !            76:        else
        !            77:            OutputDebugString("FAX32: UserHook deinstalled!\n");
        !            78: 
        !            79:         break;
        !            80:     default:
        !            81:         break;
        !            82:     }
        !            83: 
        !            84:     return TRUE;
        !            85: }
        !            86: 
        !            87: // Sample function
        !            88: VOID FAXVDDTerminate(USHORT usPDB)
        !            89: {
        !            90:     USHORT uSaveCS, uSaveIP;
        !            91: 
        !            92:     OutputDebugString("FAX32: Terminate message\n");
        !            93: 
        !            94:     // VDDHostSimulate
        !            95: 
        !            96:     uSaveCS = getCS();
        !            97:     uSaveIP = getIP();
        !            98:     setCS(Sub16CS);
        !            99:     setIP(Sub16IP);
        !           100:     VDDSimulate16();
        !           101:     setCS(uSaveCS);
        !           102:     setIP(uSaveIP);
        !           103: 
        !           104: }
        !           105: 
        !           106: // Sample function
        !           107: VOID FAXVDDCreate(USHORT usPDB)
        !           108: {
        !           109:     OutputDebugString("FAX32: Create Message\n");
        !           110: }
        !           111: 
        !           112: // Sample function
        !           113: VOID FAXVDDBlock(VOID)
        !           114: {
        !           115:     OutputDebugString("FAX32: Block Message\n");
        !           116: }
        !           117: 
        !           118: // Sample function
        !           119: VOID FAXVDDResume(VOID)
        !           120: {
        !           121:     OutputDebugString("FAX32: Resume Message\n");
        !           122: }
        !           123: 
        !           124: 
        !           125: VOID
        !           126: FAXVDDTerminateVDM(
        !           127:     VOID
        !           128:     )
        !           129: /*++
        !           130: 
        !           131: Arguments:
        !           132: 
        !           133: Return Value:
        !           134: 
        !           135:     SUCCESS - TRUE
        !           136:     FAILURE - FALSE
        !           137: 
        !           138: --*/
        !           139: 
        !           140: 
        !           141: {
        !           142: 
        !           143:     // Cleanup any resource taken for this vdm
        !           144: 
        !           145: 
        !           146:     return;
        !           147: }
        !           148: 
        !           149: 
        !           150: VOID
        !           151: FAXVDDRegisterInit(
        !           152:     VOID
        !           153:     )
        !           154: /*++
        !           155: 
        !           156: Arguments:
        !           157: 
        !           158: Return Value:
        !           159: 
        !           160:     SUCCESS - TRUE
        !           161:     FAILURE - FALSE
        !           162: 
        !           163: --*/
        !           164: 
        !           165: 
        !           166: {
        !           167:        // Save addresses for fax16
        !           168:        Sub16CS = getDS();
        !           169:        Sub16IP = getAX();
        !           170: 
        !           171:        OutputDebugString("FAX32: GET_ADD\n");
        !           172: 
        !           173:     // Called from the BOP manager. If VDDInitialize has done all the
        !           174:     // checking and resources alloaction, just return success.
        !           175: 
        !           176:     setCF(0);
        !           177:     return;
        !           178: }
        !           179: 
        !           180: 
        !           181: #define GET_A_FAX      1
        !           182: #define SEND_A_FAX     2
        !           183: 
        !           184: VOID
        !           185: FAXVDDDispatch(
        !           186:     VOID
        !           187:     )
        !           188: /*++
        !           189: 
        !           190: Arguments:
        !           191:     Client (DX)    = Command code
        !           192:                    01 - get a message from NT device driver
        !           193:                    02 - send a message through NT device driver
        !           194:                    03 - address of 16 bit routine
        !           195: 
        !           196:     Client (ES:BX) = Message Buffer
        !           197:     Client (CX)    = Buffer Size
        !           198: 
        !           199: Return Value:
        !           200: 
        !           201:     SUCCESS - Client Carry Clear and CX has the count transferred
        !           202:     FAILURE - Client Carry Set
        !           203: 
        !           204: --*/
        !           205: 
        !           206: 
        !           207: {
        !           208: PCHAR  Buffer;
        !           209: USHORT cb;
        !           210: USHORT uCom;
        !           211: BOOL   Success = TRUE; // In this sample operation always succeeds
        !           212: 
        !           213:     uCom = getDX();
        !           214: 
        !           215:     cb = getCX();
        !           216:     Buffer = (PCHAR) GetVDMPointer ((ULONG)((getES() << 16)|getBX()),cb,FALSE);
        !           217:     switch (uCom) {
        !           218:        case GET_A_FAX:
        !           219:            // Make a DeviceIOControl or ReadFile on NT FAX driver with
        !           220:            // cb and Buffer.Then set CX if success.
        !           221: 
        !           222:            if (Success) {
        !           223:                setCX(cb);
        !           224:                setCF(0);
        !           225:            }
        !           226:            else
        !           227:                setCF(1);
        !           228: 
        !           229:            break;
        !           230: 
        !           231: 
        !           232:        case SEND_A_FAX:
        !           233:            // Make a DeviceIOControl or WriteFile on NT FAX driver with
        !           234:            // cb and Buffer.Then set CX if success.
        !           235: 
        !           236:            if (Success) {
        !           237:                setCX(cb);
        !           238:                setCF(0);
        !           239:            }
        !           240:            else
        !           241:                setCF(1);
        !           242: 
        !           243:            break;
        !           244:        default:
        !           245:                setCF(1);
        !           246:     }
        !           247:     return;
        !           248: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.