00043 :
00044
00045 This function probes an address
for write accessibility on
00046
the Intel 386.
00047
00048 Arguments:
00049
00050 Address - Supplies a pointer to
the structure to probe.
00051
00052 Length - Supplies
the length of
the structure.
00053
00054 Return Value:
00055
00056 None. If
the Address cannot be written an exception
is raised.
00057
00058 --*/
00059
00060 {
00061
PMMPTE PointerPte;
00062
PMMPTE LastPte;
00063
MMPTE PteContents;
00064 CCHAR Temp;
00065
00066
00067
00068
00069
00070
00071
if (Address >= (PVOID)MM_HIGHEST_USER_ADDRESS) {
00072
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
00073 }
00074
00075 PointerPte =
MiGetPteAddress (Address);
00076 LastPte =
MiGetPteAddress ((PVOID)((ULONG)Address + Length - 1));
00077
00078
while (PointerPte <= LastPte) {
00079
00080
for (;;) {
00081
00082
00083
00084
00085
00086
00087
do {
00088 Temp = *(
volatile CCHAR *)Address;
00089 PteContents = *(
volatile MMPTE *)PointerPte;
00090 }
while (PteContents.
u.Hard.Valid == 0);
00091
00092
if (PteContents.
u.Hard.Write == 1) {
00093
00094
00095
00096
00097
00098
break;
00099 }
00100
00101
if (PteContents.
u.Hard.CopyOnWrite == 1) {
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
if (!
NT_SUCCESS (MmAccessFault (TRUE,
00115 Address,
00116 UserMode))) {
00117
00118
00119
00120
00121
00122
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
00123
00124 }
00125 }
else {
00126
00127
00128
00129
00130
00131
ExRaiseStatus(STATUS_ACCESS_VIOLATION);
00132
00133 }
00134 }
00135 PointerPte += 1;
00136 Address = (PVOID)((ULONG)Address +
PAGE_SIZE);
00137 }
00138 }
}