Ignore:
Timestamp:
Apr 18, 2012, 10:46:37 PM (13 years ago)
Author:
dmik
Message:

kernel32: Make SEH work in OS/2 context.

See #82 for details.

Location:
trunk/testapp/exceptions
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/testapp/exceptions/GuardPages/main.cpp

    r21982 r21999  
    149149    ///////////////////////////////////////////////////
    150150
     151#if 1
     152
    151153    printf ("\nTEST 1 (STACK)\n");
    152154
     
    154156    DWORD dwYellowZoneSize = sSysInfo.dwPageSize * 3;
    155157
    156 #if 1
    157158    if (VirtualAlloc ((LPVOID) dwStackBase, dwYellowZoneSize,
    158159                      MEM_COMMIT, PAGE_READWRITE))
     
    186187        }
    187188    }
    188 #endif
    189189
    190190    PrintMemLayout (&dwStackTop);
    191191
     192#endif
     193
    192194    ///////////////////////////////////////////////////
     195
     196#if 1
    193197
    194198    printf ("\nTEST 2 (PAGE_GUARD)\n");
     
    220224    VirtualFree (pNonStack, 0, MEM_RELEASE);
    221225
     226#endif
     227
    222228    return 0;
    223229}
     
    226232{
    227233#ifdef __WIN32OS2__
    228     EnableSEH();
     234#ifdef ODIN_FORCE_WIN32_TIB
     235    ForceWin32TIB();
     236#endif
    229237#endif
    230238
  • trunk/testapp/exceptions/seh/crash.c

    r21663 r21999  
    2424    _argc = argc;
    2525    _argv = argv;
    26     EnableSEH();
     26#ifdef ODIN_FORCE_WIN32_TIB
     27    ForceWin32TIB();
     28#endif
    2729    RegisterLxExe(WinMain, NULL);
    2830}
     
    8789void foo(int code)
    8890{
    89    __try
    90    {
    91        printf("In foo(%d)...\n", code);
     91    __try
     92    {
     93        printf("In foo(%d)...\n", code);
    9294
    93        if (code == 2)
    94        {
    95            throw_EXCEPTION_INT_DIVIDE_BY_ZERO();
    96            printf("FAILED: No exception!\n");
    97        }
    98        else
    99        {
    100            foo(code + 1);
    101        }
    102    }
    103    __except(exc_filter(exception_info()))
    104    {
    105        printf("FAILED: foo(%d) exception handled.\n", code);
    106    }
     95        if (code == 2)
     96        {
     97            throw_EXCEPTION_INT_DIVIDE_BY_ZERO();
     98            printf("FAILED: No exception!\n");
     99        }
     100        else
     101        {
     102            foo(code + 1);
     103        }
     104    }
     105    __except(exc_filter(exception_info()))
     106    {
     107        printf("FAILED: foo(%d) exception handled.\n", code);
     108    }
    107109}
    108110
     
    118120{
    119121    printf("The program should now expectedly crash "
    120            "(but NO POPUPLOG.OS2 entry!)...\n");
     122           "(and may be a NO POPUPLOG.OS2 entry)...\n");
    121123
    122124    HANDLE hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, NULL);
  • trunk/testapp/exceptions/seh/except.c

    r21476 r21999  
    2323    _argc = argc;
    2424    _argv = argv;
    25     EnableSEH();
     25#ifdef ODIN_FORCE_WIN32_TIB
     26    ForceWin32TIB();
     27#endif
    2628    RegisterLxExe(WinMain, NULL);
    2729}
  • trunk/testapp/exceptions/seh/finally.c

    r21449 r21999  
    2323    _argc = argc;
    2424    _argv = argv;
    25     EnableSEH();
     25#ifdef ODIN_FORCE_WIN32_TIB
     26    ForceWin32TIB();
     27#endif
    2628    RegisterLxExe(WinMain, NULL);
    2729}
  • trunk/testapp/exceptions/seh/longjmp.c

    r21662 r21999  
    2424    _argc = argc;
    2525    _argv = argv;
    26     EnableSEH();
     26#ifdef ODIN_FORCE_WIN32_TIB
     27    ForceWin32TIB();
     28#endif
    2729    RegisterLxExe(WinMain, NULL);
    2830}
Note: See TracChangeset for help on using the changeset viewer.