windowing/windowserver/wins_switching/ws32switch.cpp
branchRCL_3
changeset 18 5e30ef2e26cb
parent 0 5d03bc08d59c
equal deleted inserted replaced
11:fed1595b188e 18:5e30ef2e26cb
    37 
    37 
    38 #include "ws32_stubs.h"
    38 #include "ws32_stubs.h"
    39 
    39 
    40 FARPROC vector[MAX_ORDINAL+1];
    40 FARPROC vector[MAX_ORDINAL+1];
    41 
    41 
    42 
    42 #ifdef _DEBUG
    43 void Stop(char* aErrorMessage)
    43 void Stop(char* aErrorMessage)
       
    44 #else
       
    45 void Stop(char* /*aErrorMessage*/)
       
    46 #endif
    44 	{
    47 	{
    45 	int err = GetLastError();
    48 	int err = GetLastError();
       
    49 #ifdef _DEBUG
    46 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
    50 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
       
    51 #endif
    47 	_asm int 3;
    52 	_asm int 3;
    48 	}
    53 	}
    49 
    54 
    50 void fill_vector(HINSTANCE aDll)
    55 void fill_vector(HINSTANCE aDll)
    51 	{
    56 	{
    74 	{
    79 	{
    75 	// ask HAL which configuration to use
    80 	// ask HAL which configuration to use
    76 	TBool nga = EFalse;
    81 	TBool nga = EFalse;
    77 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &nga);
    82 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &nga);
    78 	const char* library = nga ? "ws32_nga.dll" : "ws32_nonnga.dll";
    83 	const char* library = nga ? "ws32_nga.dll" : "ws32_nonnga.dll";
    79 
    84 #ifdef _DEBUG
    80 	RDebug::Printf("Redirecting ws32.dll to \"%s\" ...\n", library);
    85 	RDebug::Printf("Redirecting ws32.dll to \"%s\" ...\n", library);
    81 	
    86 #endif
    82 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
    87 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
    83 	// try to load selected DLL
    88 	// try to load selected DLL
    84 	HINSTANCE instance = LoadLibraryA(library);
    89 	HINSTANCE instance = LoadLibraryA(library);
    85 	Emulator::Reenter();
    90 	Emulator::Reenter();
    86 
    91 
    89 		Stop("... unable to load");
    94 		Stop("... unable to load");
    90 		}
    95 		}
    91 	else
    96 	else
    92 		{
    97 		{
    93 		fill_vector(instance);
    98 		fill_vector(instance);
       
    99 #ifdef _debug
    94 		RDebug::Printf("... DLL loaded successfully");
   100 		RDebug::Printf("... DLL loaded successfully");
       
   101 #endif
    95 		}
   102 		}
    96 	}
   103 	}
    97 
   104 
    98 __declspec(naked) void common_dispatch()
   105 __declspec(naked) void common_dispatch()
    99 	{
   106 	{