directdraw.cpp 594 B

1234567891011121314151617181920212223
  1. #include "main.h"
  2. #include "directdraw.h"
  3. HRESULT (WINAPI *_DirectDrawCreate)(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter) = 0;
  4. HRESULT DDrawCreate(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter)
  5. {
  6. static int a = 0;
  7. if (!_DirectDrawCreate && !a)
  8. {
  9. a++;
  10. HINSTANCE h = LoadLibrary(L"ddraw.dll");
  11. if (h)
  12. {
  13. *(void**)&_DirectDrawCreate = (void*)GetProcAddress(h, "DirectDrawCreate");
  14. }
  15. }
  16. if (_DirectDrawCreate)
  17. return _DirectDrawCreate(lpGUID, lplpDD, pUnkOuter);
  18. else
  19. return S_OK; // TODO: uhhh no this should be an error :)
  20. }