MCPcopy Create free account
hub / github.com/LegacyUpdate/LegacyUpdate / GetResourceStream

Function GetResourceStream

shared/LoadImage.c:61–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static IStream *GetResourceStream(HINSTANCE hInstance, LPCWSTR name, LPCWSTR type) {
62 IStream *stream = NULL;
63 HGLOBAL resource = GetRawResource(hInstance, name, type);
64 if (!resource) {
65 HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
66 CHECK_HR(L"GetRawResource failed");
67 return NULL;
68 }
69
70 if (SUCCEEDED(CreateStreamOnHGlobal(resource, TRUE, &stream))) {
71 return stream;
72 }
73
74 GlobalFree(resource);
75 return NULL;
76}
77
78static IWICBitmapSource *GetWICBitmap(IStream *imageStream, REFCLSID rclsid) {
79 IWICBitmapSource *bitmap = NULL;

Callers 1

LoadPNGResourceFunction · 0.85

Calls 1

GetRawResourceFunction · 0.85

Tested by

no test coverage detected