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

wow64csr.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1998 Microsoft Corporation 00004 00005 Module Name: 00006 00007 wow64csr.c 00008 00009 Abstract: 00010 00011 This module contains the WOW64 versions of the code for the Windows Client. 00012 See csr* files in ntos\dll for more function comments. 00013 00014 Author: 00015 00016 Michael Zoran (mzoran) 2-JUN-1998 00017 00018 Environment: 00019 00020 User Mode only 00021 00022 Revision History: 00023 00024 --*/ 00025 00026 #include "csrdll.h" 00027 #include "ldrp.h" 00028 #include "ntwow64.h" 00029 00030 NTSTATUS 00031 CsrClientConnectToServer( 00032 IN PWSTR ObjectDirectory, 00033 IN ULONG ServerDllIndex, 00034 IN PCSR_CALLBACK_INFO CallbackInformation OPTIONAL, 00035 IN PVOID ConnectionInformation, 00036 IN OUT PULONG ConnectionInformationLength OPTIONAL, 00037 OUT PBOOLEAN CalledFromServer OPTIONAL 00038 ) 00039 00040 { 00041 return NtWow64CsrClientConnectToServer(ObjectDirectory, 00042 ServerDllIndex, 00043 CallbackInformation, 00044 ConnectionInformation, 00045 ConnectionInformationLength, 00046 CalledFromServer); 00047 } 00048 00049 NTSTATUS 00050 CsrNewThread( 00051 VOID 00052 ) 00053 { 00054 return NtWow64CsrNewThread(); 00055 } 00056 00057 NTSTATUS 00058 CsrIdentifyAlertableThread( VOID ) 00059 { 00060 return NtWow64CsrIdentifyAlertableThread(); 00061 } 00062 00063 NTSTATUS 00064 CsrSetPriorityClass( 00065 IN HANDLE ProcessHandle, 00066 IN OUT PULONG PriorityClass 00067 ) 00068 { 00069 00070 return NtWow64CsrSetPriorityClass(ProcessHandle, PriorityClass); 00071 00072 } 00073 00074 NTSTATUS 00075 CsrClientCallServer( 00076 IN OUT PCSR_API_MSG m, 00077 IN OUT PCSR_CAPTURE_HEADER CaptureBuffer OPTIONAL, 00078 IN CSR_API_NUMBER ApiNumber, 00079 IN ULONG ArgLength 00080 ) 00081 { 00082 00083 return NtWow64CsrClientCallServer(m,CaptureBuffer,ApiNumber,ArgLength); 00084 } 00085 00086 00087 PCSR_CAPTURE_HEADER 00088 CsrAllocateCaptureBuffer( 00089 IN ULONG CountMessagePointers, 00090 IN ULONG Sizecd 00091 ) 00092 { 00093 return NtWow64CsrAllocateCaptureBuffer(CountMessagePointers, Sizecd); 00094 } 00095 00096 00097 VOID 00098 CsrFreeCaptureBuffer( 00099 IN PCSR_CAPTURE_HEADER CaptureBuffer 00100 ) 00101 00102 { 00103 00104 NtWow64CsrFreeCaptureBuffer(CaptureBuffer); 00105 } 00106 00107 00108 ULONG 00109 CsrAllocateMessagePointer( 00110 IN OUT PCSR_CAPTURE_HEADER CaptureBuffer, 00111 IN ULONG Length, 00112 OUT PVOID *Pointer 00113 ) 00114 { 00115 00116 return NtWow64CsrAllocateMessagePointer(CaptureBuffer, Length, Pointer); 00117 00118 } 00119 00120 00121 VOID 00122 CsrCaptureMessageBuffer( 00123 IN OUT PCSR_CAPTURE_HEADER CaptureBuffer, 00124 IN PVOID Buffer OPTIONAL, 00125 IN ULONG Length, 00126 OUT PVOID *CapturedBuffer 00127 ) 00128 { 00129 00130 NtWow64CsrCaptureMessageBuffer(CaptureBuffer,Buffer,Length,CapturedBuffer); 00131 00132 } 00133 00134 VOID 00135 CsrCaptureMessageString( 00136 IN OUT PCSR_CAPTURE_HEADER CaptureBuffer, 00137 IN PCSTR String OPTIONAL, 00138 IN ULONG Length, 00139 IN ULONG MaximumLength, 00140 OUT PSTRING CapturedString 00141 ) 00142 00143 { 00144 00145 NtWow64CsrCaptureMessageString(CaptureBuffer, String, Length, MaximumLength, CapturedString); 00146 00147 } 00148 00149 00150 00151 PLARGE_INTEGER 00152 CsrCaptureTimeout( 00153 IN ULONG MilliSeconds, 00154 OUT PLARGE_INTEGER Timeout 00155 ) 00156 { 00157 if (MilliSeconds == -1) { 00158 return( NULL ); 00159 } 00160 else { 00161 Timeout->QuadPart = Int32x32To64( MilliSeconds, -10000 ); 00162 return( (PLARGE_INTEGER)Timeout ); 00163 } 00164 } 00165 00166 VOID 00167 CsrProbeForWrite( 00168 IN PVOID Address, 00169 IN ULONG Length, 00170 IN ULONG Alignment 00171 ) 00172 00173 /*++ 00174 00175 Routine Description: 00176 00177 This function probes a structure for read accessibility. 00178 If the structure is not accessible, then an exception is raised. 00179 00180 Arguments: 00181 00182 Address - Supplies a pointer to the structure to be probed. 00183 00184 Length - Supplies the length of the structure. 00185 00186 Alignment - Supplies the required alignment of the structure expressed 00187 as the number of bytes in the primitive datatype (e.g., 1 for char, 00188 2 for short, 4 for long, and 8 for quad). 00189 00190 Return Value: 00191 00192 None. 00193 00194 --*/ 00195 00196 { 00197 volatile CHAR *StartAddress; 00198 volatile CHAR *EndAddress; 00199 CHAR Temp; 00200 00201 // 00202 // If the structure has zero length, then do not probe the structure for 00203 // write accessibility or alignment. 00204 // 00205 00206 if (Length != 0) { 00207 00208 // 00209 // If the structure is not properly aligned, then raise a data 00210 // misalignment exception. 00211 // 00212 00213 ASSERT((Alignment == 1) || (Alignment == 2) || 00214 (Alignment == 4) || (Alignment == 8)); 00215 StartAddress = (volatile CHAR *)Address; 00216 00217 if (((ULONG_PTR)StartAddress & (Alignment - 1)) != 0) { 00218 RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); 00219 } else { 00220 // 00221 // BUG, BUG - this should not be necessary once the 386 kernel 00222 // makes system space inaccessable to user mode. 00223 // 00224 if ((ULONG_PTR)StartAddress > CsrNtSysInfo.MaximumUserModeAddress) { 00225 RtlRaiseStatus(STATUS_ACCESS_VIOLATION); 00226 } 00227 00228 Temp = *StartAddress; 00229 *StartAddress = Temp; 00230 EndAddress = StartAddress + Length - 1; 00231 Temp = *EndAddress; 00232 *EndAddress = Temp; 00233 } 00234 } 00235 } 00236 00237 VOID 00238 CsrProbeForRead( 00239 IN PVOID Address, 00240 IN ULONG Length, 00241 IN ULONG Alignment 00242 ) 00243 00244 /*++ 00245 00246 Routine Description: 00247 00248 This function probes a structure for read accessibility. 00249 If the structure is not accessible, then an exception is raised. 00250 00251 Arguments: 00252 00253 Address - Supplies a pointer to the structure to be probed. 00254 00255 Length - Supplies the length of the structure. 00256 00257 Alignment - Supplies the required alignment of the structure expressed 00258 as the number of bytes in the primitive datatype (e.g., 1 for char, 00259 2 for short, 4 for long, and 8 for quad). 00260 00261 Return Value: 00262 00263 None. 00264 00265 --*/ 00266 00267 { 00268 volatile CHAR *StartAddress; 00269 volatile CHAR *EndAddress; 00270 CHAR Temp; 00271 00272 // 00273 // If the structure has zero length, then do not probe the structure for 00274 // read accessibility or alignment. 00275 // 00276 00277 if (Length != 0) { 00278 00279 // 00280 // If the structure is not properly aligned, then raise a data 00281 // misalignment exception. 00282 // 00283 00284 ASSERT((Alignment == 1) || (Alignment == 2) || 00285 (Alignment == 4) || (Alignment == 8)); 00286 StartAddress = (volatile CHAR *)Address; 00287 00288 if (((ULONG_PTR)StartAddress & (Alignment - 1)) != 0) { 00289 RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT); 00290 } else { 00291 Temp = *StartAddress; 00292 EndAddress = StartAddress + Length - 1; 00293 Temp = *EndAddress; 00294 } 00295 } 00296 } 00297 

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