Changeset 7391 for trunk/src


Ignore:
Timestamp:
Nov 19, 2001, 4:16:15 AM (24 years ago)
Author:
bird
Message:

Assert macro. corrected a few prologs which wasn't recognized. No logging in functions used by the loging subsystem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/kKrnlLib/testcase/Fake.c

    r7312 r7391  
    1 /* $Id: Fake.c,v 1.3 2001-11-09 07:41:09 bird Exp $
     1/* $Id: Fake.c,v 1.4 2001-11-19 03:16:15 bird Exp $
    22 *
    33 * Fake stubs for the ldr and kernel functions we imports or overloads.
     
    99 */
    1010#ifndef NOFILEID
    11 static const char szFileId[] = "$Id: Fake.c,v 1.3 2001-11-09 07:41:09 bird Exp $";
     11static const char szFileId[] = "$Id: Fake.c,v 1.4 2001-11-19 03:16:15 bird Exp $";
    1212#endif
    1313
     
    2323#define WORD   USHORT
    2424
    25 #define DUMMY()     int dummy; dummy = 0; dummy = dummy + 1;
     25#define DUMMY()     volatile int dummy1, dummy2; \
     26                    dummy1 = 23; \
     27                    dummy2 = 42; \
     28                    dummy1 = dummy1 + 1 + dummy2;
     29
     30#define Assert(expr) \
     31        if (!(expr))                                                                \
     32        {                                                                           \
     33            printf("%s(%d) - %s: %s\n", __FILE__, __FUNCTION__, __LINE__, #expr);   \
     34            INT3();                                                                 \
     35        }
    2636
    2737/*******************************************************************************
     
    11411151{
    11421152    KLOGENTRY3("VOID KRNLCALL","PKSEM pksem, ULONG fulType, ULONG fulFlags", pksem, fulType, fulFlags);
    1143     if (fulType != KSEM_MUTEX)
     1153    if (fulType != KSEM_MUTEX && fulType != KSEM_SHARED)
    11441154    {
    11451155        printf("fakeKSEMInit:                   Invalid fulType parameter (%d).\n", fulType);
     
    11501160    memcpy(pksem->mtx.debug.ksem_achSignature, "KSEM", 4);
    11511161    pksem->mtx.debug.ksem_bFlags = (char)fulFlags;
    1152     pksem->mtx.debug.ksem_bType = KSEM_MUTEX;
     1162    pksem->mtx.debug.ksem_bType = fulType;
    11531163    pksem->mtx.debug.ksem_cusNest = 0;
    11541164    pksem->mtx.debug.ksem_cusPendingWriters = 0;
     
    11621172ULONG KRNLCALL  fakeKSEMRequestExclusive(HKSEMSHR hkshr, ULONG ulTimeout)
    11631173{
    1164     KLOGENTRY2("ULONG","HKSEMSHR hkshr, ULONG ulTimeout", hkshr, ulTimeout);
    1165     KNOREF(hkshr);
     1174    //KLOGENTRY2("ULONG","HKSEMSHR hkshr, ULONG ulTimeout", hkshr, ulTimeout);  /* used bye kLog.c */
     1175    DUMMY();
    11661176    KNOREF(ulTimeout);
    1167     KLOGEXIT(-1);
    1168     return -1;
     1177
     1178    Assert(!memcmp(hkshr->debug.ks_achSignature, "KSEM", 4));
     1179    Assert(hkshr->debug.ks_bType == KSEM_SHARED);
     1180    Assert(hkshr->debug.ks_Owner == 0);
     1181    hkshr->debug.ks_Owner = 1;
     1182    //KLOGEXIT(0);
     1183    return 0;
    11691184}
    11701185
     
    11721187ULONG KRNLCALL  fakeKSEMRequestShared(HKSEMSHR hkshr, ULONG ulTimeout)
    11731188{
    1174     KLOGENTRY2("ULONG","HKSEMSHR hkshr, ULONG ulTimeout", hkshr, ulTimeout);
    1175     DUMMY();
    1176     KNOREF(hkshr);
     1189    //KLOGENTRY2("ULONG","HKSEMSHR hkshr, ULONG ulTimeout", hkshr, ulTimeout);  /* used bye kLog.c */
     1190    DUMMY();
    11771191    KNOREF(ulTimeout);
    1178     KLOGEXIT(-1);
    1179     return -1;
     1192
     1193    Assert(!memcmp(hkshr->debug.ks_achSignature, "KSEM", 4));
     1194    Assert(hkshr->debug.ks_bType == KSEM_SHARED);
     1195    Assert(hkshr->debug.ks_Owner == 0);
     1196    hkshr->debug.ks_Owner = 42;
     1197    //KLOGEXIT(0);
     1198    return 0;
    11801199}
    11811200
     
    11831202VOID  KRNLCALL  fakeKSEMRelease(HKSEM hksem)
    11841203{
    1185     KLOGENTRY1("VOID","HKSEM hksem", hksem);
    1186     DUMMY();
    1187     KNOREF(hksem);
    1188     KLOGEXITVOID();
     1204    //KLOGENTRY1("VOID","HKSEM hksem", hksem);                                  /* used bye kLog.c */
     1205    DUMMY();
     1206
     1207    Assert(!memcmp(hksem->shr.debug.ks_achSignature, "KSEM", 4));
     1208    switch (hksem->shr.debug.ks_bType)
     1209    {
     1210        case KSEM_SHARED:
     1211            Assert(hksem->shr.debug.ks_Owner != 0);
     1212            hksem->shr.debug.ks_Owner = 0;
     1213            break;
     1214        case KSEM_MUTEX:
     1215            Assert(hksem->mtx.debug.ksem_Owner != 0);
     1216            hksem->mtx.debug.ksem_Owner = 0;
     1217            break;
     1218        default:
     1219            INT3();
     1220    }
     1221    //KLOGEXITVOID();
    11891222}
    11901223
Note: See TracChangeset for help on using the changeset viewer.