summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/src/util/util_gdi.cpp
blob: 901dd05ca9db307b0a749c507168d85c155be3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "util_gdi.h"
#include "log/log.h"

namespace dxvk {

  HMODULE GetGDIModule() {
    static HMODULE module = LoadLibraryA("gdi32.dll");
    return module;
  }

  NTSTATUS D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY* Arg1) {
    static auto func = (D3DKMTCreateDCFromMemoryType)
      GetProcAddress(GetGDIModule(), "D3DKMTCreateDCFromMemory");

    if (func != nullptr)
      return func(Arg1);

    Logger::warn("D3DKMTCreateDCFromMemory: Unable to query proc address.");
    return -1;
  }

  NTSTATUS D3DKMTDestroyDCFromMemory(D3DKMT_DESTROYDCFROMMEMORY* Arg1) {
    static auto func = (D3DKMTDestroyDCFromMemoryType)
      GetProcAddress(GetGDIModule(), "D3DKMTDestroyDCFromMemory");

    if (func != nullptr)
      return func(Arg1);

    Logger::warn("D3DKMTDestroyDCFromMemory: Unable to query proc address.");
    return -1;
  }

}