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
00027
00028
#include "exp.h"
00029
00030
00031 main()
00032 {
00033 INTERLOCKED_RESULT RetVal;
00034 LONG SpinVar;
00035 LONG LongVar;
00036
SHORT ShortVar;
00037 KSPIN_LOCK
Lock;
00038
00039
Lock = &SpinVar;
00040
00041 LongVar = 0;
00042 ShortVar = 0;
00043
00044 RetVal =
ExInterlockedDecrementLong(&LongVar, &
Lock);
00045
if ((RetVal != ResultNegative) ||
00046 (LongVar != -1)) {
00047
DbgPrint(
"t&Lock failure #L1\n");
00048 }
00049
00050 RetVal =
ExInterlockedDecrementLong(&LongVar, &
Lock);
00051
if ((RetVal != ResultNegative) ||
00052 (LongVar != -2)) {
00053
DbgPrint(
"t&Lock failure #L2\n");
00054 }
00055
00056 RetVal =
ExInterlockedIncrementLong(&LongVar, &
Lock);
00057
if ((RetVal != ResultNegative) ||
00058 (LongVar != -1)) {
00059
DbgPrint(
"t&Lock failure #L3\n");
00060 }
00061
00062 RetVal =
ExInterlockedIncrementLong(&LongVar, &
Lock);
00063
if ((RetVal != ResultZero) ||
00064 (LongVar != 0)) {
00065
DbgPrint(
"t&Lock failure #L4\n");
00066 }
00067
00068 RetVal =
ExInterlockedIncrementLong(&LongVar, &
Lock);
00069
if ((RetVal != ResultPositive) ||
00070 (LongVar != 1)) {
00071
DbgPrint(
"t&Lock failure #L5\n");
00072 }
00073
00074 RetVal =
ExInterlockedIncrementLong(&LongVar, &
Lock);
00075
if ((RetVal != ResultPositive) ||
00076 (LongVar != 2)) {
00077
DbgPrint(
"t&Lock failure #L6\n");
00078 }
00079
00080 RetVal =
ExInterlockedDecrementLong(&LongVar, &
Lock);
00081
if ((RetVal != ResultPositive) ||
00082 (LongVar != 1)) {
00083
DbgPrint(
"t&Lock failure #L7\n");
00084 }
00085
00086 RetVal =
ExInterlockedDecrementLong(&LongVar, &
Lock);
00087
if ((RetVal != ResultZero) ||
00088 (LongVar != 0)) {
00089
DbgPrint(
"t&Lock failure #L8\n");
00090 }
00091 }