Robert Shearman rob@codeweavers.com writes:
- if (!hCabinet) return HRESULT_FROM_WIN32(GetLastError());
- pExtract = GetProcAddress(hCabinet, "Extract");
- if (!pExtract) return HRESULT_FROM_WIN32(GetLastError());
- hr = pExtract(dest, szCabName);
- FreeLibrary(hCabinet);
- return hr;
+}
Unless the app depends on it, it's usually better to not free the library on each call, otherwise repeated calls to the function will be very expensive. You can free the library in PROCESS_DETACH.