Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Force640x480.cpp
  5. Abstract:
  6. This shim is for games that assume the start resolution is 640x480.
  7. Notes:
  8. This is a general purpose shim.
  9. History:
  10. 02/13/2001 dmunsil Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(Force640x480)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_END
  17. #define CDS_WIDTH 640
  18. #define CDS_HEIGHT 480
  19. VOID
  20. Force640x480_ChangeMode()
  21. {
  22. DEVMODEA dm;
  23. __try {
  24. EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
  25. if ((dm.dmPelsWidth != CDS_WIDTH) ||
  26. (dm.dmPelsHeight != CDS_HEIGHT))
  27. {
  28. dm.dmPelsWidth = CDS_WIDTH;
  29. dm.dmPelsHeight = CDS_HEIGHT;
  30. ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
  31. }
  32. }
  33. __except(EXCEPTION_EXECUTE_HANDLER) {
  34. DPFN( eDbgLevelWarning, "Exception trying to change mode");
  35. };
  36. }
  37. BOOL
  38. NOTIFY_FUNCTION(
  39. DWORD fdwReason
  40. )
  41. {
  42. if (fdwReason == SHIM_STATIC_DLLS_INITIALIZED) {
  43. Force640x480_ChangeMode();
  44. }
  45. return TRUE;
  46. }
  47. /*++
  48. Register hooked functions
  49. --*/
  50. HOOK_BEGIN
  51. CALL_NOTIFY_FUNCTION
  52. HOOK_END
  53. IMPLEMENT_SHIM_END