00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 {
00197
volatile CHAR *StartAddress;
00198
volatile CHAR *EndAddress;
00199
CHAR Temp;
00200
00201
00202
00203
00204
00205
00206
if (Length != 0) {
00207
00208
00209
00210
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
00222
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
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 {
00268
volatile CHAR *StartAddress;
00269
volatile CHAR *EndAddress;
00270
CHAR Temp;
00271
00272
00273
00274
00275
00276
00277
if (Length != 0) {
00278
00279
00280
00281
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