Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

vdmentry.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1991 Microsoft Corporation 00004 00005 Module Name: 00006 00007 vdmentry.c 00008 00009 Abstract: 00010 00011 This function dispatches to the vdm services 00012 00013 Author: 00014 00015 Dave Hastings (daveh) 6-Apr-1992 00016 00017 Notes: 00018 00019 This module will be fleshed out when the great vdm code consolidation 00020 occurs, sometime soon after the functionality is done. 00021 00022 Revision History: 00023 00024 24-Sep-1993 Jonle: reoptimize dispatcher to suit the number of services 00025 add QueueInterrupt service 00026 00027 --*/ 00028 00029 #include "vdmp.h" 00030 #include <ntvdmp.h> 00031 00032 #ifdef ALLOC_PRAGMA 00033 #pragma alloc_text(PAGE, NtVdmControl) 00034 #endif 00035 00036 #if DBG 00037 void AssertIrqlPassive(void) 00038 { 00039 if (KeGetCurrentIrql() > PASSIVE_LEVEL) { 00040 DbgPrint("NtVdmControl:returning at raised irql!\n"); 00041 DbgBreakPoint(); 00042 } 00043 } 00044 #else 00045 #define AssertIrqlPassive() 00046 #endif 00047 00048 00049 00050 NTSTATUS 00051 NtVdmControl( 00052 IN VDMSERVICECLASS Service, 00053 IN OUT PVOID ServiceData 00054 ) 00055 /*++ 00056 00057 Routine Description: 00058 00059 386 specific routine which dispatches to the appropriate function 00060 based on service number. 00061 00062 Arguments: 00063 00064 Service -- Specifies what service is to be performed 00065 ServiceData -- Supplies a pointer to service specific data 00066 00067 Return Value: 00068 00069 if invalid service number: STATUS_INVALID_PARAMETER_1 00070 else see individual services. 00071 00072 00073 --*/ 00074 { 00075 NTSTATUS Status; 00076 00077 PAGED_CODE(); 00078 00079 // 00080 // Dispatch in descending order of frequency 00081 // 00082 if (Service == VdmStartExecution) { 00083 Status = VdmpStartExecution(); 00084 } else if (Service == VdmQueueInterrupt) { 00085 Status = VdmpQueueInterrupt(ServiceData); 00086 } else if (Service == VdmDelayInterrupt) { 00087 Status = VdmpDelayInterrupt(ServiceData); 00088 } else if (Service == VdmQueryDir) { 00089 Status = VdmQueryDirectoryFile(ServiceData); 00090 } else if (Service == VdmInitialize) { 00091 Status = VdmpInitialize(ServiceData); 00092 } else if (Service == VdmFeatures) { 00093 try { 00094 // 00095 // Verify that we were passed a valid user address 00096 // 00097 ProbeForWriteBoolean((PBOOLEAN)ServiceData); 00098 00099 // 00100 // Return the appropriate feature bits to notify 00101 // ntvdm which modes (if any) fast IF emulation is 00102 // available for 00103 // 00104 if (KeI386VdmIoplAllowed) { 00105 *((PULONG)ServiceData) = V86_VIRTUAL_INT_EXTENSIONS; 00106 } else { 00107 // remove this if pm extensions to be used 00108 *((PULONG)ServiceData) = KeI386VirtualIntExtensions & 00109 ~PM_VIRTUAL_INT_EXTENSIONS; 00110 } 00111 00112 } except(EXCEPTION_EXECUTE_HANDLER) { 00113 Status = GetExceptionCode(); 00114 } 00115 Status = STATUS_SUCCESS; 00116 00117 } else if (Service == VdmSetInt21Handler) { 00118 try { 00119 ProbeForRead(ServiceData, sizeof(VDMSET_INT21_HANDLER_DATA), 1); 00120 00121 Status = Ke386SetVdmInterruptHandler( 00122 KeGetCurrentThread()->ApcState.Process, 00123 0x21L, 00124 (USHORT)(((PVDMSET_INT21_HANDLER_DATA)ServiceData)->Selector), 00125 ((PVDMSET_INT21_HANDLER_DATA)ServiceData)->Offset, 00126 ((PVDMSET_INT21_HANDLER_DATA)ServiceData)->Gate32 00127 ); 00128 } except(EXCEPTION_EXECUTE_HANDLER) { 00129 Status = GetExceptionCode(); 00130 } 00131 00132 } else if (Service == VdmPrinterDirectIoOpen) { 00133 Status = VdmpPrinterDirectIoOpen(ServiceData); 00134 } else if (Service == VdmPrinterDirectIoClose) { 00135 Status = VdmpPrinterDirectIoClose(ServiceData); 00136 } else if (Service == VdmPrinterInitialize) { 00137 Status = VdmpPrinterInitialize(ServiceData); 00138 } else { 00139 Status = STATUS_INVALID_PARAMETER_1; 00140 } 00141 00142 00143 AssertIrqlPassive(); 00144 return Status; 00145 00146 }

Generated on Sat May 15 19:42:21 2004 for test by doxygen 1.3.7