Beispiel #1
0
/*
* main
*
* Purpose:
*
* Program main, process command line options.
*
*/
void main()
{
    PVOID   ExceptionHandler;
    CHAR    szCmdLine[MAX_PATH + 1];

    ExceptionHandler = RtlAddVectoredExceptionHandler(1, &VehHandler);
    if (ExceptionHandler) {

        RtlSecureZeroMemory(szCmdLine, sizeof(szCmdLine));
        GetCommandLineParamA((LPCSTR)GetCommandLineA(), 1, (LPSTR)&szCmdLine, MAX_PATH, NULL);

        if (_strcmpi_a(szCmdLine, PARAM_WIN32K) == 0) {
            RtlSecureZeroMemory(szCmdLine, sizeof(szCmdLine));
            GetCommandLineParamA((LPCSTR)GetCommandLineA(), 2, (LPSTR)&szCmdLine, MAX_PATH, NULL);
#ifdef _DEBUG
            if (_strcmpi_a(szCmdLine, PARAM_LOG) == 0)
                g_Log = TRUE;
#endif
            fuzz_win32k();
        }
        else {

#ifdef _DEBUG
            if (_strcmpi_a(szCmdLine, PARAM_LOG) == 0)
                g_Log = TRUE;
#endif
            fuzz_ntos();
        }
        RtlRemoveVectoredExceptionHandler(ExceptionHandler);
    }
    ExitProcess(0);
}
Beispiel #2
0
/**************************************************************************
 *		DllEntryPoint   (KERNEL.669)
 */
BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
                                  WORD heap, DWORD reserved1, WORD reserved2 )
{
    static BOOL done;

    /* the entry point can be called multiple times */
    if (done) return TRUE;
    done = TRUE;

    /* create the shared heap for broken win95 native dlls */
    HeapCreate( HEAP_SHARED, 0, 0 );

    /* setup emulation of protected instructions from 32-bit code */
    if (GetVersion() & 0x80000000) RtlAddVectoredExceptionHandler( TRUE, INSTR_vectored_handler );

    /* Initialize 16-bit thunking entry points */
    if (!WOWTHUNK_Init()) return FALSE;

    /* Initialize DOS memory */
    if (!DOSMEM_Init()) return FALSE;

    /* Initialize special KERNEL entry points */

    NE_SetEntryPoint( inst, 178, GetWinFlags16() );

    NE_SetEntryPoint( inst, 454, wine_get_cs() );
    NE_SetEntryPoint( inst, 455, wine_get_ds() );

    NE_SetEntryPoint( inst, 183, DOSMEM_0000H );       /* KERNEL.183: __0000H */
    NE_SetEntryPoint( inst, 173, DOSMEM_BiosSysSeg );  /* KERNEL.173: __ROMBIOS */
    NE_SetEntryPoint( inst, 193, DOSMEM_BiosDataSeg ); /* KERNEL.193: __0040H */
    NE_SetEntryPoint( inst, 194, DOSMEM_BiosSysSeg );  /* KERNEL.194: __F000H */

    /* Initialize KERNEL.THHOOK */
    TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( inst, (LPCSTR)332 )));
    TASK_CreateMainTask();

    /* Initialize the real-mode selector entry points */
#define SET_ENTRY_POINT( num, addr ) \
    NE_SetEntryPoint( inst, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
                      DOSMEM_MapDosToLinear(addr), 0x10000, inst, \
                      WINE_LDT_FLAGS_DATA ))

    SET_ENTRY_POINT( 174, 0xa0000 );  /* KERNEL.174: __A000H */
    SET_ENTRY_POINT( 181, 0xb0000 );  /* KERNEL.181: __B000H */
    SET_ENTRY_POINT( 182, 0xb8000 );  /* KERNEL.182: __B800H */
    SET_ENTRY_POINT( 195, 0xc0000 );  /* KERNEL.195: __C000H */
    SET_ENTRY_POINT( 179, 0xd0000 );  /* KERNEL.179: __D000H */
    SET_ENTRY_POINT( 190, 0xe0000 );  /* KERNEL.190: __E000H */
#undef SET_ENTRY_POINT

    /* Force loading of some dlls */
    LoadLibrary16( "system.drv" );
    LoadLibrary16( "comm.drv" );

    return TRUE;
}